Skip to Content
Menú
This question has been flagged
2 Respostes
1236 Vistes

Dear Odoo helpers,

In Purchase module. I added 'Product Category' in the list view as shown in the top image. The bottom image is the associated image of this purchase order (P00011). How can I pass the 'product category' information in P00011 to WH/IN/00006? So that once clicking the Inventory Receipt, the user will see 'product category' info there? 

Thank you for advice.   



Avatar
Descartar
Best Answer

Hi,

We can use related attributes filed here to pass value from purchase order to receipt.

class Stock(models.Model)_inherit = 'stock.move'

categ_id = fields.Many2One('product.category', related = 'picking_id.purchase_id.categ_id')

Replace the field cteg_id by your field name.


Hope it helps,

Avatar
Descartar
Autor Best Answer

Jaideep,

yes. It helped. Thank you so much.

Could please explain the logic behind?


I have a follow up question... 

Product Category shows the contents in  WH/IN/00XX, but no in  WH/OUT/00XX. How to get it show up in  WH/OUT/00XX?


I used below commands. It now can show up contents at both 'IN' and 'OUT' 'Product Category' fields

class StockMove(models.Model): 
  _inherit = "stock.move"     categ_id = fields.Many2one('product.category', 'Product Category', related = 'product_id.categ_id', required=True) class Picking(models.Model):
    _inherit = "stock.picking"  
categ_id = fields.Many2one('product.category', 'Product Category', related = 'product_id.categ_id')


Avatar
Descartar
Related Posts Respostes Vistes Activitat
4
de gen. 25
1169
4
d’abr. 24
1753
4
de maig 25
2074
2
de maig 25
5390
1
de març 25
1315