[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
This commit is contained in:
oco-odoo
2018-02-26 14:04:30 +01:00
committed by GitHub
parent 5d2c63bf49
commit 60aa7596e5
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -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 = '<a href=# data-oe-model=account.invoice data-oe-id=%d>%s</a>' % (self.id, self.number)
invoice.message_post(body=_('This bill has been generated by %s') % link)
return invoice
+1 -1
View File
@@ -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(["<a href=# data-oe-model=purchase.order data-oe-id="+str(order.id)+">"+order.name+"</a>" for order in purchase]))
invoice.message_post(body=message)
return invoice