diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-02-02 14:31:30 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-02-02 14:31:30 +0100 |
| commit | f0a63e591380642a105b7325aa29cd82a2966cda (patch) | |
| tree | f252f204eb091e3e984651ea317da3a76e4451e7 /addons | |
| parent | a7c664fb6cfce730309197fcb71bca4dc9a9084d (diff) | |
[FIX] delivery: avoid calling unknown method.
Only call `product_id_change_margin` method if exists. This method is
defined in `sale_margin` module, but as there is no dependency between
modules (nor a bridge module), the call have to be done here.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/delivery/models/sale_order.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/delivery/models/sale_order.py b/addons/delivery/models/sale_order.py index 50cebb1da75..233723ce712 100644 --- a/addons/delivery/models/sale_order.py +++ b/addons/delivery/models/sale_order.py @@ -92,8 +92,13 @@ class SaleOrder(models.Model): } if self.order_line: values['sequence'] = self.order_line[-1].sequence + 1 - so = SaleOrderLine.create(values) - so.product_id_change_margin() + sol = SaleOrderLine.create(values) + if hasattr(sol, 'product_id_change_margin'): + # if `sale_margin` module is installed, force computation of field `purchase_price` + # As there is not dependency between modules (nor a bridge module), this is the only + # place we can get the value for this field + sol.product_id_change_margin() + return sol class SaleOrderLine(models.Model): |
