Hi i am using odoo 14 community edition, when i use bom structure and cost from manufacturing module, the product cost for each components is same as BoM Cost , why is it the same , i want to display each products unit cost in product cost and the total cost(quantity*product cost) in bom cost for each component how can this be made possible. using any configuration, python,xml or is there any free module to achieve the same. This is snippet of the error. Thank you
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilità
- Magazzino
- PoS
- Project
- MRP
La domanda è stata contrassegnata
Hello Jo,
You can create new py file and rewrite the method _get_bom_lines of mrp_report_bom_structure and assign it.
Kindly Refer below example.
from odoo\.addons\.mrp\.report\.mrp_report_bom_structure\ import\ ReportBomStructure
def\ _get_bom_lines\(self,\ bom,\ bom_quantity,\ product,\ line_id,\ level\):
\ \ \ \ \ \ \ \ components\ =\ \[\]
\ \ \ \ \ \ \ \ total\ =\ 0
\ \ \ \ \ \ \ \ for\ line\ in\ bom\.bom_line_ids:
\ \ \ \ \ \ \ \ \ \ \ \ line_quantity\ =\ \(bom_quantity\ /\ \(bom\.product_qty\ or\ 1\.0\)\)\ \*\ line\.product_qty
\ \ \ \ \ \ \ \ \ \ \ \ if\ line\._skip_bom_line\(product\):
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ continue
\ \ \ \ \ \ \ \ \ \ \ \ company\ =\ bom\.company_id\ or\ self\.env\.company
\ \ \ \ \ \ \ \ \ \ \ \ price\ =\ line\.product_id\.uom_id\._compute_price\(line\.product_id\.with_company\(company\)\.standard_price,\ line\.product_uom_id\)
\ \ \ \ \ \ \ \ \ \ \ \ if\ line\.child_bom_id:
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ factor\ =\ line\.product_uom_id\._compute_quantity\(line_quantity,\ line\.child_bom_id\.product_uom_id\)
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sub_total\ =\ self\._get_price\(line\.child_bom_id,\ factor,\ line\.product_id\)
\ \ \ \ \ \ \ \ \ \ \ \ else:
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ sub_total\ =\ price\ \*\ line_quantity
\ \ \ \ \ \ \ \ \ \ \ \ sub_total\ =\ self\.env\.company\.currency_id\.round\(sub_total\)
\ \ \ \ \ \ \ \ \ \ \ \ components\.append\(\{
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'prod_id':\ line\.product_id\.id,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'prod_name':\ line\.product_id\.display_name,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'code':\ line\.child_bom_id\ and\ line\.child_bom_id\.display_name\ or\ '',
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'prod_qty':\ line_quantity,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'prod_uom':\ line\.product_uom_id\.name,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'prod_cost':\ company\.currency_id\.round\(price\),
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'parent_id':\ bom\.id,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'line_id':\ line\.id,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'level':\ level\ or\ 0,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'total':\ sub_total,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'child_bom':\ line\.child_bom_id\.id,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'phantom_bom':\ line\.child_bom_id\ and\ line\.child_bom_id\.type\ ==\ 'phantom'\ or\ False,
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 'attachments':\ self\.env\['mrp\.document'\]\.search\(\['\|',\ '\&',
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \('res_model',\ '=',\ 'product\.product'\),\ \('res_id',\ '=',\ line\.product_id\.id\),\ '\&',\ \('res_model',\ '=',\ 'product\.template'\),\ \('res_id',\ '=',\ line.product_id.product_tmpl_id.id)]),
})
total += sub_total
return components, total
ReportBomStructure._get_bom_lines = _get_bom_lines
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
RegistratiPost correlati | Risposte | Visualizzazioni | Attività | |
---|---|---|---|---|
|
1
apr 22
|
2656 | ||
|
1
gen 22
|
2622 | ||
|
0
nov 15
|
3933 | ||
|
2
lug 25
|
3977 | ||
|
0
giu 21
|
3105 |
Hello jo,
I think there is no any free module that achieve your goal. You have to create customize module for that.
@Shivoham can you tell me how can i create a custom module for this what do i need to inherit to change product cost in this