diff --git a/mrp_production_real_cost/__openerp__.py b/mrp_production_real_cost/__openerp__.py index 2fa957fbd..54c669a97 100644 --- a/mrp_production_real_cost/__openerp__.py +++ b/mrp_production_real_cost/__openerp__.py @@ -15,6 +15,7 @@ "stock_account", "product_variant_cost_price", ], + 'license': 'AGPL-3', "author": "OdooMRP team, " "AvanzOSC, " "Serv. Tecnol. Avanzados - Pedro M. Baeza, " 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 233de3b88..fcd8904e3 100644 --- a/mrp_production_real_cost/models/mrp_production_workcenter_line.py +++ b/mrp_production_real_cost/models/mrp_production_workcenter_line.py @@ -4,6 +4,7 @@ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import api, fields, models +from openerp.tools.translate import _ class MrpProductionWorkcenterLine(models.Model): @@ -26,9 +27,11 @@ class MrpProductionWorkcenterLine(models.Model): product = workcenter.product_id journal_id = workcenter.costs_journal_id or self.env.ref( 'mrp.analytic_journal_machines', False) - name = ((production.name or '') + '-' + - (self.routing_wc_line.operation.code or '') + '-' + - (product.default_code or '')) + name = "-".join([production.name or '', + workcenter.code or '', + self.routing_wc_line.routing_id.code or '', + product.default_code or '', + _('HOUR')]) general_acc = workcenter.costs_general_account_id or False price = -(workcenter.costs_hour * operation_line.uptime) if price: @@ -41,6 +44,7 @@ class MrpProductionWorkcenterLine(models.Model): ('workorder', '=', False)]) analytic_vals['task_id'] = task and task[0].id or False analytic_vals['product_uom_id'] = hour_uom.id + analytic_vals['ref'] = workcenter.costs_hour_account_id.name analytic_line_obj.create(analytic_vals) @api.multi @@ -60,16 +64,20 @@ class MrpProductionWorkcenterLine(models.Model): name = '' if cost_type == 'pre': product = workcenter.pre_op_product - name = ((production.name or '') + '-' + - (self.routing_wc_line.operation.code or '') + '-PRE-' + - (product.default_code or '')) + name = "-".join([production.name or '', + workcenter.code or '', + self.routing_wc_line.routing_id.code or '', + product.default_code or '', + _('PRE')]) price = -self.pre_cost qty = self.time_start elif cost_type == 'post': product = workcenter.post_op_product - name = ((production.name or '') + '-' + - (self.routing_wc_line.operation.code or '') + '-POST-' + - (product.default_code or '')) + name = "-".join([production.name or '', + workcenter.code or '', + self.routing_wc_line.routing_id.code or '', + product.default_code or '', + _('POST')]) price = -self.post_cost qty = self.time_stop if price: diff --git a/mrp_production_real_cost/models/stock_move.py b/mrp_production_real_cost/models/stock_move.py index 67259cbd2..6e1ac12cc 100644 --- a/mrp_production_real_cost/models/stock_move.py +++ b/mrp_production_real_cost/models/stock_move.py @@ -4,6 +4,7 @@ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from openerp import api, models +from openerp.tools.translate import _ class StockMove(models.Model): @@ -19,9 +20,12 @@ class StockMove(models.Model): for record in records: journal_id = self.env.ref('mrp.analytic_journal_materials', False) production = record.raw_material_production_id - name = ((production.name or '') + '-' + - (record.work_order.routing_wc_line.operation.code or '') + - '-' + (record.product_id.default_code or '')) + name = "-".join([ + production.name or '', + record.work_order.workcenter_id.code or '', + record.work_order.routing_wc_line.routing_id.code or '', + record.product_id.default_code or '', + _('MAT')]) analytic_vals = (production._prepare_real_cost_analytic_line( journal_id, name, production, record.product_id, workorder=record.work_order, qty=record.product_qty,