Reset to quotation Shopify sale with insufficient authorized payment amount
Shopify order can be modified from the admin in such way that the total increase and it is only partially paid. In such case we must prevent to process the sale by resetting to quotation until being fully paid. Closes #13961
This commit is contained in:
1 parent
2ed845b7e0
commit
dedbd6df06
1 file changed
+12
-1
@@ -575,7 +575,18 @@ class Shop(metaclass=PoolMeta):
|
||||
Decimal(order.current_total_price) - sale.total_amount)
|
||||
Sale.store_cache(to_update.keys())
|
||||
Amendment._clear_sale(to_update.keys())
|
||||
Sale.__queue__.process(to_update.keys())
|
||||
to_process, to_quote = [], []
|
||||
for sale in to_update:
|
||||
if sale.payment_amount_authorized >= sale.amount_to_pay:
|
||||
to_process.append(sale)
|
||||
else:
|
||||
to_quote.append(sale)
|
||||
if to_process:
|
||||
Sale.__queue__.process(to_process)
|
||||
if to_quote:
|
||||
# Use write because there is no transition
|
||||
Sale.write(to_quote, {'state': 'quotation'})
|
||||
cls.log(to_quote, 'transition', 'state:quotation')
|
||||
|
||||
@classmethod
|
||||
def check_modification(cls, mode, shops, values=None, external=False):
|
||||
|
||||
Reference in new issue
Block a user