From 60aa7596e508aa79a8ef005a5714bbbccc4ca6e0 Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Mon, 26 Feb 2018 14:04:30 +0100 Subject: [PATCH] [FIX] account, purchase: Recurrent vendor bills (#23320) - set due date based on payment terms at generation for recurring bills - do not generate "This vendor bill has been created form POXXX" for bills that have been generated by cron --- addons/account/models/account_invoice.py | 2 +- addons/purchase/models/account_invoice.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index c401ed93108..efbb103ccf3 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -509,7 +509,7 @@ class AccountInvoice(models.Model): 'is_recurring_document': True, }) # set the due date - #invoice._onchange_payment_term_date_invoice() + invoice._onchange_payment_term_date_invoice() link = '%s' % (self.id, self.number) invoice.message_post(body=_('This bill has been generated by %s') % link) return invoice diff --git a/addons/purchase/models/account_invoice.py b/addons/purchase/models/account_invoice.py index 4847ddf11ee..fecd7515a39 100644 --- a/addons/purchase/models/account_invoice.py +++ b/addons/purchase/models/account_invoice.py @@ -212,7 +212,7 @@ class AccountInvoice(models.Model): def create(self, vals): invoice = super(AccountInvoice, self).create(vals) purchase = invoice.invoice_line_ids.mapped('purchase_line_id.order_id') - if purchase and not invoice.refund_invoice_id: + if purchase and not invoice.refund_invoice_id and not invoice.is_recurring_document: message = _("This vendor bill has been created from: %s") % (",".join([""+order.name+"" for order in purchase])) invoice.message_post(body=message) return invoice