mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[FIX+IMP] mrp_production_real_costs: Use hook
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
{
|
||||
"name": "MRP real costs",
|
||||
"version": "1.0",
|
||||
"version": "8.0.1.0.1",
|
||||
"depends": ["analytic",
|
||||
"project_timesheet",
|
||||
"mrp_project_link",
|
||||
|
||||
@@ -8,9 +8,9 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: odoomrp-wip (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-10-07 10:44+0000\n"
|
||||
"PO-Revision-Date: 2015-10-09 10:55+0000\n"
|
||||
"Last-Translator: Pedro M. Baeza <pedro.baeza@gmail.com>\n"
|
||||
"POT-Creation-Date: 2015-11-20 18:10+0000\n"
|
||||
"PO-Revision-Date: 2015-11-20 18:13+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
|
||||
"Language-Team: Spanish (http://www.transifex.com/oca/odoomrp-wip-8-0/language/es/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@@ -28,6 +28,11 @@ msgstr "% diferencia"
|
||||
msgid "Bill of Material"
|
||||
msgstr "Lista de material"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid "Load final product analytic cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_production
|
||||
msgid "Manufacturing Order"
|
||||
@@ -48,6 +53,11 @@ msgstr ""
|
||||
msgid "Pre-Operation Cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_product_produce
|
||||
msgid "Product Produce"
|
||||
msgstr "Fabricar producto"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_project_task_work
|
||||
msgid "Project Task Work"
|
||||
@@ -58,6 +68,13 @@ msgstr "Trabajo de tarea"
|
||||
msgid "Stock Move"
|
||||
msgstr "Movimiento de existencias"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: help:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid ""
|
||||
"This will allow you to define if those BoM passed back to draft are still "
|
||||
"activated or not"
|
||||
msgstr "De esta manera podrás definir si aquellas LdM vueltas a estado borrador pueden mantenerse activas o no"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production,real_cost:0
|
||||
msgid "Total Real Cost"
|
||||
@@ -74,7 +91,7 @@ msgid "Work Order"
|
||||
msgstr "Orden de trabajo"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: code:addons/mrp_production_real_costs/models/mrp_production.py:92
|
||||
#: code:addons/mrp_production_real_costs/models/mrp_production.py:121
|
||||
#, python-format
|
||||
msgid "You must define one Analytic Account for this MO: %s"
|
||||
msgstr "Debe definir una cuenta analítica para esta MO: %s"
|
||||
|
||||
97
mrp_production_real_cost/i18n/it.po
Normal file
97
mrp_production_real_cost/i18n/it.po
Normal file
@@ -0,0 +1,97 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * mrp_production_real_costs
|
||||
#
|
||||
# Translators:
|
||||
# Massimiliano Casa <mcasa@cantiericasa.com>, 2015
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: odoomrp-wip (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-11-20 18:10+0000\n"
|
||||
"PO-Revision-Date: 2015-10-30 13:07+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
|
||||
"Language-Team: Italian (http://www.transifex.com/oca/odoomrp-wip-8-0/language/it/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: it\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production,percentage_difference:0
|
||||
msgid "% difference"
|
||||
msgstr "% differenza"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_bom
|
||||
msgid "Bill of Material"
|
||||
msgstr "Distinta base"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid "Load final product analytic cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_production
|
||||
msgid "Manufacturing Order"
|
||||
msgstr "Ordine di produzione"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: view:mrp.production:mrp_production_real_costs.mrp_production_form_view_real_costs
|
||||
msgid "Manufacturing costs"
|
||||
msgstr "Costi di produzione"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production.workcenter.line,post_cost:0
|
||||
msgid "Post-Operation Cost"
|
||||
msgstr "Costo Post-lavorazione"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production.workcenter.line,pre_cost:0
|
||||
msgid "Pre-Operation Cost"
|
||||
msgstr "Costo Pre-lavorazione"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_product_produce
|
||||
msgid "Product Produce"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_project_task_work
|
||||
msgid "Project Task Work"
|
||||
msgstr "Attività Progetto"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_stock_move
|
||||
msgid "Stock Move"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: help:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid ""
|
||||
"This will allow you to define if those BoM passed back to draft are still "
|
||||
"activated or not"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production,real_cost:0
|
||||
msgid "Total Real Cost"
|
||||
msgstr "Costo Reale Totale "
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production,unit_real_cost:0
|
||||
msgid "Unit Real Cost"
|
||||
msgstr "Costo unitario reale"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_production_workcenter_line
|
||||
msgid "Work Order"
|
||||
msgstr "Ordine di lavorazione"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: code:addons/mrp_production_real_costs/models/mrp_production.py:121
|
||||
#, python-format
|
||||
msgid "You must define one Analytic Account for this MO: %s"
|
||||
msgstr "Bisogna definire un conto analitico per questo MO: %s"
|
||||
@@ -7,9 +7,9 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: odoomrp-wip (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-10-07 10:44+0000\n"
|
||||
"PO-Revision-Date: 2015-10-09 03:39+0000\n"
|
||||
"Last-Translator: danimaribeiro <danimaribeiro@gmail.com>\n"
|
||||
"POT-Creation-Date: 2015-11-20 18:10+0000\n"
|
||||
"PO-Revision-Date: 2015-10-30 13:07+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
|
||||
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/odoomrp-wip-8-0/language/pt_BR/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
@@ -27,6 +27,11 @@ msgstr ""
|
||||
msgid "Bill of Material"
|
||||
msgstr "Lista de materiais"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid "Load final product analytic cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_production
|
||||
msgid "Manufacturing Order"
|
||||
@@ -47,6 +52,11 @@ msgstr ""
|
||||
msgid "Pre-Operation Cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_product_produce
|
||||
msgid "Product Produce"
|
||||
msgstr "Produzir produto"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_project_task_work
|
||||
msgid "Project Task Work"
|
||||
@@ -57,6 +67,13 @@ msgstr ""
|
||||
msgid "Stock Move"
|
||||
msgstr "Movimentação de estoque"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: help:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid ""
|
||||
"This will allow you to define if those BoM passed back to draft are still "
|
||||
"activated or not"
|
||||
msgstr "Isto permite você definir se as BOM's passadas para provisório são ativadas ou não."
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production,real_cost:0
|
||||
msgid "Total Real Cost"
|
||||
@@ -73,7 +90,7 @@ msgid "Work Order"
|
||||
msgstr "Ordem de serviço"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: code:addons/mrp_production_real_costs/models/mrp_production.py:92
|
||||
#: code:addons/mrp_production_real_costs/models/mrp_production.py:121
|
||||
#, python-format
|
||||
msgid "You must define one Analytic Account for this MO: %s"
|
||||
msgstr ""
|
||||
|
||||
97
mrp_production_real_cost/i18n/ro.po
Normal file
97
mrp_production_real_cost/i18n/ro.po
Normal file
@@ -0,0 +1,97 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * mrp_production_real_costs
|
||||
#
|
||||
# Translators:
|
||||
# Dorin Hongu <dhongu@gmail.com>, 2015
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: odoomrp-wip (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-11-20 18:10+0000\n"
|
||||
"PO-Revision-Date: 2015-11-18 00:48+0000\n"
|
||||
"Last-Translator: Dorin Hongu <dhongu@gmail.com>\n"
|
||||
"Language-Team: Romanian (http://www.transifex.com/oca/odoomrp-wip-8-0/language/ro/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: ro\n"
|
||||
"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production,percentage_difference:0
|
||||
msgid "% difference"
|
||||
msgstr "% diferență"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_bom
|
||||
msgid "Bill of Material"
|
||||
msgstr "Listă de materiale"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid "Load final product analytic cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_production
|
||||
msgid "Manufacturing Order"
|
||||
msgstr "Comandă fabricație"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: view:mrp.production:mrp_production_real_costs.mrp_production_form_view_real_costs
|
||||
msgid "Manufacturing costs"
|
||||
msgstr "Costuri fabricație"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production.workcenter.line,post_cost:0
|
||||
msgid "Post-Operation Cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production.workcenter.line,pre_cost:0
|
||||
msgid "Pre-Operation Cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_product_produce
|
||||
msgid "Product Produce"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_project_task_work
|
||||
msgid "Project Task Work"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_stock_move
|
||||
msgid "Stock Move"
|
||||
msgstr "Mișcare stoc"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: help:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid ""
|
||||
"This will allow you to define if those BoM passed back to draft are still "
|
||||
"activated or not"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production,real_cost:0
|
||||
msgid "Total Real Cost"
|
||||
msgstr "Total costuri reale"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production,unit_real_cost:0
|
||||
msgid "Unit Real Cost"
|
||||
msgstr ""
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_production_workcenter_line
|
||||
msgid "Work Order"
|
||||
msgstr "Comandă de lucru"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: code:addons/mrp_production_real_costs/models/mrp_production.py:121
|
||||
#, python-format
|
||||
msgid "You must define one Analytic Account for this MO: %s"
|
||||
msgstr ""
|
||||
@@ -8,8 +8,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: odoomrp-wip (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-10-07 10:44+0000\n"
|
||||
"PO-Revision-Date: 2015-10-05 04:55+0000\n"
|
||||
"POT-Creation-Date: 2015-11-20 18:10+0000\n"
|
||||
"PO-Revision-Date: 2015-10-31 05:16+0000\n"
|
||||
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
|
||||
"Language-Team: Slovenian (http://www.transifex.com/oca/odoomrp-wip-8-0/language/sl/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -28,6 +28,11 @@ msgstr "% razlike"
|
||||
msgid "Bill of Material"
|
||||
msgstr "Kosovnica"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid "Load final product analytic cost"
|
||||
msgstr "Naloži zadnji analitični strošek proizvoda"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_production
|
||||
msgid "Manufacturing Order"
|
||||
@@ -48,6 +53,11 @@ msgstr "Po-operativni stroški"
|
||||
msgid "Pre-Operation Cost"
|
||||
msgstr "Pred operativni stroški"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_mrp_product_produce
|
||||
msgid "Product Produce"
|
||||
msgstr "Izdelava proizvoda"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: model:ir.model,name:mrp_production_real_costs.model_project_task_work
|
||||
msgid "Project Task Work"
|
||||
@@ -58,6 +68,13 @@ msgstr "Delo na projektnem opravilu"
|
||||
msgid "Stock Move"
|
||||
msgstr "Premik zaloge"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: help:mrp.config.settings,final_product_analytic_cost:0
|
||||
msgid ""
|
||||
"This will allow you to define if those BoM passed back to draft are still "
|
||||
"activated or not"
|
||||
msgstr "Omogoča določanje, če naj kosovnice, ki se vračajo v stanje osnutka, ostanejo aktivirane ali ne"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: field:mrp.production,real_cost:0
|
||||
msgid "Total Real Cost"
|
||||
@@ -74,7 +91,7 @@ msgid "Work Order"
|
||||
msgstr "Delovni nalog"
|
||||
|
||||
#. module: mrp_production_real_costs
|
||||
#: code:addons/mrp_production_real_costs/models/mrp_production.py:92
|
||||
#: code:addons/mrp_production_real_costs/models/mrp_production.py:121
|
||||
#, python-format
|
||||
msgid "You must define one Analytic Account for this MO: %s"
|
||||
msgstr "Potrebno je določiti analitični konto za proizvodni nalog: %s"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
from . import stock_move
|
||||
from . import mrp_production_workcenter_line
|
||||
from . import project_task_work
|
||||
from . import mrp_production
|
||||
from . import mrp_bom
|
||||
from . import mrp_config
|
||||
|
||||
@@ -2,21 +2,19 @@
|
||||
##############################################################################
|
||||
# For copyright and license notices, see __openerp__.py file in root directory
|
||||
##############################################################################
|
||||
from openerp import models
|
||||
from openerp import models, api
|
||||
|
||||
|
||||
class MrpBom(models.Model):
|
||||
_inherit = 'mrp.bom'
|
||||
|
||||
def _get_workorder_operations(self, result2, factor, level=0,
|
||||
routing_id=False):
|
||||
res = super(MrpBom, self)._get_workorder_operations(
|
||||
result2, factor, level=level, routing_id=routing_id)
|
||||
workcenter_obj = self.env['mrp.workcenter']
|
||||
for wkr in res:
|
||||
wc = workcenter_obj.browse(wkr.get('workcenter_id', False))
|
||||
wkr['pre_cost'] = (wkr.get('time_start', 0.0) *
|
||||
wc.pre_op_product.cost_price)
|
||||
wkr['post_cost'] = (wkr.get('time_stop', 0.0) *
|
||||
wc.post_op_product.cost_price)
|
||||
return result2
|
||||
@api.multi
|
||||
def _prepare_wc_line(self, wc_use, level=0, factor=1):
|
||||
res = super(MrpBom, self)._prepare_wc_line(
|
||||
wc_use, level=level, factor=factor)
|
||||
wc = wc_use.workcenter_id
|
||||
res['pre_cost'] = (
|
||||
res.get('time_start', 0.0) * wc.pre_op_product.cost_price)
|
||||
res['post_cost'] = (
|
||||
res.get('time_stop', 0.0) * wc.post_op_product.cost_price)
|
||||
return res
|
||||
|
||||
@@ -71,7 +71,7 @@ class MrpProduction(models.Model):
|
||||
journal_id, name, record, record.product_id, qty=qty,
|
||||
amount=mrp_cost)
|
||||
task = task_obj.search([('mrp_production_id', '=', record.id),
|
||||
('wk_order', '=', False)])
|
||||
('workorder', '=', False)])
|
||||
vals['task_id'] = task and task[0].id or False
|
||||
analytic_line_obj.create(vals)
|
||||
record.real_cost = mrp_cost
|
||||
@@ -112,8 +112,8 @@ class MrpProduction(models.Model):
|
||||
property_obj = self.env['ir.property']
|
||||
if not general_account:
|
||||
general_account = (
|
||||
product.property_account_income or
|
||||
product.categ_id.property_account_income_categ or
|
||||
product.property_account_expense or
|
||||
product.categ_id.property_account_expense_categ or
|
||||
property_obj.get('property_account_expense_categ',
|
||||
'product.category'))
|
||||
if not production.analytic_account_id:
|
||||
|
||||
@@ -56,7 +56,7 @@ class MrpProductionWorkcenterLine(models.Model):
|
||||
general_account=general_acc, workorder=self,
|
||||
qty=operation_line.uptime, amount=price)
|
||||
task = task_obj.search([('mrp_production_id', '=', production.id),
|
||||
('wk_order', '=', False)])
|
||||
('workorder', '=', False)])
|
||||
analytic_vals['task_id'] = task and task[0].id or False
|
||||
analytic_vals['product_uom_id'] = hour_uom.id
|
||||
analytic_line = analytic_line_obj.create(analytic_vals)
|
||||
@@ -97,7 +97,7 @@ class MrpProductionWorkcenterLine(models.Model):
|
||||
general_account=general_acc, workorder=self,
|
||||
qty=qty, amount=price)
|
||||
task = task_obj.search([('mrp_production_id', '=', production.id),
|
||||
('wk_order', '=', False)])
|
||||
('workorder', '=', False)])
|
||||
analytic_vals['task_id'] = task and task[0].id or False
|
||||
analytic_vals['product_uom_id'] = hour_uom.id
|
||||
analytic_line_obj.create(analytic_vals)
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published
|
||||
# by the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, api
|
||||
|
||||
|
||||
class ProjectTaskWork(models.Model):
|
||||
|
||||
_inherit = 'project.task.work'
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
result = super(ProjectTaskWork, self).create(vals)
|
||||
if result.hr_analytic_timesheet_id and result.task_id:
|
||||
analytic_line = result.hr_analytic_timesheet_id.line_id
|
||||
task = result.task_id
|
||||
if task.mrp_production_id or task.wk_order:
|
||||
analytic_line.write({'mrp_production_id':
|
||||
task.mrp_production_id.id,
|
||||
'workorder': task.wk_order.id})
|
||||
return result
|
||||
|
||||
@api.model
|
||||
def write(self, vals):
|
||||
result = super(ProjectTaskWork, self).write(vals)
|
||||
if 'hr_analytic_timesheet_id' in vals or 'task_id' in vals:
|
||||
analytic_line = self.hr_analytic_timesheet_id.line_id
|
||||
task = self.task_id
|
||||
if task.mrp_production_id or task.wk_order:
|
||||
analytic_line.write({'mrp_production_id':
|
||||
task.mrp_production_id.id,
|
||||
'workorder': task.wk_order.id})
|
||||
return result
|
||||
@@ -42,7 +42,7 @@ class StockMove(models.Model):
|
||||
workorder=record.work_order, qty=record.product_qty,
|
||||
amount=(-record.product_id.cost_price * record.product_qty)))
|
||||
task = task_obj.search([('mrp_production_id', '=', production.id),
|
||||
('wk_order', '=', False)])
|
||||
('workorder', '=', False)])
|
||||
analytic_vals['task_id'] = task and task[0].id or False
|
||||
analytic_line_obj.create(analytic_vals)
|
||||
return result
|
||||
@@ -62,9 +62,10 @@ class StockMove(models.Model):
|
||||
if move.state == 'done':
|
||||
product_avail -= move.product_qty
|
||||
template_avail -= move.product_qty
|
||||
new_cost_price = ((amount_unit * product_avail + prod_total_cost) /
|
||||
((product_avail >= 0.0 and product_avail or 0.0)
|
||||
+ move.product_qty))
|
||||
new_cost_price = (
|
||||
(amount_unit * product_avail + prod_total_cost) /
|
||||
((product_avail >= 0.0 and product_avail or 0.0) +
|
||||
move.product_qty))
|
||||
new_std_price = ((template_price * template_avail +
|
||||
prod_total_cost) /
|
||||
((template_avail >= 0.0 and template_avail or
|
||||
|
||||
Reference in New Issue
Block a user