validate tax exempt
This commit is contained in:
parent
e147f913c4
commit
30c2951b6b
|
@ -21,5 +21,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_party_without_account_receivable">
|
||||
<field name="text">Party "%(s)s" has no any account receivable defined. Please, assign one. </field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_dont_account_other_income">
|
||||
<field name="text">Product "%(product)s" has no account other income defined in account category. Please, assign one. </field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
17
sale.py
17
sale.py
|
@ -263,13 +263,16 @@ class Sale(metaclass=PoolMeta):
|
|||
sale=sale.rec_name))
|
||||
super(Sale, cls).delete(sales)
|
||||
|
||||
def _get_invoice_sale(self):
|
||||
invoice = super(Sale, self)._get_invoice_sale()
|
||||
invoice.reference = self.reference
|
||||
invoice.description = self.description
|
||||
invoice.comment = self.comment
|
||||
invoice.shop = self.shop.id
|
||||
invoice.invoice_type = self.invoice_type
|
||||
def create_invoice(self):
|
||||
invoice = super(Sale, self).create_invoice()
|
||||
print('ingresa por este valor')
|
||||
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
|
||||
return invoice
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue