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 @@
-
-
+
-
+
diff --git a/addons/mrp/wizard/mrp_price.py b/addons/mrp/wizard/mrp_price.py
index b136326a2dc..c392ee22131 100644
--- a/addons/mrp/wizard/mrp_price.py
+++ b/addons/mrp/wizard/mrp_price.py
@@ -25,7 +25,7 @@ class mrp_price(osv.osv_memory):
_name = 'mrp.product_price'
_description = 'Product Price'
_columns = {
- 'number': fields.integer('Quantity', required=True, help="Specify quantity of products to produce or buy. Report of Cost structure will be displayed base on this qunatity."),
+ 'number': fields.integer('Quantity', required=True, help="Specify quantity of products to produce or buy. Report of Cost structure will be displayed base on this quantity."),
}
_defaults = {
'number': 1,
diff --git a/addons/product/product.py b/addons/product/product.py
index b3fa3c594f4..45ce0f620b6 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -327,7 +327,8 @@ class product_template(osv.osv):
return True
_constraints = [
- (_check_uos, 'Error: UOS must be in a different category than the UOM', ['uos_id']),
+ # As Per do changes given by lp bug : 543979
+# (_check_uos, 'Error: UOS must be in a different category than the UOM', ['uos_id']),
(_check_uom, 'Error: The default UOM and the purchase UOM must be in the same category.', ['uom_id']),
]
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 299b81a9c01..7abfc292872 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1904,6 +1904,12 @@ class stock_move(osv.osv):
acc_variation = accounts.get('property_stock_variation', False)
journal_id = accounts['stock_journal']
+ if acc_dest == acc_variation:
+ raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Output Account on defined on this product and Variant account on category of this product is same.'))
+
+ if acc_src == acc_variation:
+ raise osv.except_osv(_('Error!'), _('Can not create Journal Entry, Input Account on defined on this product and Variant account on category of this product is same.'))
+
if not acc_src:
raise osv.except_osv(_('Error!'), _('There is no stock input account defined for this product or its category: "%s" (id: %d)') % \
(move.product_id.name, move.product_id.id,))
@@ -2416,6 +2422,12 @@ class stock_inventory(osv.osv):
return self.pool.get('stock.move').create(cr, uid, move_vals)
def action_done(self, cr, uid, ids, context=None):
+ """ Finished the inventory
+ @return: True
+ """
+
+ if context is None:
+ context = {}
move_obj = self.pool.get('stock.move')
for inv in self.browse(cr, uid, ids, context=context):
move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context)
@@ -2423,7 +2435,7 @@ class stock_inventory(osv.osv):
return True
def action_confirm(self, cr, uid, ids, context=None):
- """ Finishes the inventory and writes its finished date
+ """ Confirm the inventory and writes its finished date
@return: True
"""
if context is None:
@@ -2434,7 +2446,7 @@ class stock_inventory(osv.osv):
product_context = dict(context, compute_child=False)
location_obj = self.pool.get('stock.location')
- for inv in self.browse(cr, uid, ids):
+ for inv in self.browse(cr, uid, ids, context=context):
move_ids = []
for line in inv.inventory_line_id:
pid = line.product_id.id
diff --git a/addons/stock/wizard/stock_splitinto.py b/addons/stock/wizard/stock_splitinto.py
index 72949695fde..3d208ca0418 100644
--- a/addons/stock/wizard/stock_splitinto.py
+++ b/addons/stock/wizard/stock_splitinto.py
@@ -63,10 +63,10 @@ class stock_split_into(osv.osv_memory):
})
- if quantity_rest>0:
+ if quantity_rest > 0:
quantity_rest = move.product_qty - quantity
tracking_id = track_obj.create(cr, uid, {}, context=context)
- if quantity==0.0:
+ if quantity == 0.0:
move_obj.write(cr, uid, [move.id], {'tracking_id': tracking_id}, context=context)
else:
default_val = {