diff options
| author | Martin Trigaux <mat@odoo.com> | 2014-12-10 11:21:17 +0100 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2014-12-10 11:49:19 +0100 |
| commit | 3695886531a66aa93f31e979c6d23b8865cbef0f (patch) | |
| tree | 8bb6c622b001f10f8adf29ea280066a3099e89d6 /addons | |
| parent | 5d60c1c887e9a7d0a36b8483f264ab6a7691b942 (diff) | |
[FIX] account: avoid losing product on invoice
Add restriction on product_id field to prevent the suppression of the product
if already present in an invoice.
This is to avoid the suppression of a used product variant when modifying
the list of attributes.#
Due to the constrain, the variant will be disabled instead of deleted.
Fixes #4129
Add warning message on the product form to warn users about the potential impact
of modifying variants.
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/account_invoice.py | 2 | ||||
| -rw-r--r-- | addons/product/product_view.xml | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index e94a60a545c..e2eddf5b9b0 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -1261,7 +1261,7 @@ class account_invoice_line(models.Model): uos_id = fields.Many2one('product.uom', string='Unit of Measure', ondelete='set null', index=True) product_id = fields.Many2one('product.product', string='Product', - ondelete='set null', index=True) + ondelete='restrict', index=True) account_id = fields.Many2one('account.account', string='Account', required=True, domain=[('type', 'not in', ['view', 'closed'])], default=_default_account, diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index c764ab06045..01c9ff2d721 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -250,6 +250,11 @@ <field string="List of Variants" name="product_variant_count" widget="statinfo" /> </button> </div> + <p class="oe_grey"> + <strong>Warning</strong>: adding or deleting attributes + will delete and recreate existing variants and lead + to the loss of its eventual customizations. + </p> <field name="attribute_line_ids" widget="one2many_list" context="{'show_attribute': False}"> <tree string="Variants" editable="bottom"> <field name="attribute_id"/> |
