Merge lp:~openerp-dev/openobject-addons/7.0-opw-589810-rgo into lp:openobject-addons/7.0

Proposed by Ravi Gohil (OpenERP)
Status: Merged
Approved by: Naresh(OpenERP)
Approved revision: no longer in the source branch.
Merge reported by: Martin Trigaux (OpenERP)
Merged at revision: not available
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-589810-rgo
Merge into: lp:openobject-addons/7.0
Diff against target: 18 lines (+6/-1)
1 file modified
point_of_sale/point_of_sale.py (+6/-1)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-589810-rgo
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Review via email: mp+155987@code.launchpad.net

Description of the change

Hi,

[FIX] point_of_sale: Return products from POS previous session should be linked to current opened session, if not found an active session then raise a warning message. (Maintenance Case: 589810)

For better understanding of this issue, please refer to the issue description of lp:1123575

I've fixed this issue by linking current opened session to the return product order and if there isn't any open session found then an appropriate warning message will be shown.

Kindly review the fix.

Thanks.

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

Hello,

I have merged this but changed a bit the code.
- Done inside the for loop
- Matching on the user instead of the pos (you may refund on another pos but wants the good salesman)
- Set the date to today

Regards

revno: 9393 [merge]
revision-id: <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'point_of_sale/point_of_sale.py'
2--- point_of_sale/point_of_sale.py 2013-03-18 10:53:04 +0000
3+++ point_of_sale/point_of_sale.py 2013-03-28 15:02:25 +0000
4@@ -772,9 +772,14 @@
5 """Create a copy of order for refund order"""
6 clone_list = []
7 line_obj = self.pool.get('pos.order.line')
8- for order in self.browse(cr, uid, ids, context=context):
9+ pos_orders = self.browse(cr, uid, ids, context=context)
10+ current_session = self.pool.get('pos.session').search(cr, uid, [('config_id', '=', pos_orders[0].session_id.config_id.id), ('state', '!=', 'closed')])
11+ if not current_session:
12+ raise osv.except_osv(_('Error!'), _('To return product(s), you need to open a session that belongs to the same "Point of Sale" as of the product(s) to be returned.'))
13+ for order in pos_orders:
14 clone_id = self.copy(cr, uid, order.id, {
15 'name': order.name + ' REFUND',
16+ 'session_id': current_session[0]
17 }, context=context)
18 clone_list.append(clone_id)
19