openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #02460
lp:~openerp-community/openobject-addons/7.0-587621-opw-orphan-voucher into lp:~openerp-dev/openobject-addons/7.0-587621-opw-skh
Niels Huylebroeck has proposed merging lp:~openerp-community/openobject-addons/7.0-587621-opw-orphan-voucher into lp:~openerp-dev/openobject-addons/7.0-587621-opw-skh.
Requested reviews:
Somesh Khare(OpenERP) (skh-openerp)
For more details, see:
https://code.launchpad.net/~openerp-community/openobject-addons/7.0-587621-opw-orphan-voucher/+merge/154932
Instead of simply unhooking any draft vouchers from the bank.statement.line we clean them up when you change the amount of the bank.statement.line.
--
https://code.launchpad.net/~openerp-community/openobject-addons/7.0-587621-opw-orphan-voucher/+merge/154932
Your team OpenERP Community is subscribed to branch lp:~openerp-community/openobject-addons/7.0-587621-opw-orphan-voucher.
=== modified file 'account_voucher/account_voucher.py'
--- account_voucher/account_voucher.py 2013-03-21 13:38:48 +0000
+++ account_voucher/account_voucher.py 2013-03-22 12:20:26 +0000
@@ -1561,6 +1561,14 @@
return res
def onchange_amount(self, cr, uid, ids, amount, context=None):
+ # If the line already has a voucher_id and the state of it is 'draft'
+ # it means this bank statement was cancelled before and we should delete
+ # the voucher AND clear the field voucher_id.
+ if ids:
+ for line in self.browse(cr, uid, ids, context=context):
+ if line.voucher_id and line.voucher_id.state == 'draft':
+ # Instead of orphaning this draft voucher, we will delete it
+ line.voucher_id.unlink()
return {'value' : {'voucher_id' : False}}
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
Follow ups