You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
584 B

  1. from odoo import api, fields, models, _
  2. class AccountInvoice(models.Model):
  3. _inherit = "account.invoice"
  4. def _prepare_invoice_line_from_po_line(self, line):
  5. """ Override parent's method to invert Purchase Order Reference on invoice line"""
  6. invoice_line = super(
  7. AccountInvoice, self
  8. )._prepare_invoice_line_from_po_line(line)
  9. if self.user_has_groups(
  10. "beesdoo_purchase." "group_invert_po_ref_on_inv_line"
  11. ):
  12. invoice_line["name"] = line.name + ": " + line.order_id.name
  13. return invoice_line