Merge lp:~openerp-dev/openobject-addons/6.0-opw-575526-pso into lp:openobject-addons/6.0

Proposed by Priyesh (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-575526-pso
Merge into: lp:openobject-addons/6.0
Diff against target: 30 lines (+12/-2)
1 file modified
stock/wizard/stock_return_picking.py (+12/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-575526-pso
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Pending
Review via email: mp+109149@code.launchpad.net

Description of the change

Hello,

To reproduced the issue, here are the steps:

- Create a new product:
Stockable / Make to order / Buy
Check the boxes for the incoming and the outgoing traceability (Track Incoming/Outcoming Lots)

- Create a Sale Order for x PRODUCT
- Run the scheduler
- Confirm the Request for Quotation
- Receive the product
- Process the reception
- Create a new production lot
- Process the internal move (toward this new lot)
- Deliver the product (from this lot) -> State: done
- Click on Return Products

-> Window with the error message

kindly review the branch and let me know your inputs on it.

Regards,
Priyesh

To post a comment you must log in.
5253. By Priyesh (OpenERP)

[FIX] stock: Raised warning message if return qty > available qty(case:575526)

Unmerged revisions

5253. By Priyesh (OpenERP)

[FIX] stock: Raised warning message if return qty > available qty(case:575526)

5252. By Xavier ALT

[FIX] stock: Added condition to check locations for removing warning message coming on returning outgoing moves(case:575526)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/wizard/stock_return_picking.py'
2--- stock/wizard/stock_return_picking.py 2011-01-18 13:41:41 +0000
3+++ stock/wizard/stock_return_picking.py 2012-06-11 06:38:21 +0000
4@@ -81,7 +81,12 @@
5 if m.state == 'done':
6 return_history[m.id] = 0
7 for rec in m.move_history_ids2:
8- return_history[m.id] += (rec.product_qty * rec.product_uom.factor)
9+ # only take into account 'product return' stock move
10+ # (i.e move with exact opposite of ours:
11+ # (location, dest location) = (dest location, location))
12+ if rec.location_dest_id.id == m.location_id.id \
13+ and rec.location_id.id == m.location_dest_id.id:
14+ return_history[m.id] += (rec.product_qty * rec.product_uom.factor)
15 if m.product_qty * m.product_uom.factor >= return_history[m.id]:
16 valid_lines += 1
17 if 'return%s'%(m.id) not in self._columns:
18@@ -172,7 +177,12 @@
19 if move.state=='done':
20 new_qty = data['return%s' % move.id]
21 returned_qty = move.product_qty
22-
23+ if new_qty > returned_qty:
24+ precision = self.pool.get('decimal.precision').precision_get(cr, uid, 'Product UoM')
25+ raise osv.except_osv(_('Returning Error'),
26+ _('Returning quantity %.*f for %s is larger than the available quantity %.*f!')\
27+ % (precision, new_qty, move.product_id.name, precision, returned_qty))
28+
29 for rec in move.move_history_ids2:
30 returned_qty -= rec.product_qty
31