diff --git a/mrp_production_real_cost/__openerp__.py b/mrp_production_real_cost/__openerp__.py index 8c64469a0..c09892453 100644 --- a/mrp_production_real_cost/__openerp__.py +++ b/mrp_production_real_cost/__openerp__.py @@ -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", diff --git a/mrp_production_real_cost/i18n/es.po b/mrp_production_real_cost/i18n/es.po index e007d3730..3c3bfe947 100644 --- a/mrp_production_real_cost/i18n/es.po +++ b/mrp_production_real_cost/i18n/es.po @@ -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 \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 \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" diff --git a/mrp_production_real_cost/i18n/it.po b/mrp_production_real_cost/i18n/it.po new file mode 100644 index 000000000..c7e6444a0 --- /dev/null +++ b/mrp_production_real_cost/i18n/it.po @@ -0,0 +1,97 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_production_real_costs +# +# Translators: +# Massimiliano Casa , 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 \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" diff --git a/mrp_production_real_cost/i18n/pt_BR.po b/mrp_production_real_cost/i18n/pt_BR.po index 16b8a2445..fb9efa393 100644 --- a/mrp_production_real_cost/i18n/pt_BR.po +++ b/mrp_production_real_cost/i18n/pt_BR.po @@ -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 \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 \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 "" diff --git a/mrp_production_real_cost/i18n/ro.po b/mrp_production_real_cost/i18n/ro.po new file mode 100644 index 000000000..ba0497e83 --- /dev/null +++ b/mrp_production_real_cost/i18n/ro.po @@ -0,0 +1,97 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_production_real_costs +# +# Translators: +# Dorin Hongu , 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 \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 "" diff --git a/mrp_production_real_cost/i18n/sl.po b/mrp_production_real_cost/i18n/sl.po index 0f6d5fd05..af50cfb29 100644 --- a/mrp_production_real_cost/i18n/sl.po +++ b/mrp_production_real_cost/i18n/sl.po @@ -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č \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" diff --git a/mrp_production_real_cost/models/__init__.py b/mrp_production_real_cost/models/__init__.py index e87caf4c2..95f9cbed8 100644 --- a/mrp_production_real_cost/models/__init__.py +++ b/mrp_production_real_cost/models/__init__.py @@ -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 diff --git a/mrp_production_real_cost/models/mrp_bom.py b/mrp_production_real_cost/models/mrp_bom.py index 8ac5d55fa..8499f49cc 100644 --- a/mrp_production_real_cost/models/mrp_bom.py +++ b/mrp_production_real_cost/models/mrp_bom.py @@ -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 diff --git a/mrp_production_real_cost/models/mrp_production.py b/mrp_production_real_cost/models/mrp_production.py index 42067aef2..7c5f13994 100644 --- a/mrp_production_real_cost/models/mrp_production.py +++ b/mrp_production_real_cost/models/mrp_production.py @@ -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: diff --git a/mrp_production_real_cost/models/mrp_production_workcenter_line.py b/mrp_production_real_cost/models/mrp_production_workcenter_line.py index 298165d0a..81da71591 100644 --- a/mrp_production_real_cost/models/mrp_production_workcenter_line.py +++ b/mrp_production_real_cost/models/mrp_production_workcenter_line.py @@ -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) diff --git a/mrp_production_real_cost/models/project_task_work.py b/mrp_production_real_cost/models/project_task_work.py deleted file mode 100644 index b951b2a00..000000000 --- a/mrp_production_real_cost/models/project_task_work.py +++ /dev/null @@ -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 diff --git a/mrp_production_real_cost/models/stock_move.py b/mrp_production_real_cost/models/stock_move.py index bca465fce..de519174a 100644 --- a/mrp_production_real_cost/models/stock_move.py +++ b/mrp_production_real_cost/models/stock_move.py @@ -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