Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
3252 Переглядів

Hi all,

I'd like to add vendor/client in product moves line so I can see who sold product or who bought it. Also, I'd like to show cost/price to see how much it costed or how much I got for product. Here is visual representation of it 


I know how to inherit view from xml, just don't know how to call this fields (show information) - appreciate any help.

Аватар
Відмінити

Hi,

This is for the which version?

Автор

Sorry I didn't mention it, v15

Найкраща відповідь

Hello Matija,

To get the fields on stock.move.line you need to inherit the model and refer to the below code as well as add the fields on the xml file.
Explanation of the code:
I’ve taken the value of partner(vendor/customer) from its related move_id.partner_id
Where cost_price is a computed field which will be called based on dependencies you add , taking the value from move_id’s particular sale_line_id’s price.

Please find code in comment. 

I Hope this will help you. 

Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari

Аватар
Відмінити

class StockMoveLine(models.Model):
_inherit = "stock.move.line"

partner_name = fields.Many2one('res.partner',string="Partner Name",related="move_id.partner_id")
cost_price = fields.Monetary(compute="compute_cost_price",string="Cost Price",
currency_field="currency_id")
currency_id = fields.Many2one("res.currency",
string="Currency",related='company_id.currency_id',required=True)

@api.depends('qty_done', 'product_uom_id', 'product_id', 'move_id')
def compute_cost_price(self):
for rec in self:
rec.cost_price = 0
rec .cost_price = rec.move_id.sale_line_id.price_subtotal

Автор

This works, thank you so much Jainesh!

Найкраща відповідь

Hi,

The field picking_partner_id already in move lines,
for the location you just need to do, picking_partner_id field visible. and for the cost/price you need to do development where you can display the cost from the lines.

Thanks,


Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
Last purchase date Вирішено
2
вер. 21
3879
2
бер. 15
4041
1
лист. 24
4134
1
серп. 23
1711
2
січ. 22
11502