Ir al contenido
Menú
Se marcó esta pregunta

I am in the process of customizing our database's tablet view of work orders. I want to write some code to populate the lot id of the products that are being consumed by the work order.


I want to write some logic that will use the finished_lot_id​ to auto-populate the lot id of the product that is being consumed. 


For example, if the work order has a finished_lot_id​that is called "lot_123", and the work order consumes a product called "Input Product", I want the tablet view to automatically populate the input lot ID of "Input Product" to match; the lot ID automatically populates with "lot_123".


In this case, I am assuming that "Input Product" already has a lot id with the matching name of "lot_123" - i.e. it doesnt need to be created. 


Currently, the input lot id is either empty, or populated with the FIFO rule of lots for that input product. I want to change that functionality as stated above. 


Where in code is the tablet view of a work order populating the input lot ids? I cant find where this happens.


I have found where the finished_lot_id​ is populated and the view to display this value. 

- Model field here: ~/Odoo/enterprise/mrp_workorder/models/quality.py​ line 207 :

`finished_lot_id = fields.Many2one('stock.lot', 'Finished Lot/Serial', related='production_id.lot_producing_id', store=True)`

- View displayed here: ~/Odoo/enterprise/mrp_workorder/views/mrp_workorder_views.xml​ line 23: `name="finished_lot_id" string="Finished Lot/Serial Number" attrs="{'column_invisible': [('parent.product_tracking', '=', 'none')]}"/>`


I am looking for the same code but for the input lot id. There are multiple places in code with lot_id​ defined in both work orders and manufacturing orders. 

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
oct 24
2056
0
sept 22
2461
0
oct 19
5873
0
feb 23
1668
1
nov 22
2852