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.
 
 
 
 
 

14 lines
564 B

from odoo import api, fields, models, _
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
def _prepare_invoice_line_from_po_line(self, line):
""" Override parent's method to invert Purchase Order Reference on invoice line"""
invoice_line = super(AccountInvoice, self)._prepare_invoice_line_from_po_line(line)
if self.user_has_groups(
'beesdoo_purchase.'
'group_invert_po_ref_on_inv_line'):
invoice_line['name'] = line.name + ': ' + line.order_id.name
return invoice_line