diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 4ce41e9c7d7..72a82fbca27 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -396,11 +396,11 @@ class AccountMove(models.Model): self.partner_id = False return {'warning': warning} - if self.is_sale_document(include_receipts=True) and self.partner_id.property_payment_term_id: - self.invoice_payment_term_id = self.partner_id.property_payment_term_id + if self.is_sale_document(include_receipts=True) and self.partner_id: + self.invoice_payment_term_id = self.partner_id.property_payment_term_id or self.invoice_payment_term_id new_term_account = self.partner_id.commercial_partner_id.property_account_receivable_id - elif self.is_purchase_document(include_receipts=True) and self.partner_id.property_supplier_payment_term_id: - self.invoice_payment_term_id = self.partner_id.property_supplier_payment_term_id + elif self.is_purchase_document(include_receipts=True) and self.partner_id: + self.invoice_payment_term_id = self.partner_id.property_supplier_payment_term_id or self.invoice_payment_term_id new_term_account = self.partner_id.commercial_partner_id.property_account_payable_id else: new_term_account = None