Skip to Content
Menu
This question has been flagged

how we suppose to do that, is it possible to use Many2many fields or we can create another model with vehicle_id and partner_id.

how create and edit vehicle_number fetch automatically cutomer_id many2many field when vehicle already existing vehicle number with different partner_id

I try to used vehicle.master.model in field many2many vehicle_number and relation with invoice module when create vehicle_number in invoice to not fetch automatically when vehicle_number is already created with different partner_id.


class VehicleMaster(models.Model):
    _name = "vehicle.master.model"
    _description = "Vehicle Master"
    _rec_name = 'x_vehicle_number_id'

    x_brand_id = fields.Many2one('vehicle.brand.model', string="Brand Name",ondelete='restrict')
    x_model_id = fields.Many2one('vehicle.model.model', string="Model Name",domain="  [('brand_id','=',x_brand_id)]",ondelete='restrict')
    x_vehicle_number_id = fields.Char(string="Vehicle Number", required=True, tracking=True,ondelete='restrict')
    x_customer_id = fields.Many2many('res.partner',string="Customers",required=True,tracking=True)

class CustomInvoice(models.Model):
    _inherit = "account.move"

    vehicle_number = fields.Many2one('vehicle.master.model',string='Vehicle number',domain="[('x_customer_id','=',partner_id)]")


Avatar
Discard
Related Posts Replies Views Activity
2
Jan 23
3240
0
Sep 22
965
1
Jul 22
1062
1
Jun 22
1563
1
May 22
1953