set shop in create invoice
This commit is contained in:
parent
6775574ac3
commit
d441b31ba8
|
@ -1 +0,0 @@
|
|||
,presik,presik,21.04.2023 14:15,file:///home/presik/.config/libreoffice/4;
|
10
sale.py
10
sale.py
|
@ -24,6 +24,7 @@ from .exceptions import (
|
|||
SaleForceDraftError, SaleDeviceError, DraftStatementError,
|
||||
PartyMissingAccount
|
||||
)
|
||||
from trytond.model.exceptions import AccessError
|
||||
from trytond.modules.sale.exceptions import SaleValidationError
|
||||
|
||||
_ZERO = Decimal('0.00')
|
||||
|
@ -322,6 +323,15 @@ class Sale(metaclass=PoolMeta):
|
|||
invoice_lines = list(invoice.lines) + invoice_lines
|
||||
invoice.lines = invoice_lines
|
||||
invoice.turn = self._get_turn()
|
||||
invoice.shop = self.shop
|
||||
if invoice.shop and invoice.shop.tax_exempt:
|
||||
for line in invoice.lines:
|
||||
if not line.product.account_category.account_other_income:
|
||||
raise AccessError(
|
||||
gettext('sale_shop.msg_dont_account_other_income',
|
||||
product=line.product.rec_name))
|
||||
line.account = line.product.account_category.account_other_income
|
||||
|
||||
invoice.save()
|
||||
Invoice.update_taxes([invoice])
|
||||
self.copy_resources_to(invoice)
|
||||
|
|
Loading…
Reference in New Issue