diff options
| author | Achraf (abz) <abz@odoo.com> | 2021-05-17 13:31:03 +0000 |
|---|---|---|
| committer | Achraf (abz) <abz@odoo.com> | 2021-05-18 07:47:48 +0000 |
| commit | 3e4a541277828ec9cd0bd97587c6d87dc91ccf08 (patch) | |
| tree | 4131af0ea08ebd3640c3c41d7f9be9edc72ec392 | |
| parent | 2eee690d307e5a55dd2fc6ac05124ddd9c496da5 (diff) | |
[FIX] sale: Traceback when changing date order
When the user removes the readonly from the field date order and tries
to modify it it crashes in some cases, this commit fix this
opw-2523508
closes odoo/odoo#70895
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
| -rw-r--r-- | addons/sale/models/sale.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py index 9c28c66a593..37f30458176 100644 --- a/addons/sale/models/sale.py +++ b/addons/sale/models/sale.py @@ -1158,7 +1158,7 @@ class SaleOrderLine(models.Model): def _expected_date(self): self.ensure_one() - order_date = fields.Datetime.from_string(self.order_id.date_order if self.order_id.state in ['sale', 'done'] else fields.Datetime.now()) + order_date = fields.Datetime.from_string(self.order_id.date_order if self.order_id.date_order and self.order_id.state in ['sale', 'done'] else fields.Datetime.now()) return order_date + timedelta(days=self.customer_lead or 0.0) @api.depends('product_uom_qty', 'discount', 'price_unit', 'tax_id') |
