changeset 41ef7cfbcd02 in modules/sale:default
details: https://hg.tryton.org/modules/sale?cmd=changeset;node=41ef7cfbcd02
description:
        Enforce salable product only for draft and quotation

        issue8059
        review54511002
diffstat:

 sale.py |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (17 lines):

diff -r 4d6e834ebf92 -r 41ef7cfbcd02 sale.py
--- a/sale.py   Wed Jan 30 09:45:59 2019 +0100
+++ b/sale.py   Wed Feb 13 10:39:54 2019 +0100
@@ -982,7 +982,12 @@
     unit_digits = fields.Function(fields.Integer('Unit Digits'),
         'on_change_with_unit_digits')
     product = fields.Many2One('product.product', 'Product',
-        ondelete='RESTRICT', domain=[('salable', '=', True)],
+        ondelete='RESTRICT',
+        domain=[
+            If(Eval('sale_state').in_(['draft', 'quotation']),
+                ('salable', '=', True),
+                ()),
+            ],
         states={
             'invisible': Eval('type') != 'line',
             'readonly': Eval('sale_state') != 'draft',

Reply via email to