diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py index c0011c8b3c5..85090cd617d 100644 --- a/addons/account_voucher/__openerp__.py +++ b/addons/account_voucher/__openerp__.py @@ -60,6 +60,9 @@ This module manages: 'security/account_voucher_security.xml', 'account_voucher_data.xml', ], + 'js': [ + 'static/src/js/account_voucher.js', + ], 'test' : [ 'test/account_voucher.yml', 'test/sales_receipt.yml', diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 8f34fd8a1fc..85ab06714e7 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -329,7 +329,7 @@ class account_voucher(osv.osv): 'is_multi_currency': fields.boolean('Multi Currency Voucher', help='Fields with internal purpose only that depicts if the voucher is a multi currency one or not'), } _defaults = { - 'active': lambda *a: False, + 'active': lambda *a: True, 'period_id': _get_period, 'partner_id': _get_partner, 'journal_id':_get_journal, diff --git a/addons/account_voucher/static/src/js/account_voucher.js b/addons/account_voucher/static/src/js/account_voucher.js new file mode 100644 index 00000000000..9d38ad252cf --- /dev/null +++ b/addons/account_voucher/static/src/js/account_voucher.js @@ -0,0 +1,12 @@ +openerp.account_voucher = function(instance) { + + instance.web.form.Many2OneButton = instance.web.form.Many2OneButton.extend({ + on_click: function() { + this._super.apply(this, arguments); + this.popup.on('create_completed write_completed', self, function(r) { + var voucher = new instance.web.Model('account.voucher'); + voucher.call('write', [[r], {'active':false}]); + }); + }, + }); +} \ No newline at end of file