Hi,
I want to add a many2many fields in my invoice! but when i use _prepare_invoice method i got an empty fields in my invoice view and no records in x_fleet_vehicle_invoice_rel table! so hope someone can help me with this...
class SaleOrderInherited(models.Model):
_inherit = 'sale.order'
order_field = fields.Many2many('fleet.vehicle', 'x_fleet_vehicle_sale_order_rel', 'order_id', 'vehicle_id', string='Order Field ')
@api.multi
def _prepare_invoice(self):
res = super(SaleOrder, self)._prepare_invoice()
res['invoice_field'] = self.order_field
return res
class AccountInvoiceInherited(models.Model):
_inherit = 'account.invoice'
invoice_field = fields.Many2many('fleet.vehicle', 'x_fleet_vehicle_invoice_rel', 'invoice_id', 'vehicle_id', string='Invoice Field')