From f4ebea2992d16e862ac75a0e5709a6ebac4163bf Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Tue, 23 Nov 2010 18:54:34 +0530 Subject: [PATCH 001/121] [IMP]: Apply removing changes when merge branch bzr revid: ksa@tinyerp.co.in-20101123132434-fm0u05iasfpt0c3p --- addons/mrp/mrp.py | 22 ++++++++++++++++++++-- addons/mrp/mrp_view.xml | 15 ++++++++------- addons/mrp/wizard/mrp_price.py | 2 +- addons/product/product.py | 3 ++- addons/stock/stock.py | 16 ++++++++++++++-- addons/stock/wizard/stock_splitinto.py | 4 ++-- 6 files changed, 47 insertions(+), 15 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 4f5b8f24e14..b42d3797b2f 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -53,11 +53,23 @@ class mrp_workcenter(osv.osv): 'costs_journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal'), 'costs_general_account_id': fields.many2one('account.account', 'General Account', domain=[('type','<>','view')]), 'resource_id': fields.many2one('resource.resource','Resource', ondelete='cascade', required=True), + 'product_id': fields.many2one('product.product','Product'), } _defaults = { 'capacity_per_cycle': 1.0, 'resource_type': 'material', } + + def on_change_product_cost(self, cr, uid, ids, product_id, context=None): + if context is None: + context = {} + res = {'value':{}} + + if product_id: + cost = self.pool.get('product.product').browse(cr, uid, product_id, context=context) + res = {'value' : {'costs_hour' :cost.standard_price }} + return res + mrp_workcenter() @@ -737,7 +749,10 @@ class mrp_production(osv.osv): 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, - 'code': wc.code + 'ref': wc.code, + 'product_id': wc.product_id.id, + 'unit_amount': wc.costs_hour * wc.time_cycle, + 'product_uom_id': wc.product_id.uom_id.id } ) if wc.costs_journal_id and wc.costs_general_account_id: value = wc_line.cycle * wc.costs_cycle @@ -750,7 +765,10 @@ class mrp_production(osv.osv): 'account_id': account, 'general_account_id': wc.costs_general_account_id.id, 'journal_id': wc.costs_journal_id.id, - 'code': wc.code, + 'ref': wc.code, + 'product_id': wc.product_id.id, + 'unit_amount': wc.costs_hour * wc.time_cycle, + 'product_uom_id': wc.product_id.uom_id.id } ) return amount diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 4f6f0c88d54..ea85940d451 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -160,12 +160,13 @@ + - - + + @@ -649,9 +650,9 @@ -