[FIX] No bill name in annex_name field

This commit is contained in:
Степан Савельев 2020-08-03 16:24:44 +05:00 committed by Иван Широких
parent 9f8be7c000
commit d6c61e137f

View File

@ -123,10 +123,10 @@ class ContractOrderAnnex(models.Model, IDocument, Extension):
} }
def get_name_by_document_template(self, document_template_id): def get_name_by_document_template(self, document_template_id):
bill_name = None active_invoices = self.order_id.invoice_ids.filtered(
for invoice in self.order_id.invoice_ids: lambda r: r.state not in ("draft", "cancel")
bill_name = invoice.number )
break bill_name = active_invoices and active_invoices[-1].number
return ( return (
{ {