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
- Contabilitate
- Inventar
- PoS
- Proiect
- MRP
Această întrebare a fost marcată
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!
Înscrie-te| Related Posts | Răspunsuri | Vizualizări | Activitate | |
|---|---|---|---|---|
|
|
1
mar. 23
|
2859 | ||
|
|
1
oct. 22
|
3469 | ||
|
|
1
dec. 24
|
5592 | ||
|
|
1
dec. 24
|
5138 | ||
|
|
1
oct. 24
|
4834 |