[IMP]pms_api_rest: draft invoice use invoice_date_due

This commit is contained in:
Darío Lodeiros
2022-12-30 17:42:56 +01:00
parent 433658bfb2
commit c0eec7e712
2 changed files with 10 additions and 3 deletions

View File

@@ -796,6 +796,13 @@ class PmsFolioService(Component):
self.env["ir.config_parameter"].sudo().get_param("web.base.url")
+ move_url
)
invoice_date = (
move.invoice_date.strftime("%d/%m/%Y")
if move.invoice_date
else move.invoice_date_due.strftime("%d/%m/%Y")
if move.invoice_date_due
else None
)
invoices.append(
PmsFolioInvoiceInfo(
id=move.id if move.id else None,
@@ -803,9 +810,7 @@ class PmsFolioService(Component):
amount=round(move.amount_total, 2)
if move.amount_total
else None,
date=move.invoice_date.strftime("%d/%m/%Y")
if move.invoice_date
else None,
date=invoice_date,
state=move.state if move.state else None,
paymentState=move.payment_state
if move.payment_state

View File

@@ -146,6 +146,8 @@ class PmsInvoiceService(Component):
# so, we need to save and rewrite it. in all line that are not updated or deleted
for line in invoice.invoice_line_ids.filtered(
lambda l: l.id not in updated_invoice_lines_name
if updated_invoice_lines_name
else []
and l.id
not in [
line[1] for line in new_vals["invoice_line_ids"] if line[0] == 2