Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
1319 Vizualizări

Create my field '' servicios_ids''  in my fsm.order model which relates to the product.product model

Model fsm.order field:
          servicios_ids = fields.One2many('product.product', "service_ids",string="Servicios")  

Model product.product field:
      service_ids = fields.Many2one('fsm.order', string='Servicios')


When I add a line to my one2many field, the same product that I added is created again and this causes my products in inventory to be duplicated.

 any ideas?


Imagine profil
Abandonează
Cel mai bun răspuns

Hi,


You can try this code:


class FSMOrder(models.Model):

    _name = 'fsm.order'


    servicios_ids = fields.One2many('frm.order.line', 'order_id', string="Servicios")



class FSMOrderLine(models.Model):

    _name = 'frm.order.line'

   

    order_id = fields.Many2one(

        comodel_name='frm.order',

        string="Order")

    product_id = fields.Many2one(

        comodel_name='product.product',

        string="Product",

        change_default=True, ondelete='restrict') 


Hope it helps

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
iun. 22
2452
1
iun. 22
1563
1
oct. 23
1460
1
mai 23
1964
0
sept. 22
1942