Cannot pick products with real time stock valuation enabled

Bug #1076363 reported by D Verhelst
36
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 3

Bug Description

I have set up a new nightly 6.2dev-20121106-000101 , and installed bare minimum modules :
- accounting , belgium
- purchase
- warehouse

I define a new product, category: all products , valuation: real-time, fill out required fields :
stock input account (new account)
stock output account (new account)
stock valuation account (new account)

when I create a PO and try to receive goods I get a key error on period id output:
File "/opt/openerp/server/openerp/addons/stock/wizard/stock_partial_picking.py", line 213, in do_partial
    stock_picking.do_partial(cr, uid, [partial.picking_id.id], partial_data, context=context)
  File "/opt/openerp/server/openerp/addons/stock/stock.py", line 1361, in do_partial
    self.action_move(cr, uid, [pick.id])
  File "/opt/openerp/server/openerp/addons/stock/stock.py", line 906, in action_move
    context=context)
  File "/opt/openerp/server/openerp/addons/stock/stock.py", line 2445, in action_done
    self._create_product_valuation_moves(cr, uid, move, context=context)
  File "/opt/openerp/server/openerp/addons/stock/stock.py", line 2407, in _create_product_valuation_moves
    'ref': move.picking_id and move.picking_id.name})
  File "/opt/openerp/server/openerp/addons/account/account.py", line 1434, in create
    c['period_id'] = vals['period_id']
KeyError: 'period_id'

Related branches

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

You can try to fix by following code.

 c['period_id'] = vals.get('period_id')

This will help.

Thanks!

Revision history for this message
D Verhelst (dimitriverhelst) wrote :

Hi Amit,

tried your update, and also updated other two fields:

        if 'line_id' in vals:
            c = context.copy()
            c['novalidate'] = True
            c['period_id'] = vals.get('period_id')
            c['journal_id'] = vals.get('journal_id')
            c['date'] = vals.get('date')
            result = super(account_move, self).create(cr, uid, vals, c)
            self.validate(cr, uid, [result], context)
        else:
            result = super(account_move, self).create(cr, uid, vals, context)
        return result

now I get a much cleaner warning:

Error!
No period found or more than one period found for the given date.

however, I do have exactly one period open for the given date...

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

See the better producible steps on lp:1079070

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Michael Telahun Makonnen (mmakonnen) wrote :

I have a fix for this in my branch, which I have submitted a merge proposal for: https://code.launchpad.net/~mmakonnen/openobject-addons/openobject-addons/+merge/135702

Patch is also attached.

Revision history for this message
Michael Telahun Makonnen (mmakonnen) wrote :

I think this can be closed now. The fix was merged in rev. 8181

Revision history for this message
Serpent Consulting Services (serpent-consulting-services) wrote :
Changed in openobject-addons:
status: Confirmed → Fix Committed
status: Fix Committed → Fix Released
milestone: none → 7.0
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.