Sergi Almacellas Abellana pushed to branch branch/default at Tryton / Tryton
Commits: 57e7226a by Sergi Almacellas Abellana at 2023-05-16T09:35:15+02:00 Do not test quantity for lines of type different than line Closes #12274 - - - - - 3 changed files: - modules/account_rule/purchase.py - modules/account_rule/sale.py - modules/account_rule/tests/scenario_account_rule.rst Changes: ===================================== modules/account_rule/purchase.py ===================================== @@ -10,5 +10,5 @@ def get_invoice_line(self): with Transaction().set_context( taxes=[t.id for t in self.taxes], - return_=self.quantity < 0): + return_=self.type == 'line' and self.quantity < 0): return super().get_invoice_line() ===================================== modules/account_rule/sale.py ===================================== @@ -10,5 +10,5 @@ def get_invoice_line(self): with Transaction().set_context( taxes=[t.id for t in self.taxes], - return_=self.quantity < 0): + return_=self.type == 'line' and self.quantity < 0): return super().get_invoice_line() ===================================== modules/account_rule/tests/scenario_account_rule.rst ===================================== @@ -95,6 +95,9 @@ >>> line = sale.lines.new() >>> line.product = product >>> line.quantity = -1 + >>> line = sale.lines.new() + >>> line.type = 'comment' + >>> line.description = 'Sample' >>> sale.click('quote') >>> sale.click('confirm') >>> sale.state View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/57e7226a2a3a0f2af00e3c31a36106a45b2c2512 -- View it on Heptapod: https://foss.heptapod.net/tryton/tryton/-/commit/57e7226a2a3a0f2af00e3c31a36106a45b2c2512 You're receiving this email because of your account on foss.heptapod.net.