Adapt to remove create_invoice_credit_with_refund patch + unify searches new_issued/received_invoices

This commit is contained in:
Raimon Esteve 2020-11-30 12:30:45 +01:00
parent 2b7335c1ff
commit da75ec4ed2
2 changed files with 7 additions and 21 deletions

26
aeat.py
View File

@ -648,7 +648,7 @@ class SIIReport(Workflow, ModelSQL, ModelView):
reg.IDFactura.NumSerieFacturaEmisor
for reg in registers
]),
('state', 'in', ('posted', 'paid')),
('move', '!=', None),
])
invoices_ids = {
invoice.number: invoice.id
@ -906,7 +906,7 @@ class SIIReport(Workflow, ModelSQL, ModelView):
domain = [
('reference', '=', reg.IDFactura.NumSerieFacturaEmisor),
('invoice_date', '=', invoice_date),
('state', 'in', ('posted', 'paid')),
('move', '!=', None),
]
vat = True
if reg.IDFactura.IDEmisorFactura.NIF:
@ -997,17 +997,10 @@ class SIIReport(Workflow, ModelSQL, ModelView):
# search issued invoices [new]
new_issued_invoices = Invoice.search([
('sii_state', 'in', (None, 'Incorrecto')),
('sii_state', 'in', (None, 'Incorrecto', 'Anulada')),
('sii_pending_sending', '=', True),
('type', '=', 'out'),
])
# search possible deleted invoices in SII and not uploaded again
new_issued_invoices += Invoice.search([
('sii_state', '=', 'Anulada'),
('sii_pending_sending', '=', True),
('type', '=', 'out'),
('state', 'in', ['paid', 'posted']),
('move', '!=', None),
])
new_issued_invoices += delete_issued_invoices
@ -1078,17 +1071,10 @@ class SIIReport(Workflow, ModelSQL, ModelView):
# search received invoices [new]
new_received_invoices = Invoice.search([
('sii_state', 'in', (None, 'Incorrecto')),
('sii_state', 'in', (None, 'Incorrecto', 'Anulada')),
('sii_pending_sending', '=', True),
('type', '=', 'in'),
])
# search possible deleted invoices in SII and not uploaded again
new_received_invoices += Invoice.search([
('sii_state', '=', 'Anulada'),
('sii_pending_sending', '=', True),
('type', '=', 'in'),
('state', 'in', ['paid', 'posted']),
('move', '!=', None),
])
new_received_invoices += delete_received_invoices

View File

@ -214,7 +214,7 @@ Credit invoice with refund::
>>> credit.execute('credit')
>>> invoice.reload()
>>> invoice.state
'paid'
'cancel'
>>> credit, = Invoice.find([('total_amount', '<', 0)])
>>> credit.sii_operation_key
'R1'