Enforce salable product only for draft and quotation

issue8059
review54511002
This commit is contained in:
Cédric Krier committed 2019-02-13 10:39:54 +01:00
1 parent 4116d3b7f0
commit e9c7713405
1 file changed
+6 -1
+6 -1
View File
@@ -982,7 +982,12 @@ class SaleLine(sequence_ordered(), ModelSQL, ModelView):
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',