credativ team mailing list archive
-
credativ team
-
Mailing list archive
-
Message #06146
[Branch ~credativ/openobject-addons/6.1] Rev 7074: [FIX] Correct validation and posting logic
------------------------------------------------------------
revno: 7074
committer: Jacob Hicks <jacob.hicks@xxxxxxxxxxxxxx>
branch nick: addons
timestamp: Mon 2015-07-13 16:00:30 +0100
message:
[FIX] Correct validation and posting logic
modified:
account/account_invoice.py
--
lp:~credativ/openobject-addons/6.1
https://code.launchpad.net/~credativ/openobject-addons/6.1
Your team credativ is subscribed to branch lp:~credativ/openobject-addons/6.1.
To unsubscribe from this branch go to https://code.launchpad.net/~credativ/openobject-addons/6.1/+edit-subscription
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2015-07-13 12:22:45 +0000
+++ account/account_invoice.py 2015-07-13 15:00:30 +0000
@@ -952,9 +952,13 @@
i[2]['period_id'] = period_id
# Call create method without validation, and then validate once for whole move
+ # using same logic as in account_move_line.create()
ctx.update({'novalidate': True})
move_id = move_obj.create(cr, uid, move, context=ctx)
- move_obj.button_validate(cr,uid, [move_id], context=ctx)
+ if not ctx.get('no_store_function') or journal.entry_posted:
+ tmp = move_obj.validate(cr,uid, [move_id], context=ctx)
+ if journal.entry_posted and tmp:
+ move_obj.button_validate(cr,uid, [move_id], context=ctx)
new_move_name = move_obj.browse(cr, uid, move_id, context=ctx).name
# make the invoice point to that move