trytond-aeat_sii/sale.py
Sergio Morillo 97833b9583 Reset SII keys on update_taxes method.
This commit refs #21374
2021-12-23 15:51:18 +01:00

26 lines
631 B
Python

# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from decimal import Decimal
from trytond.pool import PoolMeta
__all__ = ['Sale']
ZERO = Decimal('0.0')
class Sale(metaclass=PoolMeta):
__name__ = 'sale.sale'
def create_invoice(self):
invoice = super(Sale, self).create_invoice()
if not invoice:
return
if invoice.untaxed_amount < ZERO:
invoice.sii_operation_key = 'R1'
else:
invoice.sii_operation_key = 'F1'
invoice.save()
return invoice