Merge lp:~openerp-dev/openobject-addons/7.0-opw-600550_601711-ado into lp:openobject-addons/7.0

Proposed by Amit Dodiya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/7.0-opw-600550_601711-ado
Merge into: lp:openobject-addons/7.0
Diff against target: 43 lines (+33/-0)
1 file modified
purchase/stock.py (+33/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/7.0-opw-600550_601711-ado
Reviewer Review Type Date Requested Status
Andres Calle (TRESCLOUD) (community) it seems working, should be merged Needs Resubmitting
Martin Trigaux (OpenERP) Pending
Naresh(OpenERP) Pending
Review via email: mp+197818@code.launchpad.net

Description of the change

Hello,

[FIX] stock_return_picking: while returning incoming shipment with average type product the product price is not updated according to return quantity

Steps:
1). Create a new product with following configuration:
- costing method = average price,inventory valuation = realtime
- cost price = 0,quantity on hand = 0,quantity avaialable = 0
2). create purchase order with quantity = 10, price_unit = 10, confirm and receive incoming shipment
3). create another purchase order with quantity = 10, price_unit = 20, confirm and receive incoming shipment
now product has cost price = 15
4). now return incoming shipment of first purchase order(which has price_unit = 10) and receive the return picking
You will find the cost price remain at 15, it should change to 20.

Propose branch will fix the issue.

Regards,
Amit Dodiya

To post a comment you must log in.
9676. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9677. By Denis Ledoux (OpenERP)

[FIX] sale_stock,stock: change model to stock.picking.out of deliveries to invoice view in sales

Deliveries to invoice in sales menu should display delivery order only (no incoming shipment). This was already the case thanks to the domain [('type','=','out')], but since the refactor of the module stock, and the division of stock.picking to stock.picking.in and stock.picking.out, the model of this view should be stock.picking.out instead of stock.picking (for instance, to get the actions binding (ir.values) of stock.picking.out model).
+ typo fix in action binding

9678. By Denis Ledoux (OpenERP)

[FIX] purchase: warning uom category different only if the changed field is product_uom itself.

Changing product_id with a different unit category does not trigger the uom category change warning

9679. By Martin Trigaux (OpenERP)

[MERGE] [FIX] account: performance improvement on account.analytic.lines
don't create new analytic lines at move creation, will do it once the move is balanced
don't remove analytic lines (to avoid duplicates) at the begining of the validation of a move, will do it once we create the new correct analytic lines (opw 597719)

9680. By Martin Trigaux (OpenERP)

[FIX] account: correct name_search on account to be validated even at negation
added test checking every combinaison of name_search

9681. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9682. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9683. By Thibault Delavallée (OpenERP)

[MERGE] [FIX] mail: fixed message_follower_ids function field.

The set method of the field, set_followers, is now using message_subscribe and message_unsubscribe to have only one access point to adding or removing followers. Previously to this fix it was directly creating entries in the mail_followers table, neglecting the calculation of subtypes and default subtypes.

9684. By Denis Ledoux (OpenERP)

[FIX] point_of_sale: ignore TOTAlY returns

Returns were partially ignored when typing keystrokes, thanks to a return; when event which equaled 13, but the default behaviour (press on the focused input/button) was not prevented. This is now the case thanks to preventDefault. For instance, just after a discount set, the focused input was pressed and the associated value was added when scanning a new product with the scanner. Therefore, if we entered a discount of 30%, scanning a new product added '0', the last pushed button, to the discount, and then added the product.

9685. By Xavier ALT

[FIX] crm: use email widget for email_from field in Opportunities form view

9686. By Denis Ledoux (OpenERP)

[FIX] stock: incoming shipment supplier quick create was creating a customer instead of a supplier

9687. By Denis Ledoux (OpenERP)

[FIX] purchase: set readonly on warehouse_id related field in stock.picking.in

9688. By Christophe Simonis (OpenERP)

[MERGE] annoucement bar

9689. By Denis Ledoux (OpenERP)

[FIX] point_of_sale: fix default destination(or source, for returns) location for pos order moves

For instance, the source location of moves of returned products was output instead of partners locations / customers

9690. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9691. By Denis Ledoux (OpenERP)

[FIX] mrp: cost structure report, do not display twice main supplier

9692. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9693. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9694. By Launchpad Translations on behalf of openerp

Launchpad automatic translations update.

9695. By Amit Dodiya (OpenERP)

[FIX] return picking from purchase: while returning incoming shipment with average type product the product price is not updated according to return quantity

Revision history for this message
Andres Calle (TRESCLOUD) (andres-calle) wrote :

Dear Martin, Naresh,

I've tested the patch and seems working, I would like to see it merged, any way I can help?

The average cost in product returns is properly calculated and is a critical requirement of a warehouse system.

BR

Andrés Calle
TRESCLOUD

review: Needs Resubmitting (it seems working, should be merged)

Unmerged revisions

9695. By Amit Dodiya (OpenERP)

[FIX] return picking from purchase: while returning incoming shipment with average type product the product price is not updated according to return quantity

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'purchase/stock.py'
2--- purchase/stock.py 2013-12-10 16:56:27 +0000
3+++ purchase/stock.py 2013-12-16 06:49:30 +0000
4@@ -44,6 +44,39 @@
5 _defaults = {
6 'purchase_id': False,
7 }
8+
9+ def do_partial(self, cr, uid, ids, partial_datas, context=None):
10+ product_obj = self.pool.get('product.product')
11+ currency_obj = self.pool.get('res.currency')
12+ uom_obj = self.pool.get('product.uom')
13+ for pick in self.browse(cr, uid, ids, context=context):
14+ for move in pick.move_lines:
15+ if (pick.type == 'out' and pick.purchase_id) and (move.product_id.cost_method == 'average'):
16+ if move.state in ('done', 'cancel'):
17+ continue
18+ partial_data = partial_datas.get('move%s'%(move.id), False)
19+ product = product_obj.browse(cr, uid, move.product_id.id)
20+ context['currency_id'] = move.company_id.currency_id.id
21+ product_qty = partial_data.get('product_qty',0.0)
22+ product_uom = partial_data.get('product_uom',False)
23+ product_currency = partial_data.get('product_currency',False)
24+ product_price = partial_data.get('product_price',0.0)
25+ move_currency_id = move.company_id.currency_id.id
26+ prod_available = product.qty_available
27+ qty = uom_obj._compute_qty(cr, uid, product_uom, product_qty, product.uom_id.id)
28+ new_price = currency_obj.compute(cr, uid, product_currency,
29+ move_currency_id, product_price, round=False)
30+ new_price = uom_obj._compute_price(cr, uid, product_uom, new_price,
31+ product.uom_id.id)
32+ if qty > 0 and qty != prod_available:
33+ new_price = move.price_unit
34+ if prod_available <= 0:
35+ new_std_price = new_price
36+ else:
37+ old_price = product.price_get('standard_price', context=context)[product.id]
38+ new_std_price = ((old_price * prod_available) - (new_price * qty))/(prod_available - qty)
39+ product_obj.write(cr, uid, [product.id],{'standard_price': new_std_price})
40+ return super(stock_picking, self).do_partial(cr, uid, ids, partial_datas, context=context)
41
42 def _get_partner_to_invoice(self, cr, uid, picking, context=None):
43 """ Inherit the original function of the 'stock' module