diff options
| author | Rémy Voet (ryv) <ryv@odoo.com> | 2020-10-12 08:56:03 +0000 |
|---|---|---|
| committer | Rémy Voet (ryv) <ryv@odoo.com> | 2020-10-12 08:56:03 +0000 |
| commit | 74780e95a2a3db9d9875aea7e644bf064ecf6b46 (patch) | |
| tree | 20956d5efd42b4d706eccdc3b77f0c38c8312473 | |
| parent | 3c823390beed5f5cfc2e7bb03a65f2775c0be72e (diff) | |
[FIX] purchase: fix state of extra product
As explained in issues-59664, the commit
f18bdc4fcf2b6b0bdb7699c3b2aa38d332301a84 add
readonly attribute in the `purchase.order.line` state field
to avoid to save bad `state` in the server (then the state of the
PO line != PO line).
But it breaks the feature to add product
when the PO is already confirm (the state will be 'purchase' and the
`product_id` is readonly when state == 'purchase').
To fix both issues, add a `default_state` in the context.
It will "bypass" the attrs of `product_id` and the state of PO
('draft') line won't be save because it is readonly.
resolve #59664
closes odoo/odoo#59720
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
| -rw-r--r-- | addons/purchase/views/purchase_views.xml | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/purchase/views/purchase_views.xml b/addons/purchase/views/purchase_views.xml index 70a75440ae9..09a3239e93d 100644 --- a/addons/purchase/views/purchase_views.xml +++ b/addons/purchase/views/purchase_views.xml @@ -208,6 +208,7 @@ <field name="order_line" widget="section_and_note_one2many" mode="tree,kanban" + context="{'default_state': 'draft'}" attrs="{'readonly': [('state', 'in', ('done', 'cancel'))]}"> <tree string="Purchase Order Lines" editable="bottom"> <control> |
