diff --git a/delivery_purchase/README.rst b/delivery_purchase/README.rst index f1c0b2deed..ac3e469491 100644 --- a/delivery_purchase/README.rst +++ b/delivery_purchase/README.rst @@ -89,6 +89,10 @@ Contributors - Vicent Cubells - Carolina Fernandez +- `Sodexis `__: + + - Sandeep J + Maintainers ----------- diff --git a/delivery_purchase/__manifest__.py b/delivery_purchase/__manifest__.py index 52b36bd946..65d4591f5f 100644 --- a/delivery_purchase/__manifest__.py +++ b/delivery_purchase/__manifest__.py @@ -6,12 +6,12 @@ { "name": "Delivery costs in purchases", - "version": "16.0.1.1.0", + "version": "17.0.1.1.0", "development_status": "Production/Stable", "category": "Operations/Purchase", "website": "https://github.com/OCA/delivery-carrier", "author": "Tecnativa, Odoo Community Association (OCA)", "license": "AGPL-3", - "depends": ["purchase", "delivery"], + "depends": ["purchase", "stock_delivery"], "data": ["views/purchase_order_view.xml", "views/stock_picking_view.xml"], } diff --git a/delivery_purchase/models/delivery_carrier.py b/delivery_purchase/models/delivery_carrier.py index 55ae7981f4..3ec8e17832 100644 --- a/delivery_purchase/models/delivery_carrier.py +++ b/delivery_purchase/models/delivery_carrier.py @@ -94,7 +94,7 @@ def purchase_base_on_rule_rate_shipment(self, order): return { "success": False, "price": 0.0, - "error_message": e.name, + "error_message": e.args[0], "warning_message": False, } if order.company_id.currency_id.id != order.currency_id.id: @@ -144,7 +144,7 @@ def _purchase_get_price_available(self, order): order = order.sudo() weight = volume = quantity = 0 for line in order.order_line.filtered( - lambda l: l.state != "cancel" and bool(l.product_id) + lambda ln: ln.state != "cancel" and bool(ln.product_id) ): qty = line.product_uom._compute_quantity( line.product_uom_qty, line.product_id.uom_id diff --git a/delivery_purchase/models/stock_picking.py b/delivery_purchase/models/stock_picking.py index 0345f4137b..a1a578f729 100644 --- a/delivery_purchase/models/stock_picking.py +++ b/delivery_purchase/models/stock_picking.py @@ -1,5 +1,7 @@ # Copyright 2021 Tecnativa - Ernesto Tejeda # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from markupsafe import Markup + from odoo import _, models @@ -29,13 +31,18 @@ def purchase_send_to_shipper(self): if res["tracking_number"]: self.carrier_tracking_ref = res["tracking_number"] order_currency = self.purchase_id.currency_id or self.company_id.currency_id - msg = _( - "Shipment sent to carrier %(carrier_name)s for shipping with tracking " - "number %(tracking_ref)s
Cost: %(carrier_price)s %(currency_name)s" - ) % ( - { + msg = ( + _( + "Shipment sent to carrier %(carrier_name)s for shipping with \ + tracking number %(tracking_ref)s" + ) + % { "carrier_name": self.carrier_id.name, "tracking_ref": self.carrier_tracking_ref, + } + + Markup("
") + + _("Cost: %(carrier_price)s %(currency_name)s") + % { "carrier_price": "%.2f" % self.carrier_price, "currency_name": order_currency.name, } diff --git a/delivery_purchase/readme/CONTRIBUTORS.md b/delivery_purchase/readme/CONTRIBUTORS.md index f78777a08c..5d485351ce 100644 --- a/delivery_purchase/readme/CONTRIBUTORS.md +++ b/delivery_purchase/readme/CONTRIBUTORS.md @@ -3,3 +3,6 @@ - Pedro M. Baeza - Vicent Cubells - Carolina Fernandez + +- [Sodexis](https://www.sodexis.com): + - Sandeep J diff --git a/delivery_purchase/static/description/index.html b/delivery_purchase/static/description/index.html index 0d82e31e0b..41fa33e4d7 100644 --- a/delivery_purchase/static/description/index.html +++ b/delivery_purchase/static/description/index.html @@ -434,6 +434,10 @@

Contributors

  • Carolina Fernandez
  • +
  • Sodexis: +
  • diff --git a/delivery_purchase/tests/test_delivery_purchase.py b/delivery_purchase/tests/test_delivery_purchase.py index c496a485f0..ca61368285 100644 --- a/delivery_purchase/tests/test_delivery_purchase.py +++ b/delivery_purchase/tests/test_delivery_purchase.py @@ -65,9 +65,7 @@ def setUpClass(cls): cls.purchase_line = cls.purchase.order_line def _action_picking_validate(self, picking): - res = picking.button_validate() - model = self.env[res["res_model"]].with_context(**res["context"]) - model.create({}).process() + picking.button_validate() class TestDeliveryPurchase(TestDeliveryPurchaseBase): @@ -129,7 +127,7 @@ def test_picking_carrier_multi(self): picking = self.purchase.picking_ids picking.carrier_id = self.carrier_fixed for move in picking.move_ids_without_package: - move.quantity_done = 1 + move.quantity = 1 res = picking.button_validate() model = self.env[res["res_model"]].with_context(**res["context"]) model.create({}).process_cancel_backorder() diff --git a/delivery_purchase/views/purchase_order_view.xml b/delivery_purchase/views/purchase_order_view.xml index 3fd0a91e74..37fb11e202 100644 --- a/delivery_purchase/views/purchase_order_view.xml +++ b/delivery_purchase/views/purchase_order_view.xml @@ -14,7 +14,7 @@ name="delivery_price" widget='monetary' options="{'currency_field': 'currency_id'}" - attrs="{'invisible': [('carrier_id', '=', False)]}" + invisible="not carrier_id" />
    @@ -24,7 +24,7 @@ > diff --git a/delivery_purchase/views/stock_picking_view.xml b/delivery_purchase/views/stock_picking_view.xml index 79b6e7f969..e8a736b852 100644 --- a/delivery_purchase/views/stock_picking_view.xml +++ b/delivery_purchase/views/stock_picking_view.xml @@ -3,14 +3,17 @@ delivery.stock.picking_withcarrier.form.view stock.picking - +