Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0][IMP] custom_mrp_line_cost: New fields in stock move lines. #366

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo noupdate="1">
<record forcecreate="True" id="moveline_standard_price" model="decimal.precision">
<field name="name">MRP Price Decimal Precision</field>
Expand Down
27 changes: 19 additions & 8 deletions custom_mrp_line_cost/i18n/custom_mrp_line_cost.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-20 11:29+0000\n"
"PO-Revision-Date: 2024-02-20 11:29+0000\n"
"POT-Creation-Date: 2024-07-02 06:20+0000\n"
"PO-Revision-Date: 2024-07-02 06:20+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -87,6 +87,16 @@ msgstr ""
msgid "Canal Cost"
msgstr ""

#. module: custom_mrp_line_cost
#: model:ir.model.fields,field_description:custom_mrp_line_cost.field_stock_move_line__clean_qty
msgid "Clean"
msgstr ""

#. module: custom_mrp_line_cost
#: model:ir.model.fields,field_description:custom_mrp_line_cost.field_stock_move_line__clean_performance
msgid "Clean Performance"
msgstr ""

#. module: custom_mrp_line_cost
#: model:ir.model.fields,field_description:custom_mrp_line_cost.field_mrp_bom_byproduct__coefficient
msgid "Coefficient"
Expand Down Expand Up @@ -156,6 +166,7 @@ msgstr ""

#. module: custom_mrp_line_cost
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.mrp_production_form_view
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.production_move_line_ids_tree_view
#, python-format
Expand Down Expand Up @@ -297,6 +308,7 @@ msgstr ""

#. module: custom_mrp_line_cost
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.mrp_production_form_view
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.production_finished_move_line_ids_tree_view
#, python-format
Expand Down Expand Up @@ -335,12 +347,6 @@ msgstr ""
msgid "Price Difference"
msgstr ""

#. module: custom_mrp_line_cost
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#, python-format
msgid "Produced Move Lines"
msgstr ""

#. module: custom_mrp_line_cost
#: model:ir.model,name:custom_mrp_line_cost.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
Expand Down Expand Up @@ -377,6 +383,11 @@ msgstr ""
msgid "Purchase Unit Price"
msgstr ""

#. module: custom_mrp_line_cost
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.mrp_production_form_view
msgid "Recalculate Costs"
msgstr ""

#. module: custom_mrp_line_cost
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.mrp_production_form_view
msgid "Rto. %"
Expand Down
27 changes: 19 additions & 8 deletions custom_mrp_line_cost/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-20 11:30+0000\n"
"PO-Revision-Date: 2024-02-20 11:30+0000\n"
"POT-Creation-Date: 2024-07-02 06:21+0000\n"
"PO-Revision-Date: 2024-07-02 06:21+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -87,6 +87,16 @@ msgstr "Peso medio canal"
msgid "Canal Cost"
msgstr "Coste canal"

#. module: custom_mrp_line_cost
#: model:ir.model.fields,field_description:custom_mrp_line_cost.field_stock_move_line__clean_qty
msgid "Clean"
msgstr "Limpio"

#. module: custom_mrp_line_cost
#: model:ir.model.fields,field_description:custom_mrp_line_cost.field_stock_move_line__clean_performance
msgid "Clean Performance"
msgstr "Rendimiento limpio"

#. module: custom_mrp_line_cost
#: model:ir.model.fields,field_description:custom_mrp_line_cost.field_mrp_bom_byproduct__coefficient
msgid "Coefficient"
Expand Down Expand Up @@ -156,6 +166,7 @@ msgstr "Nombre mostrado"

#. module: custom_mrp_line_cost
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.mrp_production_form_view
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.production_move_line_ids_tree_view
#, python-format
Expand Down Expand Up @@ -297,6 +308,7 @@ msgstr "Importe total de salidas"

#. module: custom_mrp_line_cost
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.mrp_production_form_view
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.production_finished_move_line_ids_tree_view
#, python-format
Expand Down Expand Up @@ -335,12 +347,6 @@ msgstr "Albaranes por hacer"
msgid "Price Difference"
msgstr "Diferencia"

#. module: custom_mrp_line_cost
#: code:addons/custom_mrp_line_cost/models/mrp_production.py:0
#, python-format
msgid "Produced Move Lines"
msgstr "Operaciones creadas"

#. module: custom_mrp_line_cost
#: model:ir.model,name:custom_mrp_line_cost.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
Expand Down Expand Up @@ -377,6 +383,11 @@ msgstr "Importe de compra"
msgid "Purchase Unit Price"
msgstr "Precio unitario"

#. module: custom_mrp_line_cost
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.mrp_production_form_view
msgid "Recalculate Costs"
msgstr "Recalcular costes"

#. module: custom_mrp_line_cost
#: model_terms:ir.ui.view,arch_db:custom_mrp_line_cost.mrp_production_form_view
msgid "Rto. %"
Expand Down
63 changes: 13 additions & 50 deletions custom_mrp_line_cost/models/killing_cost.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,18 @@ class KillingCost(models.Model):
_name = "killing.cost"
_description = "Workcenter Cost"

workcenter_id = fields.Many2one(
string="Workcenter",
comodel_name="mrp.workcenter",
)
january = fields.Float(
string="January",
digits="Killing Cost Decimal Precision",
)
february = fields.Float(
string="February",
digits="Killing Cost Decimal Precision",
)
march = fields.Float(
string="March",
digits="Killing Cost Decimal Precision",
)
april = fields.Float(
string="April",
digits="Killing Cost Decimal Precision",
)
may = fields.Float(
string="May",
digits="Killing Cost Decimal Precision",
)
june = fields.Float(
string="June",
digits="Killing Cost Decimal Precision",
)
july = fields.Float(
string="July",
digits="Killing Cost Decimal Precision",
)
august = fields.Float(
string="August",
digits="Killing Cost Decimal Precision",
)
workcenter_id = fields.Many2one(string="Workcenter", comodel_name="mrp.workcenter")
january = fields.Float(string="January", digits="Killing Cost Decimal Precision")
february = fields.Float(string="February", digits="Killing Cost Decimal Precision")
march = fields.Float(string="March", digits="Killing Cost Decimal Precision")
april = fields.Float(string="April", digits="Killing Cost Decimal Precision")
may = fields.Float(string="May", digits="Killing Cost Decimal Precision")
june = fields.Float(string="June", digits="Killing Cost Decimal Precision")
july = fields.Float(string="July", digits="Killing Cost Decimal Precision")
august = fields.Float(string="August", digits="Killing Cost Decimal Precision")
september = fields.Float(
string="September",
digits="Killing Cost Decimal Precision",
)
october = fields.Float(
string="October",
digits="Killing Cost Decimal Precision",
)
november = fields.Float(
string="November",
digits="Killing Cost Decimal Precision",
)
december = fields.Float(
string="December",
digits="Killing Cost Decimal Precision",
string="September", digits="Killing Cost Decimal Precision"
)
october = fields.Float(string="October", digits="Killing Cost Decimal Precision")
november = fields.Float(string="November", digits="Killing Cost Decimal Precision")
december = fields.Float(string="December", digits="Killing Cost Decimal Precision")
9 changes: 2 additions & 7 deletions custom_mrp_line_cost/models/mrp_bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@ class MrpBom(models.Model):
_inherit = "mrp.bom"

pallet_id = fields.Many2one(
string="Pallet",
comodel_name="product.product",
domain="[('palet', '=', True)]",
)
packaging_id = fields.Many2one(
string="Packaging",
comodel_name="product.product",
string="Pallet", comodel_name="product.product", domain="[('palet', '=', True)]"
)
packaging_id = fields.Many2one(string="Packaging", comodel_name="product.product")

@api.model
def name_search(self, name="", args=None, operator="ilike", limit=100):
Expand Down
26 changes: 8 additions & 18 deletions custom_mrp_line_cost/models/mrp_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class MrpProduction(models.Model):
digits="Killing Cost Decimal Precision",
)
rto_canal = fields.Float(
string="Rto. Canal",
compute="_compute_rto_canal",
store=True,
string="Rto. Canal", compute="_compute_rto_canal", store=True
)
canal_cost = fields.Float(
string="Canal Cost",
Expand Down Expand Up @@ -69,19 +67,11 @@ class MrpProduction(models.Model):
store=True,
)
average_cost = fields.Float(
string="Averga Cost",
compute="_compute_average_cost",
store=True,
)
cost = fields.Float(
string="Cost",
compute="_compute_cost",
store=True,
string="Averga Cost", compute="_compute_average_cost", store=True
)
cost = fields.Float(string="Cost", compute="_compute_cost", store=True)
entry_total_amount = fields.Float(
string="Entry Total Amount",
compute="_compute_entry_total_amount",
store=True,
string="Entry Total Amount", compute="_compute_entry_total_amount", store=True
)
output_total_amount = fields.Float(string="Output Total Amount")
consume_qty = fields.Float(
Expand Down Expand Up @@ -136,11 +126,11 @@ def _compute_average_cost(self):
):
average_cost = sum(
line.move_line_ids.filtered(
lambda c: c.location_id == line.location_src_id
lambda c: c.location_id == (line.location_src_id)
).mapped("amount")
) / sum(
line.move_line_ids.filtered(
lambda c: c.location_id == line.location_src_id
lambda c: c.location_id == (line.location_src_id)
).mapped("qty_done")
)
line.average_cost = average_cost
Expand Down Expand Up @@ -263,8 +253,8 @@ def button_calculate_costs(self):
production._compute_entry_total_amount()
elif (
not production.is_deconstruction
and production.average_cost
and production.finished_move_line_ids
and (production.average_cost)
and (production.finished_move_line_ids)
):
for line in production.finished_move_line_ids:
line.applied_price = line.base_price
Expand Down
Loading
Loading