Hi all,
I'd like to display column name with partner name in stock.move.line
See image attached - already created XML file, but having trouble with py
https://ibb.co/xjFPR3V
Thank you!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
I got answer on stack overflow so I'm copying it here:
You can use the move_id field to access the partner_id field on stock move
class StockMoveLine(models.Model):
_inherit = 'stock.move.line'
partner_name = fields.Many2one(related='move_id.partner_id')And how to modify the tree or form XML file to display an additional column or field with the partner id move_id.partner_id ?
Thanks.
Edit the file addons/stock/models/stock_ move_line.py and add the line
partner_name = ... :
class StockMoveLine(models.Model):
_name = "stock.move.line"
_description = "Product Moves (Stock Move Line)"
_rec_name = "product_id"
_order = "result_package_id desc, id"
partner_name = fields.Many2one(related='move_id.partner_id') #add this line!
picking_id = .....
Then restart odoo and go to Settings -> Technical -> User Interfaces -> Views
and edit the stock.move.line form and tree adding
<field name="partner_name"/>
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up| Related Posts | Replies | Views | Activity | |
|---|---|---|---|---|
|
|
1
Mar 23
|
2918 | ||
|
|
1
Oct 22
|
3519 | ||
|
|
1
Dec 24
|
5770 | ||
|
|
1
Dec 24
|
5205 | ||
|
|
1
Oct 24
|
5031 |