incoming shipment' move date same as the picking date

Asked by Federico Manuel Echeverri Choux on 2012-09-15

1) When i create a new incoming shiping with other date different today for example 09/01/2012 00:00:00, doesnt work very well.
2) Stock.move has today's date
3) I expected that stock.move has a 09/01/2012 00:00:00.
4) Ubuntu 12.04 LTS
5) Openerp Server 6.1 REV 4261
     Openerp Client 6.1 REV 2085
     Openerp Addons 6.1 REV 6986

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
2012-09-18
Last reply:
2015-05-25
Amit Parik (amit-parik) said : #1

Hello Federico,

I have completely read your issue, But I don't think it's bug because we can't set the stock move date same as a picking date.

First of all picking date comes from the PO date (for incoming shipment) and SO date (for Delivery Order date).

Now about the stock move dates, in stock move there is a two date field one is 'date' which is the move date and it's changed at the system date. Like follow.

First Date (Move Date) is write the system date when shipment is generated. Same as this date override the the time of shipping date on which date when the product will received. Additionally Order date is not required on incoming shipment but the Date field if required on stock move , So we can't take the date from the picking 's order date.

Second date field which is the schedule date which is calculated from the procurement based on supplier lead time company security day. So also we can not take the schedule date as a order date.

So everything working correct now, that's why I am closing this issue.

Correct me If I am wrong.

Thanks for the reporting!

Ok, for expample i do internal Moves, but a try move some product this date
09/04/2012 but when i press Process Now, the date change for 09/18/2012, Is
it Correct??

Greatting

2012/9/17 Federico Manuel Echeverri Choux - Conectel <
<email address hidden>>

> New question #208808 on OpenERP Addons:
> https://answers.launchpad.net/openobject-addons/+question/208808
>
> 1) When i create a new incoming shiping with other date different today
> for example 09/01/2012 00:00:00, doesnt work very well.
> 2) Stock.move has today's date
> 3) I expected that stock.move has a 09/01/2012 00:00:00.
> 4) Ubuntu 12.04 LTS
> 5) Openerp Server 6.1 REV 4261
> Openerp Client 6.1 REV 2085
> Openerp Addons 6.1 REV 6986
>
> --
> You received this question notification because you asked the question.
>

tozm (tozm) said : #3

I'd like to post a question about this...I'm seeing the same problem but I will express in another way:

When receiving inbound shipment, the resulting moves - both stock and accounting - ultimately get dated with current system date, and there doesn't seem to be any way to enter the actual date the shipment was received? (Which IMHO should be the date that gets placed on the moves and the accounting journal entries).

This is clearly absurd, because it means it is not possible to enter historical data and have the accounting records reflect accurately the moves in the correct period.

The incoming shipment record has two dates on screen:
* Order Date ... not sure what this is really supposed to be representing, since it is a separate editable value from the original PO Date.
* Scheduled Date

Ideally, it seems to me that there should be a third date - initially empty - which is filled in with the actual date the goods were received.... and this is the date that should go on the move and accounting journals.

On thee individual move lines there is also a Date and a Schedule Date. The date is editable, but ultimately gets overridden with system date when the goods are 'received'.

I can see a couple of simple solutions to this, but I'd like to at least get agreement that the way it works at the moment is kind of "silly" and makes things unworkable from an accountants point of view. The general accounting parts of openERP allow records to be entered with historical effective dates. Goods in and out should not be an exception.

I'm sure if we go looking on the Sales side we will find the counterpart problem concerning Despatch dates to customers.

Ferdinand (office-chricar) said : #4

OpenERP seems not to believe that other than real-time transactions exists.

obviously if external stock locations without internet connection exists - and we have 2 installations - it is necessary to enter "historical" data for these location to get correct monthly data.

in
https://code.launchpad.net/~c2c/c2c-rd-addons/trunk
there are a lot of modules which are necessary to handle this matter correctly including historical evaluation of stock.

tozm (tozm) said : #5

I don't know that I agree with your opinion about philosophically what OpenERP had intended. Surely this is quite simple.... it does not a whole new module simply to get a different date on the move rather than current date.

I propose that it is either:
(a) A design deficiency, (that seems to me to be easily corrected) - i.e. not possible to enter stock movements from say three months ago and have it accounted for in the correct period; or
(b) It's a simple bug... the move date is just being set with the wrong date! i.e. now() instead of the actual move date.... which could be taken from the editable date on the reception record, or even the editable date on the move before it is committed.

On this basis I am going to re-open the bug this is linked to to try and get a sensible position on this.

Hi, Suppose a company the warehouse men captures 2 times weekly the incoming shiping, but he need to put the real date where the product incoming at warehouse. How to?

Lorenzo Battistini (elbati) said : #7
Ray Carnes (rcarnes) said : #8

This patch was provided by Odoo to us when we reported something similar:

diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 93f3bf1..683e3d7 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -883,7 +883,15 @@ class stock_picking(osv.osv):
         This method is called at the end of the workflow by the activity "done".
         @return: True
         """
- self.write(cr, uid, ids, {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')})
+
+ # correctly preserver any historic processing date the user enters for the picking
+ for picking in self.browse(cr, uid, ids, context=context):
+ values = {
+ 'state': 'done'
+ }
+ if not picking.date_done:
+ values['date_done'] = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+ self.write(cr, uid, ids, values, context=context)
         return True

     def action_move(self, cr, uid, ids, context=None):
@@ -1802,6 +1810,21 @@ class stock_move(osv.osv):
                     if frozen_fields.intersection(vals):
                         raise osv.except_osv(_('Operation Forbidden!'),
                                              _('Quantities, Units of Measure, Products and Locations cannot be modified on stock moves that have already been processed (except by the Stock Manager).'))
+
+ #ensure stock moves are created with the same date as their pickings if any
+ for move in self.browse(cr, uid, ids, context=context):
+ if move.picking_id:
+ picking_in_obj = self.pool.get('stock.picking.in')
+ picking = picking_in_obj.browse(cr, uid, move.picking_id.id, context=context)
+ if picking.date_done:
+ vals['date'] = picking.date_done
+ logging.warning('new date about to be set is %s',picking.date_done)
+ picking_out_obj = self.pool.get('stock.picking.out')
+ picking = picking_out_obj.browse(cr, uid, move.picking_id.id, context=context)
+ if picking.date_done:
+ vals['date'] = picking.date_done
+ logging.warning('new date about to be set is %s',picking.date_done)
+
         return super(stock_move, self).write(cr, uid, ids, vals, context=context)

     def copy_data(self, cr, uid, id, default=None, context=None):
@@ -2379,12 +2402,23 @@ class stock_move(osv.osv):
                 else:
                     account_moves += [(journal_id, self._create_account_move_line(cr, uid, move, acc_src, acc_valuation, reference_amount, reference_currency_id, context))]

+ #find the period related to the current date of the stock move
+ ctx = dict(context or {})
+ ctx.update({'dt': move.date})
+ period_id = self.pool.get('account.period').find(cr, uid, move.date, context=ctx)
+
+
             move_obj = self.pool.get('account.move')
             for j_id, move_lines in account_moves:
                 move_obj.create(cr, uid,
                         {
                          'journal_id': j_id,
                          'line_id': move_lines,
+
+ # specify the temporal information for stock moves
+ 'date': move.date,
+ 'period_id': period_id[0],
+
                          'ref': move.picking_id and move.picking_id.name}, context=context)

     def action_done(self, cr, uid, ids, context=None):

Can you help with this problem?

Provide an answer of your own, or ask Federico Manuel Echeverri Choux for more information if necessary.

To post a message you must log in.