[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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user