Add TaxRule selection in OrderPositionChange (#1700)

Co-authored-by: Raphael Michel <mail@raphaelmichel.de>
This commit is contained in:
Martin Gross
2020-06-30 11:13:33 +02:00
committed by GitHub
parent 626e332886
commit 5f50aa95eb
12 changed files with 176 additions and 8 deletions

View File

@@ -1800,7 +1800,10 @@ class OrderFee(models.Model):
self.fee_type, self.value
)
def _calculate_tax(self):
def _calculate_tax(self, tax_rule=None):
if tax_rule:
self.tax_rule = tax_rule
try:
ia = self.order.invoice_address
except InvoiceAddress.DoesNotExist:
@@ -1956,8 +1959,8 @@ class OrderPosition(AbstractPosition):
self.item.id, self.variation.id if self.variation else 0, self.order_id
)
def _calculate_tax(self):
self.tax_rule = self.item.tax_rule
def _calculate_tax(self, tax_rule=None):
self.tax_rule = tax_rule or self.item.tax_rule
try:
ia = self.order.invoice_address
except InvoiceAddress.DoesNotExist: