Merge lp:~halls/openobject-addons/5.0-lp572428-validate-stock-ac-moves into lp:openobject-addons/5.0

Proposed by Chris Halls
Status: Rejected
Rejected by: Jay Vora (Serpent Consulting Services)
Proposed branch: lp:~halls/openobject-addons/5.0-lp572428-validate-stock-ac-moves
Merge into: lp:openobject-addons/5.0
Diff against target: 27 lines (+4/-1)
1 file modified
stock/stock.py (+4/-1)
To merge this branch: bzr merge lp:~halls/openobject-addons/5.0-lp572428-validate-stock-ac-moves
Reviewer Review Type Date Requested Status
Jay Vora (Serpent Consulting Services) Pending
OpenERP Core Team Pending
Review via email: mp+24507@code.launchpad.net

Description of the change

Fix bug 572428: account moves from stock pickings ignore journal's Skip Draft State

I'm proposing this because it changes the behaviour to make the created moves respect the journal's flag. The help message implies this is what should happen, and it looks like it was simply an oversight due to the way the routine is programmed and the behaviour is not deliberate.

To post a comment you must log in.
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Your analysis and fix look good to me, but seeing that Jay has worked on a similar case recently I asked him to review it as well before merging it.
Wouldn't hurt to use an explicit 'move_id' instead of 'mid' in the code BTW ;-)

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

Hi Chris Halls,

It has been fixed in generic manner in the https://bugs.launchpad.net/openobject-addons/+bug/551522

Let us know if there is still an issue.

Thanks.

Unmerged revisions

2734. By Chris Halls

[FIX] stock: Validate accounting move if journal is set to skip draft state

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock.py'
2--- stock/stock.py 2010-04-28 07:49:49 +0000
3+++ stock/stock.py 2010-04-30 16:08:55 +0000
4@@ -1303,6 +1303,7 @@
5 (move.product_id.categ_id.name,
6 move.product_id.categ_id.id,))
7 journal_id = move.product_id.categ_id.property_stock_journal.id
8+ do_validate = move.product_id.categ_id.property_stock_journal.entry_posted
9 if acc_src != acc_dest:
10 ref = move.picking_id and move.picking_id.name or False
11 product_uom_obj = self.pool.get('product.uom')
12@@ -1337,12 +1338,14 @@
13 'date': date,
14 'partner_id': partner_id})
15 ]
16- self.pool.get('account.move').create(cr, uid, {
17+ mid = self.pool.get('account.move').create(cr, uid, {
18 'name': move.name,
19 'journal_id': journal_id,
20 'line_id': lines,
21 'ref': ref,
22 })
23+ if mid and do_validate:
24+ self.pool.get('account.move').button_validate(cr, uid, [mid], context)
25 self.write(cr, uid, ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')})
26 wf_service = netsvc.LocalService("workflow")
27 for id in ids: