Skip to Content
Menu
This question has been flagged

Hi,

I want to add a many2many fields in my invoice but when i use _prepare_invoice method i got an empty fields 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')
Avatar
Discard
Related Posts Replies Views Activity
1
Aug 21
1319
0
May 15
7801
0
Apr 15
3477
0
Mar 15
4656
2
Jan 16
8167