Skip to Content
Menu
This question has been flagged
2 Replies
1330 Zobrazenia

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
Zrušiť
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
Zrušiť
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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
4
jan 25
1256
4
apr 24
1855
4
máj 25
2427
2
máj 25
5757
1
mar 25
1610