diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py
index 6fc926980dd..ab9c1d11342 100644
--- a/addons/product/pricelist.py
+++ b/addons/product/pricelist.py
@@ -93,6 +93,7 @@ class product_pricelist(osv.osv):
_name = "product.pricelist"
_description = "Pricelist"
+ _order = 'name'
_columns = {
'name': fields.char('Pricelist Name',size=64, required=True, translate=True),
'active': fields.boolean('Active', help="If unchecked, it will allow you to hide the pricelist without removing it."),
@@ -111,6 +112,27 @@ class product_pricelist(osv.osv):
result.append((pl.id,name))
return result
+ def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
+ if name and operator == '=' and not args:
+ # search on the name of the pricelist and its currency, opposite of name_get(),
+ # Used by the magic context filter in the product search view.
+ query_args = {'name': name, 'limit': limit}
+ query = """SELECT p.id
+ FROM product_pricelist p JOIN
+ res_currency c ON (p.currency_id = c.id)
+ WHERE p.name || ' (' || c.name || ')' = %(name)s
+ ORDER BY p.name"""
+ if limit:
+ query += " LIMIT %(limit)s"
+ cr.execute(query, query_args)
+ ids = [r[0] for r in cr.fetchall()]
+ # regular search() to apply ACLs - may limit results below limit in some cases
+ ids = self.search(cr, uid, [('id', 'in', ids)], limit=limit, context=context)
+ if ids:
+ return self.name_get(cr, uid, ids, context)
+ return super(product_pricelist, self).name_search(
+ cr, uid, name, args, operator=operator, context=context, limit=limit)
+
def _get_currency(self, cr, uid, ctx):
comp = self.pool.get('res.users').browse(cr, uid, uid).company_id
diff --git a/addons/product/product.py b/addons/product/product.py
index 518e455ddc1..2730f70511f 100644
--- a/addons/product/product.py
+++ b/addons/product/product.py
@@ -415,6 +415,11 @@ class product_product(osv.osv):
pricelist = context.get('pricelist', False)
partner = context.get('partner', False)
if pricelist:
+ # Support context pricelists specified as display_name or ID for compatibility
+ if isinstance(pricelist, basestring):
+ pricelist_ids = self.pool.get('product.pricelist').name_search(
+ cr, uid, pricelist, operator='=', context=context, limit=1)
+ pricelist = pricelist_ids[0][0] if pricelist_ids else pricelist
for id in ids:
try:
price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], id, quantity, partner=partner, context=context)[pricelist]
@@ -757,7 +762,7 @@ class product_product(osv.osv):
context = {}
if context and context.get('search_default_categ_id', False):
args.append((('categ_id', 'child_of', context['search_default_categ_id'])))
- return super(product_product, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=False)
+ return super(product_product, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
class product_packaging(osv.osv):
diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml
index 00e925fd6a0..2eefb3a2384 100644
--- a/addons/product/product_view.xml
+++ b/addons/product/product_view.xml
@@ -15,7 +15,7 @@
-
+
diff --git a/addons/project/project.py b/addons/project/project.py
index 0230a45abbd..0528dc8aae3 100644
--- a/addons/project/project.py
+++ b/addons/project/project.py
@@ -281,7 +281,7 @@ class project(osv.osv):
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'task_count': fields.function(_task_count, type='integer', string="Open Tasks"),
'color': fields.integer('Color Index'),
- 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True,
+ 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
help="Internal email associated with this project. Incoming emails are automatically synchronized"
"with Tasks (or optionally Issues if the Issue Tracker module is installed)."),
'alias_model': fields.selection(_alias_models, "Alias Model", select=True, required=True,
@@ -745,6 +745,16 @@ class task(base_stage, osv.osv):
new_name = _("%s (copy)") % (default.get('name', ''))
default.update({'name':new_name})
return super(task, self).copy_data(cr, uid, id, default, context)
+
+ def copy(self, cr, uid, id, default=None, context=None):
+ if context is None:
+ context = {}
+ if default is None:
+ default = {}
+ stage = self._get_default_stage_id(cr, uid, context=context)
+ if stage:
+ default['stage_id'] = stage
+ return super(task, self).copy(cr, uid, id, default, context)
def _is_template(self, cr, uid, ids, field_name, arg, context=None):
res = {}
@@ -1368,6 +1378,18 @@ class account_analytic_account(osv.osv):
raise osv.except_osv(_('Warning!'), _('Please delete the project linked with this account first.'))
return super(account_analytic_account, self).unlink(cr, uid, ids, *args, **kwargs)
+ def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
+ if args is None:
+ args = []
+ if context is None:
+ context={}
+ if context.get('current_model') == 'project.project':
+ project_ids = self.search(cr, uid, args + [('name', operator, name)], limit=limit, context=context)
+ return self.name_get(cr, uid, project_ids, context=context)
+
+ return super(account_analytic_account, self).name_search(cr, uid, name, args=args, operator=operator, context=context, limit=limit)
+
+
class project_project(osv.osv):
_inherit = 'project.project'
_defaults = {
diff --git a/addons/project_mrp/process/project_mrp_process.xml b/addons/project_mrp/process/project_mrp_process.xml
index e2195c6f61b..59915715999 100644
--- a/addons/project_mrp/process/project_mrp_process.xml
+++ b/addons/project_mrp/process/project_mrp_process.xml
@@ -46,6 +46,23 @@
Process Transition
-->
+
+
+
+
+ subflow
+ Procurement
+
+
+ object.state=='confirmed'
+
+
diff --git a/addons/project_mrp/project_mrp.py b/addons/project_mrp/project_mrp.py
index bb25b4aae24..215c8ef757f 100644
--- a/addons/project_mrp/project_mrp.py
+++ b/addons/project_mrp/project_mrp.py
@@ -106,4 +106,3 @@ class sale_order(osv.osv):
'picked_rate': fields.function(_picked_rate, method=True, string='Picked', type='float'),
}
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/purchase/partner.py b/addons/purchase/partner.py
index 5e5af0815e3..57ada96bd3f 100644
--- a/addons/purchase/partner.py
+++ b/addons/purchase/partner.py
@@ -41,7 +41,7 @@ class res_partner(osv.osv):
default.update({'purchase_order_ids': []})
- super(res_partner, self).copy(cr, uid, id, default=default, context=context)
+ return super(res_partner, self).copy(cr, uid, id, default=default, context=context)
def _commercial_fields(self, cr, uid, context=None):
return super(res_partner, self)._commercial_fields(cr, uid, context=context) + ['property_product_pricelist_purchase']
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index e24a6e45fe0..8f72f1e4a4f 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/addons/sale_mrp/sale_mrp.py b/addons/sale_mrp/sale_mrp.py
index 77a35972638..f043791d0d9 100644
--- a/addons/sale_mrp/sale_mrp.py
+++ b/addons/sale_mrp/sale_mrp.py
@@ -69,6 +69,19 @@ class mrp_production(osv.osv):
res[production.id] = move.sale_line_id and move.sale_line_id.order_id.client_order_ref or False
return res
+ def _hook_create_post_procurement(self, cr, uid, production, procurement_id, context=None):
+ def get_parent_move(move):
+ if move.move_dest_id:
+ return get_parent_move(move.move_dest_id)
+ return move
+
+ res = super(mrp_production, self)._hook_create_post_procurement(cr, uid, production, procurement_id, context)
+ if production.move_prod_id:
+ parent_move_line = get_parent_move(production.move_prod_id)
+ if parent_move_line and parent_move_line.sale_line_id:
+ self.pool.get('procurement.order').write(cr, uid, procurement_id, {'sale_line_id': parent_move_line.sale_line_id.id})
+ return res
+
_columns = {
'sale_name': fields.function(_ref_calc, multi='sale_name', type='char', string='Sale Name', help='Indicate the name of sales order.'),
'sale_ref': fields.function(_ref_calc, multi='sale_name', type='char', string='Sale Reference', help='Indicate the Customer Reference from sales order.'),
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 7d2a1282cb0..36db32d52e8 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1910,7 +1910,8 @@ class stock_move(osv.osv):
"""
if not prod_id:
return {}
- lang = False
+ user = self.pool.get('res.users').browse(cr, uid, uid)
+ lang = user and user.lang or False
if partner_id:
addr_rec = self.pool.get('res.partner').browse(cr, uid, partner_id)
if addr_rec:
@@ -2053,7 +2054,10 @@ class stock_move(osv.osv):
ptype = todo[0][1][5] and todo[0][1][5] or location_obj.picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
if picking:
# name of new picking according to its type
- new_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + ptype)
+ if ptype == 'internal':
+ new_pick_name = seq_obj.get(cr, uid,'stock.picking')
+ else :
+ new_pick_name = seq_obj.get(cr, uid, 'stock.picking.' + ptype)
pickid = self._create_chained_picking(cr, uid, new_pick_name, picking, ptype, todo, context=context)
# Need to check name of old picking because it always considers picking as "OUT" when created from Sales Order
old_ptype = location_obj.picking_type_get(cr, uid, picking.move_lines[0].location_id, picking.move_lines[0].location_dest_id)
@@ -2940,8 +2944,8 @@ class stock_warehouse(osv.osv):
def _default_lot_output_id(self, cr, uid, context=None):
try:
- lot_input_stock_model, lot_input_stock_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_output')
- self.pool.get('stock.location').check_access_rule(cr, uid, [lot_input_stock_id], 'read', context=context)
+ lot_output_model, lot_output_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'stock_location_output')
+ self.pool.get('stock.location').check_access_rule(cr, uid, [lot_output_id], 'read', context=context)
except (ValueError, orm.except_orm):
# the user does not have read access on the location or it does not exists
lot_output_id = False
@@ -2999,6 +3003,18 @@ class stock_picking_in(osv.osv):
# instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').signal_workflow(cr, uid, ids, signal, context=context)
+ def message_post(self, *args, **kwargs):
+ """Post the message on stock.picking to be able to see it in the form view when using the chatter"""
+ return self.pool.get('stock.picking').message_post(*args, **kwargs)
+
+ def message_subscribe(self, *args, **kwargs):
+ """Send the subscribe action on stock.picking model as it uses _name in request"""
+ return self.pool.get('stock.picking').message_subscribe(*args, **kwargs)
+
+ def message_unsubscribe(self, *args, **kwargs):
+ """Send the unsubscribe action on stock.picking model to match with subscribe"""
+ return self.pool.get('stock.picking').message_unsubscribe(*args, **kwargs)
+
_columns = {
'backorder_id': fields.many2one('stock.picking.in', 'Back Order of', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),
'state': fields.selection(
@@ -3060,6 +3076,18 @@ class stock_picking_out(osv.osv):
# instead of its own workflow (which is not existing)
return self.pool.get('stock.picking').signal_workflow(cr, uid, ids, signal, context=context)
+ def message_post(self, *args, **kwargs):
+ """Post the message on stock.picking to be able to see it in the form view when using the chatter"""
+ return self.pool.get('stock.picking').message_post(*args, **kwargs)
+
+ def message_subscribe(self, *args, **kwargs):
+ """Send the subscribe action on stock.picking model as it uses _name in request"""
+ return self.pool.get('stock.picking').message_subscribe(*args, **kwargs)
+
+ def message_unsubscribe(self, *args, **kwargs):
+ """Send the unsubscribe action on stock.picking model to match with subscribe"""
+ return self.pool.get('stock.picking').message_unsubscribe(*args, **kwargs)
+
_columns = {
'backorder_id': fields.many2one('stock.picking.out', 'Back Order of', states={'done':[('readonly', True)], 'cancel':[('readonly',True)]}, help="If this shipment was split, then this field links to the shipment which contains the already processed part.", select=True),
'state': fields.selection(
diff --git a/addons/stock/stock_demo.xml b/addons/stock/stock_demo.xml
index 94844ee8904..eb5a6c46380 100644
--- a/addons/stock/stock_demo.xml
+++ b/addons/stock/stock_demo.xml
@@ -287,16 +287,6 @@
-
- multicomp
- multicomp
- multicomp
-
-
-
-
-
-
diff --git a/addons/stock/tests/test_multicompany.py b/addons/stock/tests/test_multicompany.py
index d30e7d0ef2b..fb840a846ea 100644
--- a/addons/stock/tests/test_multicompany.py
+++ b/addons/stock/tests/test_multicompany.py
@@ -36,7 +36,13 @@ class TestStockMulticompany(common.TransactionCase):
self.stock_fill_inventory = self.registry('stock.fill.inventory')
self.stock_warehouse = self.registry('stock.warehouse')
- model, self.multicompany_user_id = self.ir_model_data.get_object_reference(cr, uid, 'stock', 'multicompany_user')
+ model, group_user_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'base', 'group_user')
+ model, group_stock_manager_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'stock', 'group_stock_manager')
+ model, company_2_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'stock', 'res_company_2')
+ self.multicompany_user_id = self.res_users.create(cr, uid,
+ {'name': 'multicomp', 'login': 'multicomp',
+ 'groups_id': [(6, 0, [group_user_id, group_stock_manager_id])],
+ 'company_id': company_2_id, 'company_ids': [(6,0,[company_2_id])]})
def test_00_multicompany_default_stock_move(self):
"""check no error on getting default stock.move values in multicompany setting"""
diff --git a/addons/stock/wizard/stock_change_standard_price.py b/addons/stock/wizard/stock_change_standard_price.py
index e6614724454..f83fd044aca 100644
--- a/addons/stock/wizard/stock_change_standard_price.py
+++ b/addons/stock/wizard/stock_change_standard_price.py
@@ -27,7 +27,7 @@ class change_standard_price(osv.osv_memory):
_name = "stock.change.standard.price"
_description = "Change Standard Price"
_columns = {
- 'new_price': fields.float('Price', required=True, digits_compute=dp.get_precision('Account'),
+ 'new_price': fields.float('Price', required=True, digits_compute=dp.get_precision('Product Price'),
help="If cost price is increased, stock variation account will be debited "
"and stock output account will be credited with the value = (difference of amount * quantity available).\n"
"If cost price is decreased, stock variation account will be creadited and stock input account will be debited."),
diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py
index 992c64ea134..57ca03a8205 100644
--- a/addons/stock/wizard/stock_return_picking.py
+++ b/addons/stock/wizard/stock_return_picking.py
@@ -159,13 +159,15 @@ class stock_return_picking(osv.osv_memory):
returned_lines = 0
# Create new picking for returned products
+
+ seq_obj_name = 'stock.picking'
+ new_type = 'internal'
if pick.type =='out':
new_type = 'in'
+ seq_obj_name = 'stock.picking.in'
elif pick.type =='in':
new_type = 'out'
- else:
- new_type = 'internal'
- seq_obj_name = 'stock.picking.' + new_type
+ seq_obj_name = 'stock.picking.out'
new_pick_name = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)
new_picking = pick_obj.copy(cr, uid, pick.id, {
'name': _('%s-%s-return') % (new_pick_name, pick.name),
|