Delay in stock location path defined on a product does not work

Bug #512991 reported by TeMPO
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Invalid
Undecided
Unassigned

Bug Description

With the stock location module you can define a location path on a product
Lets say that product A has a location path hat moves automatically the product
from stock to stock 2 with a delay of 10 days
When the product is bought, a stock movement is created from Suppliers to Stock2
but the date does not take the 10 days delay in account.

If you make the same configuration on the stock zones (assuming that all products) should
be moved automatically from stock t stock2 withing 10 days the created move is OK
(the 10 days specified in the zone definition is taken in account)

Maurice

Revision history for this message
TeMPO (info-tempo-consulting) wrote :

I forgot to say I'm using 5.0 stable rev 2552

Revision history for this message
mihi (mihi-163) wrote :

yes i met this problem!

Changed in openobject-addons:
assignee: nobody → mihi (mihi-163)
assignee: mihi (mihi-163) → nobody
Revision history for this message
mihi (mihi-163) wrote :

i have resolved this bug.
because the chained is excuted when the stock.move'state is confirmed.
but the purchase order created the stock.move'state is assigned.So it miss creation of stock.move by the location chain .
the code:
from osv import fields
from osv import osv
import time
import netsvc

import ir
from mx import DateTime
import pooler
from tools import config
from tools.translate import _

#
# Model definition
#
class purchase_order(osv.osv):
    _inherit = 'purchase.order'
    def action_picking_create(self,cr, uid, ids, *args):
        picking_id = False
        for order in self.browse(cr, uid, ids):
            loc_id = order.partner_id.property_stock_supplier.id
            istate = 'none'
            if order.invoice_method=='picking':
                istate = '2binvoiced'
            picking_id = self.pool.get('stock.picking').create(cr, uid, {
                'origin': order.name+((order.origin and (':'+order.origin)) or ''),
                'type': 'in',
                'address_id': order.dest_address_id.id or order.partner_address_id.id,
                'invoice_state': istate,
                'purchase_id': order.id,
            })
            for order_line in order.order_line:
                if not order_line.product_id:
                    continue
                if order_line.product_id.product_tmpl_id.type in ('product', 'consu'):
                    dest = order.location_id.id
                    self.pool.get('stock.move').create(cr, uid, {
                        'name': 'PO:'+order_line.name,
                        'product_id': order_line.product_id.id,
                        'product_qty': order_line.product_qty,
                        'product_uos_qty': order_line.product_qty,
                        'product_uom': order_line.product_uom.id,
                        'product_uos': order_line.product_uom.id,
                        'date_planned': order_line.date_planned,
                        'location_id': loc_id,
                        'location_dest_id': dest,
                        'picking_id': picking_id,
                        'move_dest_id': order_line.move_dest_id.id,
                        'state': 'draft',
                        'purchase_line_id': order_line.id,
                    })
                    if order_line.move_dest_id:
                        self.pool.get('stock.move').write(cr, uid, [order_line.move_dest_id.id], {'location_id':order.location_id.id})
            wf_service = netsvc.LocalService("workflow")
            wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
        return picking_id

purchase_order()

Note: 'state': 'draft',

Changed in openobject-addons:
assignee: nobody → mihi (mihi-163)
status: New → Fix Released
Revision history for this message
Numérigraphe (numerigraphe) wrote :

So was there a bug in the standard code ?
If so, we must have the quality team fix it too - then please mark this bug "new" or "confirmed" or they won't look into your fix.
if not, please mark this bug "invalid".
"Fix released" is when the fix is pushed to the "official" bzr branches - only the quality team can do that.
Lionel

Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello mihi,

Please do not set the status of the bug released.
Thank you for your efforts.
Our team is looking for the relevent solution.

Changed in openobject-addons:
status: Fix Released → Confirmed
Revision history for this message
Jay Vora (Serpent Consulting Services) (jayvora) wrote :

Hello Maurice and Mihi,

The issue is, The destination location of move has to be matched with the source location inside stock paths of Product, and the move type should be 'Automatic No Step Added'.

As far as I understand, this stock_location shifts automatic moves from one location to another.
Example: If Package moves from X to Y for product P and if P has stock locations patch which have source location Y to location Z with 'Automatic No Step Added' option;Product will move from X to Z with the related delay.

Let us know if it is still confusing.
Thanks.

Changed in openobject-addons:
status: Confirmed → Incomplete
Revision history for this message
TeMPO (info-tempo-consulting) wrote :

Dear Jay,

yes this is still confusing.
What I wanted to say is the following

define a product
define a location path from STOCK to STOCK 2 with AUTOMATIC MOVE and delay 10 days

When the product reaches STOCK then a move is automatically created from STOCK to STOCK2 which is nice
but the 10 days delay is not taken in account
So the date for the move is not correct.

Hope this is more clear
Why don't you take in account the correction of mihi ?

regards

Maurice

Revision history for this message
DBR (OpenERP) (dbr-openerp) wrote :

Hello Maurice,

I have checked over all bug specification and test it with the latest code.
Following are the steps which I followed:
1) Create New location "A" With:
    Chain Location Type="Fixed Location"
    Chain Location If Fixed ="B"[In "B" location Chain Location Type="Customer" ]
    Automatic Move ="Automatic Move"
    Chain delay(days) ="10"

After creating PO and defining the particular location "A" as destination, confirm it and see the stock moves date.

For the Stable and trunk both, this works as expected.
So, I am closing this bug.
You can reopen with more information.

Thanks.

Changed in openobject-addons:
assignee: mihi (mihi-163) → nobody
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.