I want to know how to calculate product margin in manufacturing when
coming to BoM with option kit.
I created a BoM and do a sales order for the parent product. When
delivery of the SO its showing as components. Its alright.
But I need to know only how to calculate margin of product .
Kindly help me if any idea
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
Hi Treesa Thomas,
If you want to calculate margin based on bom cost, please try for below code, I used in V12 but hope, it will work for you.
GOTO > BoM > Open Any BoM > Click on Structure & Cost (Changes Quantity)
You can get Cost from there, cost is depends on Quantity.
To calculate on Sale Order you need to define one compute field.
bom_price = fields.Float(
compute='_compute_so_line_bom_price',
store=True,
string='BoM Cost')
@api.depends('product_id', 'product_uom_qty')
def _compute_so_line_bom_price(self):
"""Compute: Product BoM Cost Price.
Compute the BoM Cost Price using _bom_find method of MRP BoM object and
_get_bom method of BoM Structure and Cost Report
(BoM > Smart Button: Structure & Cost).
:return: None
"""
mrp_bom = self.env['mrp.bom']
bom_report = self.env['report.mrp.report_bom_structure']
for res in self:
price = 0
if res.product_id and res.product_uom_qty:
bom = mrp_bom._bom_find(product=res.product_id)
if bom:
price = bom_report._get_bom(
bom_id=bom.id, product_id=str(res.product_id.id),
line_qty=res.product_uom_qty, line_id=False,
level=False)['total'] / res.product_uom_qty
res.bom_price = price
Based on this field you can calculate Margin same as product cost.
Thanks & Regards,
Email: odoo@aktivsoftware.com
Skype: kalpeshmaheshwari
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
2
sie 21
|
3686 | ||
|
1
mar 24
|
3514 | ||
|
1
maj 20
|
7661 | ||
|
1
mar 24
|
3330 | ||
|
1
lip 25
|
2321 |