Merge lp:~openerp-dev/openobject-addons/7.0-opw-587368-han into lp:openobject-addons/7.0

Proposed by Hardik Ansodariya (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 9003
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-587368-han
Merge into: lp:openobject-addons/7.0
Diff against target: 21 lines (+4/-2)
1 file modified
stock/stock.py (+4/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-587368-han
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Review via email: mp+161546@code.launchpad.net

Description of the change

Fixed the issue of forcing delivery generated purchase order was validated by Admin only.

Steps to reproduce :

login : demo - demo
create sales order for customer agrolait
product : ADPT 20 PCS
Procurement method : ** ON ORDER **
Confirm Sale
View Delivery order
** Force Availability **
Deliver
----------------------------------------------------
Scheduler RUNS
---------------------------------------------------
Goto the purchase > Quotations
Confirm the Quotation

You get this warning ->

Operation forbidden !

Quantities, Units of Measure, Products and Locations cannot be modified on stock moves that have already been processed (except by the Administrator).

Now it will be validated by "Stock Manager" only.

With reference of maintenance case: 587368.

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve

Unmerged revisions

9003. By Hardik Ansodariya (OpenERP)

[FIX] stock: when forcing delivery generated purchase order was only able to validated by admin user but not it will only validated by stock manager(Maintenance case: 587368)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2013-04-25 12:49:33 +0000
3+++ stock/stock.py 2013-04-30 05:24:28 +0000
4@@ -1767,13 +1767,15 @@
5 def write(self, cr, uid, ids, vals, context=None):
6 if isinstance(ids, (int, long)):
7 ids = [ids]
8- if uid != 1:
9+ data, data_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'group_stock_manager')
10+ group_id_current_uid = self.pool.get('res.users').search(cr, uid, [('groups_id', '=', data_id)], context=context)
11+ if uid not in group_id_current_uid:
12 frozen_fields = set(['product_qty', 'product_uom', 'product_uos_qty', 'product_uos', 'location_id', 'location_dest_id', 'product_id'])
13 for move in self.browse(cr, uid, ids, context=context):
14 if move.state == 'done':
15 if frozen_fields.intersection(vals):
16 raise osv.except_osv(_('Operation forbidden !'),
17- _('Quantities, Units of Measure, Products and Locations cannot be modified on stock moves that have already been processed (except by the Administrator).'))
18+ _('Quantities, Units of Measure, Products and Locations cannot be modified on stock moves %s that have already been processed(except by the Stock Manager).') %(move.picking_id.name))
19 return super(stock_move, self).write(cr, uid, ids, vals, context=context)
20
21 def copy(self, cr, uid, id, default=None, context=None):