diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py
index 322567674cb..1a927b57a91 100644
--- a/addons/mrp/mrp.py
+++ b/addons/mrp/mrp.py
@@ -240,29 +240,11 @@ class mrp_bom(osv.osv):
return False
level -= 1
return True
-
- def _check_product(self, cr, uid, ids, context=None):
- all_prod = []
- bom_obj = self.pool.get('mrp.bom')
- boms = self.browse(cr, uid, ids, context=context)
- def check_bom(boms):
- res = True
- for bom in boms:
- if bom.product_id.id in all_prod:
- res = res and False
- all_prod.append(bom.product_id.id)
- lines = bom.bom_lines
- if lines:
- newboms = [a for a in lines if a not in boms]
- res = res and check_bom(newboms)
- return res
- return check_bom(boms)
-
_constraints = [
- (_check_recursion, 'Error ! You can not create recursive BoM.', ['parent_id']),
- (_check_product, 'BoM line product should not be same as BoM product.', ['product_id']),
+ (_check_recursion, 'Error ! You can not create recursive BoM.', ['parent_id'])
]
+
def onchange_product_id(self, cr, uid, ids, product_id, name, context=None):
""" Changes UoM and name if product_id changes.
@param name: Name of the field
diff --git a/addons/procurement/procurement_view.xml b/addons/procurement/procurement_view.xml
index 02cfae811eb..9c8ad70fe63 100644
--- a/addons/procurement/procurement_view.xml
+++ b/addons/procurement/procurement_view.xml
@@ -28,7 +28,6 @@
procurement.order.tree.board
procurement.order
tree
-
@@ -247,8 +246,8 @@
diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py
index 72525e4c583..6899b673c70 100644
--- a/addons/product/pricelist.py
+++ b/addons/product/pricelist.py
@@ -262,9 +262,9 @@ class product_pricelist(osv.osv):
price = currency_obj.compute(cr, uid,
price_type.currency_id.id, res['currency_id'],
product_obj.price_get(cr, uid, [product_id],
- price_type.field, context=context)[product_id], round=False, context=context)
+ price_type.field)[product_id], round=False, context=context)
- if price >= 0.0:
+ if price:
price_limit = price
price = price * (1.0+(res['price_discount'] or 0.0))
@@ -385,7 +385,7 @@ class product_pricelist(osv.osv):
else:
price_tmp = self.price_get(cr, uid,
[res['base_pricelist_id']], prod_id,
- qty, context=context)[res['base_pricelist_id']]
+ qty)[res['base_pricelist_id']]
ptype_src = self.browse(cr, uid,
res['base_pricelist_id']).currency_id.id
price = currency_obj.compute(cr, uid, ptype_src,
@@ -413,7 +413,7 @@ class product_pricelist(osv.osv):
price = currency_obj.compute(cr, uid,
price_type.currency_id.id, res['currency_id'],
product_obj.price_get(cr, uid, [prod_id],
- price_type.field, context=context)[prod_id], round=False, context=context)
+ price_type.field)[prod_id], round=False, context=context)
if price:
price_limit = price
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index fdedec3ee34..f2ef17a183d 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -170,7 +170,7 @@ class purchase_order(osv.osv):
'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True),
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True,
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},domain="[('partner_id', '=', partner_id)]"),
- 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', domain="[('partner_id', '!=', False)]",
+ 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address',
states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},
help="Put an address if you want to deliver directly from the supplier to the customer." \
"In this case, it will remove the warehouse link and set the customer location."
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 2587f93a875..0d4df7afc63 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1166,7 +1166,8 @@ class stock_picking(osv.osv):
for move in pick.move_lines:
if move.state in ('done', 'cancel'):
continue
- partial_data = partial_datas.get('move%s'%(move.id), {})
+ partial_data = partial_datas.get('move%s'%(move.id), False)
+ assert partial_data, _('Missing partial picking data for move #%s') % (move.id)
product_qty = partial_data.get('product_qty',0.0)
move_product_qty[move.id] = product_qty
product_uom = partial_data.get('product_uom',False)
@@ -1247,9 +1248,9 @@ class stock_picking(osv.osv):
if new_picking:
move_obj.write(cr, uid, [c.id for c in complete], {'picking_id': new_picking})
- for move in complete:
- if prodlot_ids.get(move.id):
- move_obj.write(cr, uid, move.id, {'prodlot_id': prodlot_ids[move.id]})
+ for move in complete:
+ if prodlot_ids.get(move.id):
+ move_obj.write(cr, uid, move.id, {'prodlot_id': prodlot_ids[move.id]})
for move in too_many:
product_qty = move_product_qty[move.id]
defaults = {
@@ -1462,7 +1463,7 @@ class stock_move(osv.osv):
_description = "Stock Move"
_order = 'date_expected desc, id'
_log_create = False
-
+
def action_partial_move(self, cr, uid, ids, context=None):
if context is None: context = {}
partial_id = self.pool.get("stock.partial.move").create(
@@ -1480,7 +1481,7 @@ class stock_move(osv.osv):
'domain': '[]',
'context': context
}
-
+
def name_get(self, cr, uid, ids, context=None):
res = []
@@ -1854,6 +1855,11 @@ class stock_move(osv.osv):
"""
moves = self.browse(cr, uid, ids, context=context)
self.write(cr, uid, ids, {'state': 'confirmed'})
+ res_obj = self.pool.get('res.company')
+ location_obj = self.pool.get('stock.location')
+ move_obj = self.pool.get('stock.move')
+ wf_service = netsvc.LocalService("workflow")
+
self.create_chained_picking(cr, uid, moves, context)
return []
@@ -1880,14 +1886,6 @@ class stock_move(osv.osv):
@return: True
"""
self.write(cr, uid, ids, {'state': 'confirmed'})
-
- # fix for bug lp:707031
- # called write of related picking because changing move availability does
- # not trigger workflow of picking in order to change the state of picking
- wf_service = netsvc.LocalService('workflow')
- for move in self.browse(cr, uid, ids, context):
- if move.picking_id:
- wf_service.trg_write(uid, 'stock.picking', move.picking_id.id, cr)
return True
#
diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py
index bb091fc6934..c7eab1eef4d 100644
--- a/addons/stock/wizard/stock_invoice_onshipping.py
+++ b/addons/stock/wizard/stock_invoice_onshipping.py
@@ -115,7 +115,7 @@ class stock_invoice_onshipping(osv.osv_memory):
if context is None:
context = {}
picking_pool = self.pool.get('stock.picking')
- onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date'], context=context)
+ onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date'])
if context.get('new_picking', False):
onshipdata_obj['id'] = onshipdata_obj.new_picking
onshipdata_obj[ids] = onshipdata_obj.new_picking
@@ -127,7 +127,7 @@ class stock_invoice_onshipping(osv.osv_memory):
res = picking_pool.action_invoice_create(cr, uid, active_ids,
journal_id = onshipdata_obj[0]['journal_id'],
group = onshipdata_obj[0]['group'],
- type = context.get('inv_type'),
+ type = None,
context=context)
return res
diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py
index 875f78d7641..8cfdc648349 100644
--- a/addons/stock/wizard/stock_move.py
+++ b/addons/stock/wizard/stock_move.py
@@ -21,6 +21,35 @@
from osv import fields, osv
+class stock_move_track(osv.osv_memory):
+ _name = "stock.move.track"
+ _description = "Track moves"
+
+ _columns = {
+ 'tracking_prefix': fields.char('Tracking prefix', size=64),
+ 'quantity': fields.float("Quantity per lot")
+ }
+
+ _defaults = {
+ 'quantity': lambda *x: 1
+ }
+
+ def track_lines(self, cr, uid, ids, context=None):
+ """ To track stock moves lines
+ @param self: The object pointer.
+ @param cr: A database cursor
+ @param uid: ID of the user currently logged in
+ @param ids: An ID or list of IDs if we want more than one
+ @param context: A standard dictionary
+ @return:
+ """
+ datas = self.read(cr, uid, ids)[0]
+ move_obj = self.pool.get('stock.move')
+ move_obj._track_lines(cr, uid, context['active_id'], datas, context=context)
+ return {'type': 'ir.actions.act_window_close'}
+
+stock_move_track()
+
class stock_move_consume(osv.osv_memory):
_name = "stock.move.consume"
_description = "Consume Products"
@@ -69,9 +98,9 @@ class stock_move_consume(osv.osv_memory):
context = {}
move_obj = self.pool.get('stock.move')
move_ids = context['active_ids']
- for data in self.browse(cr, uid, ids):
+ for data in self.read(cr, uid, ids):
move_obj.action_consume(cr, uid, move_ids,
- data.product_qty, data.location_id.id,
+ data['product_qty'], data['location_id'],
context=context)
return {'type': 'ir.actions.act_window_close'}
@@ -130,9 +159,9 @@ class stock_move_scrap(osv.osv_memory):
context = {}
move_obj = self.pool.get('stock.move')
move_ids = context['active_ids']
- for data in self.browse(cr, uid, ids):
+ for data in self.read(cr, uid, ids):
move_obj.action_scrap(cr, uid, move_ids,
- data.product_qty, data.location_id.id,
+ data['product_qty'], data['location_id'],
context=context)
return {'type': 'ir.actions.act_window_close'}
diff --git a/addons/stock/wizard/stock_move_view.xml b/addons/stock/wizard/stock_move_view.xml
index 7f0048ad219..baaa581b4f3 100644
--- a/addons/stock/wizard/stock_move_view.xml
+++ b/addons/stock/wizard/stock_move_view.xml
@@ -2,6 +2,34 @@
+
+ Tracking a move
+ stock.move.track
+ form
+
+
+
+
+
+
+ Tracking a move
+ ir.actions.act_window
+ stock.move.track
+ form
+ form
+ new
+
+
+
diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py
index cc858f0f726..9f644c981a8 100644
--- a/addons/stock/wizard/stock_partial_picking.py
+++ b/addons/stock/wizard/stock_partial_picking.py
@@ -67,9 +67,8 @@ class stock_partial_picking(osv.osv_memory):
for m in pick.move_lines:
if m.state in ('done', 'cancel'):
continue
- move_memory = self.__create_partial_picking_memory(m, pick_type)
- if move_memory:
- result.append(move_memory)
+ result.append(self.__create_partial_picking_memory(m, pick_type))
+
if 'product_moves_in' in fields:
res.update({'product_moves_in': result})
if 'product_moves_out' in fields:
@@ -125,27 +124,12 @@ class stock_partial_picking(osv.osv_memory):
'prodlot_id' : picking.prodlot_id.id,
'move_id' : picking.id,
}
-
+
if pick_type == 'in':
move_memory.update({
'cost' : picking.product_id.standard_price,
'currency' : picking.product_id.company_id and picking.product_id.company_id.currency_id and picking.product_id.company_id.currency_id.id or False,
})
-
- if pick_type == 'out':
- type = picking.picking_id.move_type
- qty_avl = picking.product_id.qty_available
- if type == 'direct' :
- if qty_avl <= 0.0 and picking.state != 'assigned':
- move_memory = {}
- if picking.product_qty > qty_avl and qty_avl > 0.0:
- move_memory.update({
- 'quantity' : qty_avl,
- })
- if picking.state == 'assigned':
- move_memory.update({
- 'quantity' : picking.product_qty,
- })
return move_memory
def do_partial(self, cr, uid, ids, context=None):
diff --git a/addons/survey/wizard/survey_browse_answer.py b/addons/survey/wizard/survey_browse_answer.py
index 6b1e3034974..52664eb48cc 100644
--- a/addons/survey/wizard/survey_browse_answer.py
+++ b/addons/survey/wizard/survey_browse_answer.py
@@ -61,13 +61,14 @@ class survey_browse_answer(osv.osv_memory):
@return : Dictionary value for Open the browse answer wizard.
"""
if context is None: context = {}
- sur_response_obj = self.pool.get('survey.response')
- for record in self.browse(cr, uid, ids,context=context):
- if record.response_id.id:
- res_id = record.response_id.id
- else:
- res_id = sur_response_obj.search(cr, uid, [('survey_id', '=',record.survey_id)])[0]
- context.update({'active' : True,'survey_id' : record.survey_id, 'response_id' : [res_id], 'response_no' : 0})
+ record = self.read(cr, uid, ids, [])
+ record = record and record[0] or {}
+ if record['response_id']:
+ res_id = [(record['response_id'])]
+ else:
+ sur_response_obj = self.pool.get('survey.response')
+ res_id = sur_response_obj.search(cr, uid, [('survey_id', '=',int(record['survey_id']))])
+ context.update({'active' : True,'survey_id' : record['survey_id'], 'response_id' : res_id, 'response_no' : 0})
search_obj = self.pool.get('ir.ui.view')
search_id = search_obj.search(cr,uid,[('model','=','survey.question.wiz'),('name','=','Survey Search')])
return {