diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py
index 299a74f52aa..f9f6fb6a279 100644
--- a/addons/project_mrp/project_procurement.py
+++ b/addons/project_mrp/project_procurement.py
@@ -73,6 +73,7 @@ class procurement_order(osv.osv):
'date_deadline': procurement.date_planned,
'planned_hours': planned_hours,
'remaining_hours': planned_hours,
+ 'partner_id': procurement.sale_line_id and procurement.sale_line_id.order_id.partner_id.id or False,
'user_id': procurement.product_id.product_manager.id,
'notes': procurement.note,
'procurement_id': procurement.id,
diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py
index 4be408b59b9..d2060016866 100644
--- a/addons/purchase/purchase.py
+++ b/addons/purchase/purchase.py
@@ -318,21 +318,26 @@ class purchase_order(osv.osv):
for po in self.browse(cr, uid, ids, context=context):
pick_ids += [picking.id for picking in po.picking_ids]
- res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_in_form')
- res_id = res and res[1] or False
-
- return {
- 'name': _('Receptions'),
- 'view_type': 'form',
- 'view_mode': 'form',
- 'view_id': [res_id],
- 'res_model': 'stock.picking',
- 'context': "{'contact_display': 'partner'}",
- 'type': 'ir.actions.act_window',
- 'nodestroy': True,
- 'target': 'current',
- 'res_id': pick_ids and pick_ids[0] or False,
- }
+ action_model, action_id = tuple(mod_obj.get_object_reference(cr, uid, 'stock', 'action_picking_tree4'))
+ action = self.pool.get(action_model).read(cr, uid, action_id, context=context)
+ ctx = eval(action['context'])
+ ctx.update({
+ 'search_default_purchase_id': ids[0]
+ })
+ if pick_ids and len(pick_ids) == 1:
+ form_view_ids = [view_id for view_id, view in action['views'] if view == 'form']
+ view_id = form_view_ids and form_view_ids[0] or False
+ action.update({
+ 'views': [],
+ 'view_mode': 'form',
+ 'view_id': view_id,
+ 'res_id': pick_ids[0]
+ })
+
+ action.update({
+ 'context': ctx,
+ })
+ return action
def wkf_approve_order(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'approved', 'date_approve': fields.date.context_today(self,cr,uid,context=context)})
@@ -863,6 +868,12 @@ class purchase_order_line(osv.osv):
supplier_delay = int(supplier_info.delay) if supplier_info else 0
return datetime.strptime(date_order_str, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=supplier_delay)
+ def _check_product_uom_group(self, cr, uid, context=None):
+ group_uom = self.pool.get('ir.model.data').get_object(cr, uid, 'product', 'group_uom')
+ res = [user for user in group_uom.users if user.id == uid]
+ return len(res) and True or False
+
+
def onchange_product_id(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id,
partner_id, date_order=False, fiscal_position_id=False, date_planned=False,
name=False, price_unit=False, context=None):
@@ -908,7 +919,8 @@ class purchase_order_line(osv.osv):
uom_id = product_uom_po_id
if product.uom_id.category_id.id != product_uom.browse(cr, uid, uom_id, context=context).category_id.id:
- res['warning'] = {'title': _('Warning!'), 'message': _('Selected Unit of Measure does not belong to the same category as the product Unit of Measure.')}
+ if self._check_product_uom_group(cr, uid, context=context):
+ res['warning'] = {'title': _('Warning!'), 'message': _('Selected Unit of Measure does not belong to the same category as the product Unit of Measure.')}
uom_id = product_uom_po_id
res['value'].update({'product_uom': uom_id})
@@ -1083,15 +1095,15 @@ class procurement_order(osv.osv):
procurement_order()
-class mail_message(osv.osv):
- _name = 'mail.message'
- _inherit = 'mail.message'
+class mail_mail(osv.osv):
+ _name = 'mail.mail'
+ _inherit = 'mail.mail'
- def _postprocess_sent_message(self, cr, uid, message, context=None):
- if message.model == 'purchase.order':
+ def _postprocess_sent_message(self, cr, uid, mail, context=None):
+ if mail.model == 'purchase.order':
wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'purchase.order', message.res_id, 'send_rfq', cr)
- return super(mail_message, self)._postprocess_sent_message(cr, uid, message=message, context=context)
+ wf_service.trg_validate(uid, 'purchase.order', mail.res_id, 'send_rfq', cr)
+ return super(mail_mail, self)._postprocess_sent_message(cr, uid, mail=mail, context=context)
-mail_message()
+mail_mail()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml
index 8bfbfbe5ae3..7702d182b09 100644
--- a/addons/purchase/purchase_view.xml
+++ b/addons/purchase/purchase_view.xml
@@ -14,19 +14,40 @@
+
+
+ Pricelist Versions
+ ir.actions.act_window
+ product.pricelist.version
+ form
+
+ [('pricelist_id.type','=','purchase')]
+
+
+ Click to add a pricelist version.
+
+ There can be more than one version of a pricelist, each of
+ these must be valid during a certain period of time. Some
+ examples of versions: Main Prices, 2010, 2011, Summer Sales,
+ etc.
+
+
+
+ action="purchase_pricelist_version_action" id="menu_purchase_pricelist_version_action"
+ parent="menu_purchase_config_pricelist" sequence="2" groups="product.group_purchase_pricelist"/>
+
-
+ action="product.product_price_type_action" id="menu_product_pricelist_action2_purchase_type"
+ parent="menu_purchase_config_pricelist" sequence="60" />
@@ -188,7 +209,7 @@
-
+
diff --git a/addons/purchase/purchase_workflow.xml b/addons/purchase/purchase_workflow.xml
index 00fb5517568..212ce304e07 100644
--- a/addons/purchase/purchase_workflow.xml
+++ b/addons/purchase/purchase_workflow.xml
@@ -145,7 +145,7 @@
- invoice_method<>'order'
+ invoice_method<>'order' and invoiced
diff --git a/addons/purchase/res_config.py b/addons/purchase/res_config.py
index bf7512a8666..19b059d4d5b 100644
--- a/addons/purchase/res_config.py
+++ b/addons/purchase/res_config.py
@@ -46,10 +46,6 @@ class purchase_config_settings(osv.osv_memory):
'group_purchase_delivery_address': fields.boolean("Allow a different address for incoming products and invoicings",
implied_group='purchase.group_delivery_invoice_address',
help="Allows you to specify different delivery and invoice addresses on a purchase order."),
- 'module_purchase_analytic_plans': fields.boolean('Allow using multiple analytic accounts on the same order',
- help ="""Allows the user to maintain several analysis plans. These let you split
- lines on a purchase order between several accounts and analytic plans.
- This installs the module purchase_analytic_plans."""),
'module_warning': fields.boolean("Alerts by products or supplier",
help="""Allow to configure warnings on products and trigger them when a user wants to purchase a given product or a given supplier.
Example: Product: this product is deprecated, do not purchase more than 5.
@@ -62,6 +58,12 @@ class purchase_config_settings(osv.osv_memory):
help="""Purchase Requisitions are used when you want to request quotations from several suppliers for a given set of products.
You can configure per product if you directly do a Request for Quotation
to one supplier or if you want a purchase requisition to negotiate with several suppliers."""),
+ 'module_purchase_analytic_plans': fields.boolean('Use multiple analytic accounts on purchase orders',
+ help ="""Allows the user to maintain several analysis plans. These let you split lines on a purchase order between several accounts and analytic plans.
+ This installs the module purchase_analytic_plans."""),
+ 'group_analytic_account_for_purchases': fields.boolean('Analytic accounting for purchases',
+ implied_group='purchase.group_analytic_accounting',
+ help="Allows you to specify an analytic account on purchase orders."),
}
_defaults = {
@@ -75,7 +77,8 @@ class account_config_settings(osv.osv_memory):
_inherit = 'account.config.settings'
_columns = {
'module_purchase_analytic_plans': fields.boolean('Use multiple analytic accounts on orders',
- help="""This allows install module purchase_analytic_plans."""),
+ help ="""Allows the user to maintain several analysis plans. These let you split lines on a purchase order between several accounts and analytic plans.
+ This installs the module purchase_analytic_plans."""),
'group_analytic_account_for_purchases': fields.boolean('Analytic accounting for purchases',
implied_group='purchase.group_analytic_accounting',
help="Allows you to specify an analytic account on purchase orders."),
diff --git a/addons/purchase/res_config_view.xml b/addons/purchase/res_config_view.xml
index 6453752a638..f659d7b437f 100644
--- a/addons/purchase/res_config_view.xml
+++ b/addons/purchase/res_config_view.xml
@@ -74,6 +74,10 @@
+
+
+
+