From a5e737f79cd647643812749ea9b5287858703f47 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 7 Oct 2015 15:24:10 +0200 Subject: [PATCH] [FIX] sale: add lines on a confirmed sale order. When using the editable list on the sale order form, it was not possible to add a new line on a confirmed sale order, while it should (when `Allow to edit sales order` is chosen in the Sales settings). The reason was that the fields `tax_id` and `product_id` were set as readonly when the SO state was not draft. When using the popup/dialog view, it worked by luck, because the line `state`, which is a stored related field to the sale order state, was not correctly computed, and was seen as `draft`, while it should actually be `sale`, for a confirmed sale order. We change the readonly condition of these fields, which is now based on the fact wether or not the line is already invoiced or not, which makes more sense. opw-651573 --- addons/sale/sale.py | 2 +- addons/sale/sale_view.xml | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 2fa632ef8db..cc8a1606102 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -605,7 +605,7 @@ class SaleOrderLine(models.Model): price_total = fields.Monetary(compute='_compute_amount', string='Total', readonly=True, store=True) price_reduce = fields.Monetary(compute='_get_price_reduce', string='Price Reduce', readonly=True, store=True) - tax_id = fields.Many2many('account.tax', string='Taxes', readonly=True, states={'draft': [('readonly', False)]}) + tax_id = fields.Many2many('account.tax', string='Taxes') discount = fields.Float(string='Discount (%)', digits_compute=dp.get_precision('Discount'), default=0.0) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index d7b2ca776ee..60649e75dd6 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -186,7 +186,7 @@ @@ -216,7 +216,8 @@ - +