delete invoice-report if type != pdf
This commit is contained in:
parent
e0cd1a08f1
commit
ba824215c1
1 changed files with 15 additions and 1 deletions
|
@ -103,8 +103,22 @@ class RunXRechnungReport(Wizard):
|
|||
invoices = Invoice.search([
|
||||
('id', '=', data['invoice']),
|
||||
('type', '=', 'out')])
|
||||
to_generate = [x.id for x in invoices if not x.invoice_report_cache]
|
||||
|
||||
# check if stored report is pdf
|
||||
to_delete_report = [
|
||||
x
|
||||
for x in invoices
|
||||
if x.invoice_report_cache and (x.invoice_report_format != 'pdf')]
|
||||
|
||||
# delete reports
|
||||
if to_delete_report:
|
||||
Invoice.write(*[
|
||||
to_delete_report, {
|
||||
'invoice_report_cache': None,
|
||||
'invoice_report_cache_id': None,
|
||||
'invoice_report_format': None}])
|
||||
|
||||
to_generate = [x.id for x in invoices if not x.invoice_report_cache]
|
||||
if to_generate:
|
||||
report_action = XReport.get_used_report()
|
||||
|
||||
|
|
Loading…
Reference in a new issue