mirror of
https://gitlab.com/datalifeit/trytond-aeat_sii
synced 2023-12-13 20:30:37 +01:00
26 lines
631 B
Python
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
|