Skip to content

Commit

Permalink
[14.0][IMP] mrp_production_cost: View costs if the user is in the "Se…
Browse files Browse the repository at this point in the history
…e costs in BoM" group.
  • Loading branch information
alfredoavanzosc authored and anajuaristi committed Dec 10, 2024
1 parent 8faf006 commit 71de46e
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 19 deletions.
3 changes: 3 additions & 0 deletions mrp_production_cost/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Cost related fields in manufacturing orders:
* In "Work Orders" of a Manufacturing Order
* In the Manufacturing Order List

To see costs the user must be in the "See costs in BoM" group. This group is
defined in the "mrp_bom_report_group" module.

Bug Tracker
===========

Expand Down
8 changes: 2 additions & 6 deletions mrp_production_cost/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
"website": "https://github.com/avanzosc/mrp-addons",
"category": "MRP",
"license": "AGPL-3",
"version": "14.0.1.0.0",
"depends": [
"product",
"mrp",
"stock",
],
"version": "14.0.1.1.0",
"depends": ["product", "mrp", "stock", "mrp_bom_report_group"],
"data": [
"views/mrp_production_views.xml",
"views/mrp_stockmove_views.xml",
Expand Down
46 changes: 38 additions & 8 deletions mrp_production_cost/views/mrp_production_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@
expr="//field[@name='move_raw_ids']/tree/field[@name='product_uom_qty']"
position="after"
>
<field name="product_standard_cost" />
<field name="material_cost_to_consume" />
<field name="material_cost_consumed" />
<field
name="product_standard_cost"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="material_cost_to_consume"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="material_cost_consumed"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
</xpath>
<field name="material_cost_to_consume" position="attributes">
<attribute name="sum">Cost Material to consume</attribute>
Expand All @@ -26,15 +35,36 @@
<field name="inherit_id" ref="mrp.mrp_production_tree_view" />
<field name="arch" type="xml">
<field name="company_id" position="after">
<field name="cost_material_to_consume" sum="Cost Material to consume" />
<field name="cost_material_consumed" sum="Cost Material consumed" />
<field name="cost_workorder_estimated" sum="Cost Workorder estimated" />
<field name="cost_workorder_real" sum="Cost Workorder real" />
<field
name="cost_material_to_consume"
sum="Cost Material to consume"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="cost_material_consumed"
sum="Cost Material consumed"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="cost_workorder_estimated"
sum="Cost Workorder estimated"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="cost_workorder_real"
sum="Cost Workorder real"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="cost_manufacturing_estimated"
sum="Cost Manufacturing estimated"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="cost_manufacturing_real"
sum="Cost Manufacturing real"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field name="cost_manufacturing_real" sum="Cost Manufacturing real" />
</field>
</field>
</record>
Expand Down
10 changes: 8 additions & 2 deletions mrp_production_cost/views/mrp_stockmove_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
<field name="inherit_id" ref="stock.view_move_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='company_id']" position="after">
<field name="material_cost_to_consume" />
<field name="material_cost_consumed" />
<field
name="material_cost_to_consume"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="material_cost_consumed"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
</xpath>
<field name="material_cost_to_consume" position="attributes">
<attribute name="sum">Material cost to consume</attribute>
Expand Down
15 changes: 12 additions & 3 deletions mrp_production_cost/views/mrp_workorder_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@
/>
<field name="arch" type="xml">
<xpath expr="//field[@name='duration']" position="after">
<field name="machine_hour_cost" />
<field name="workorder_cost_estimated" />
<field name="workorder_cost_real" />
<field
name="machine_hour_cost"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="workorder_cost_estimated"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
<field
name="workorder_cost_real"
groups="mrp_bom_report_group.group_mrp_bom_report_group_see_cost"
/>
</xpath>
<field name="workorder_cost_estimated" position="attributes">
<attribute name="sum">Workorder Cost estimated</attribute>
Expand Down

0 comments on commit 71de46e

Please sign in to comment.