changeset f9e26851e3c2 in modules/sale_stock_quantity:default
details:
https://hg.tryton.org/modules/sale_stock_quantity?cmd=changeset;node=f9e26851e3c2
description:
Check stock quantity before super calls
This avoid to call side effect method like set_number if the check
fails.
issue8932
review276591002
diffstat:
sale.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (23 lines):
diff -r a1ad3f49ab96 -r f9e26851e3c2 sale.py
--- a/sale.py Wed Dec 04 11:09:36 2019 +0100
+++ b/sale.py Tue Jan 21 00:33:11 2020 +0100
@@ -22,15 +22,17 @@
@ModelView.button
@Workflow.transition('quotation')
def quote(cls, sales):
+ # Check before setting the number
+ cls._check_stock_quantity(sales)
super(Sale, cls).quote(sales)
- cls._check_stock_quantity(sales)
@classmethod
@ModelView.button
@Workflow.transition('confirmed')
def confirm(cls, sales):
+ # Check before queueing the process task
+ cls._check_stock_quantity(sales)
super(Sale, cls).confirm(sales)
- cls._check_stock_quantity(sales)
@classmethod
def _check_stock_quantity(cls, sales):