+
From c4fe6c2f58f43a1434f13a538ba8df034e5d8348 Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Mon, 5 Nov 2012 13:53:46 +0100
Subject: [PATCH 05/16] [REM] Removed many2onebutton widget from
account_voucher, now in view_form.js and view_list.js, as standard widget.
bzr revid: vta@openerp.com-20121105125346-v8hgfn157ef0j8fl
---
addons/account/account_view.xml | 4 +-
addons/account_voucher/__openerp__.py | 9 ---
.../account_voucher/account_voucher_view.xml | 4 +-
.../css/account_voucher_reconciliation.css | 0
.../src/js/account_voucher_reconciliation.js | 65 -------------------
.../xml/account_voucher_reconciliation.xml | 15 -----
6 files changed, 4 insertions(+), 93 deletions(-)
delete mode 100644 addons/account_voucher/static/src/css/account_voucher_reconciliation.css
delete mode 100644 addons/account_voucher/static/src/js/account_voucher_reconciliation.js
delete mode 100644 addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 159f2f704a0..e050daec2b1 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1055,7 +1055,7 @@
-
+
account.move.line.tree
account.move.line
@@ -1850,7 +1850,7 @@
-
+
account.subscription.search
account.subscription
diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py
index ac80a7f32b0..c0011c8b3c5 100644
--- a/addons/account_voucher/__openerp__.py
+++ b/addons/account_voucher/__openerp__.py
@@ -60,15 +60,6 @@ This module manages:
'security/account_voucher_security.xml',
'account_voucher_data.xml',
],
- 'js': [
- 'static/src/js/account_voucher_reconciliation.js',
- ],
- 'qweb' : [
- 'static/src/xml/account_voucher_reconciliation.xml',
- ],
- 'css': [
- #'static/src/css/account_voucher_reconciliation.css',
- ],
'test' : [
'test/account_voucher.yml',
'test/sales_receipt.yml',
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index 55a07c5fd99..333cde7638f 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -212,7 +212,7 @@
-
+
@@ -223,7 +223,7 @@
-
+
diff --git a/addons/account_voucher/static/src/css/account_voucher_reconciliation.css b/addons/account_voucher/static/src/css/account_voucher_reconciliation.css
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js b/addons/account_voucher/static/src/js/account_voucher_reconciliation.js
deleted file mode 100644
index 09616a139fb..00000000000
--- a/addons/account_voucher/static/src/js/account_voucher_reconciliation.js
+++ /dev/null
@@ -1,65 +0,0 @@
-openerp.account_voucher = function (instance) {
- var _t = instance.web._t,
- _lt = instance.web._lt;
- var QWeb = instance.web.qweb;
-
- instance.web.account_voucher = {};
-
- instance.web.form.widgets.add('account_voucher_field', 'instance.web.account_voucher.AccountVoucherField');
- instance.web.account_voucher.AccountVoucherField = instance.web.form.AbstractField.extend({
- template: 'FieldAccountVoucher',
- init: function(field_manager, node) {
- this._super.apply(this, arguments);
- var self = this;
- this.set('value', false);
- },
- start: function() {
- this._super.apply(this, arguments);
- var self = this;
- this.string = this.get('value') ? _t('Edit') : _t('Create');
- this.node.attrs.icon = this.get('value') ? '/web/static/src/img/icons/gtk-yes.png' : '/web/static/src/img/icons/gtk-no.png';
- this.$button = $(QWeb.render('WidgetButton', {'widget': this}));
- this.$el.append(this.$button);
- this.$button.on('click', self.on_click);
- },
- on_click: function(ev) {
- var self = this;
- ev.stopPropagation();
- var popup = new instance.web.form.FormOpenPopup(this);
- popup.show_element(
- this.field.relation,
- this.get('value'),
- this.build_context(),
- {title: _t("Voucher: ") + this.string}
- );
- popup.on('create_completed write_completed', self, function(r){
- self.set_value(r);
- });
- },
- set_value: function(value_) {
- var self = this;
- if (value_ instanceof Array) {
- value_ = value_[0];
- }
- value_ = value_ || false;
- this.set('value', value_);
- if (this.is_started) {
- this.render_value();
- }
- },
-
- });
-
- instance.web.list.columns.add('field.account_voucher_field', 'instance.web.list.AccountVoucherField');
- instance.web.list.AccountVoucherField = instance.web.list.Column.extend({
- _format: function (row_data, options) {
- if (row_data.voucher_id.value) {
- this.icon = '/web/static/src/img/icons/gtk-yes.png';
- } else {
- this.icon = '/web/static/src/img/icons/gtk-no.png';
- }
- return QWeb.render('FieldAccountVoucher.cell', {'widget': this});
- },
- });
-
-};
\ No newline at end of file
diff --git a/addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml b/addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml
deleted file mode 100644
index 8ac808920b1..00000000000
--- a/addons/account_voucher/static/src/xml/account_voucher_reconciliation.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
From 01d33d5d063078002a289b045bda483cd2e140f1 Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Tue, 6 Nov 2012 16:36:02 +0100
Subject: [PATCH 06/16] [IMP] Make account.voucher inactive by default, and
only change its state when confirming the corresponding bank statement.
Improved bank statement unlink method, also removing its corresponding
vouchers.
bzr revid: vta@openerp.com-20121106153602-jmtaqkn55o5hxwyv
---
addons/account_voucher/account_voucher.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 8774b717477..8f34fd8a1fc 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -267,6 +267,7 @@ class account_voucher(osv.osv):
_order = "date desc, id desc"
# _rec_name = 'number'
_columns = {
+ 'active':fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the payment term without removing it."),
'type':fields.selection([
('sale','Sale'),
('purchase','Purchase'),
@@ -328,6 +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,
'period_id': _get_period,
'partner_id': _get_partner,
'journal_id':_get_journal,
@@ -1504,6 +1506,15 @@ account_voucher_line()
class account_bank_statement(osv.osv):
_inherit = 'account.bank.statement'
+ def button_confirm_bank(self, cr, uid, ids, context=None):
+ statementLine = self.pool.get('account.bank.statement.line')
+ voucher = self.pool.get('account.voucher')
+ for statement in self.browse(cr, uid, ids, context=context):
+ for line in statement.line_ids:
+ if line.voucher_id:
+ voucher.write(cr, uid, line.voucher_id.id, {'active':True}, context=context)
+ return super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context)
+
def button_cancel(self, cr, uid, ids, context=None):
voucher_obj = self.pool.get('account.voucher')
for st in self.browse(cr, uid, ids, context=context):
@@ -1534,6 +1545,13 @@ class account_bank_statement(osv.osv):
return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context)
+ def unlink(self, cr, uid, ids, context=None):
+ statementLine = self.pool.get('account.bank.statement.line')
+ for statement in self.read(cr, uid, ids, ['line_ids'], context=context):
+ statementLine.unlink(cr, uid, statement['line_ids'], context=context)
+ return super(account_bank_statement, self).unlink(cr, uid, ids, context=context)
+
+
account_bank_statement()
class account_bank_statement_line(osv.osv):
From bee0f20b667ec99041aee43a1d8f91a607c035cc Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Wed, 7 Nov 2012 09:18:27 +0100
Subject: [PATCH 07/16] [IMP] Set the new voucher as inactive.
bzr revid: vta@openerp.com-20121107081827-ncls1h2c5pbjvis3
---
addons/account_voucher/__openerp__.py | 3 +++
addons/account_voucher/account_voucher.py | 2 +-
.../account_voucher/static/src/js/account_voucher.js | 12 ++++++++++++
3 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 addons/account_voucher/static/src/js/account_voucher.js
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
From 0ad71eb405a2ec089904ec3a13db2b02d3e0fe05 Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Wed, 7 Nov 2012 09:45:40 +0100
Subject: [PATCH 08/16] [FIX] Hide open m2o icon.
bzr revid: vta@openerp.com-20121107084540-iahqvnuh4q9tcejo
---
addons/account/account_view.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index e050daec2b1..8441c8dbfc9 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -650,7 +650,7 @@
-
+
From 4d56a3c591f3aa4659d498ef9daae042d288a1ff Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Wed, 7 Nov 2012 16:22:20 +0100
Subject: [PATCH 09/16] [FIX] Remove icon in Import Invoice button, added
Journal Entries button.
bzr revid: vta@openerp.com-20121107152220-20k5s5i37bem6gug
---
addons/account/account_view.xml | 12 ++++++++++++
addons/account_voucher/account_voucher_view.xml | 5 +++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 8441c8dbfc9..7931668d6ef 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -680,6 +680,18 @@
+
+ account.bank.statement.journal.items.form.inherit
+ account.bank.statement
+
+
+
+
+
+
+
Bank Statements
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index 333cde7638f..192c48944d0 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -200,7 +200,7 @@
@@ -212,7 +212,7 @@
-
+
@@ -227,6 +227,7 @@
+
account.cash.statement.voucher.tree.inherit
account.bank.statement
From d9acaadba7948a7b2a210d4fec1dd0279ad87022 Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Thu, 8 Nov 2012 09:59:04 +0100
Subject: [PATCH 10/16] [FIX] Added action to the button.
bzr revid: vta@openerp.com-20121108085904-ktoqdx5eok044g53
---
addons/account/account_view.xml | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 7931668d6ef..a946d04d2ff 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -680,15 +680,25 @@
+
+ Journal Items
+ account.move.line
+ tree
+ tree
+
+ [('statement_id', '=', context.get('active_ids'))]
+
+
account.bank.statement.journal.items.form.inherit
account.bank.statement
-
+ attrs="{'invisible':[('state','!=','confirm')]}"
+ context="{'journal_id':'journal_id'}"/>
From cb7cb1420be0ffbc06fd0ebbbdbfa2a0786b6964 Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Thu, 8 Nov 2012 11:36:34 +0100
Subject: [PATCH 11/16] [FIX] Now the action is type object, method return the
same action in order to have the right context.
bzr revid: vta@openerp.com-20121108103634-acxd3tyzd13b09ck
---
addons/account/account_bank_statement.py | 19 +++++++++++++++++++
addons/account/account_view.xml | 16 +++-------------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 48082451f35..93d9dec21b3 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -486,6 +486,25 @@ class account_bank_statement(osv.osv):
default['move_line_ids'] = []
return super(account_bank_statement, self).copy(cr, uid, id, default, context=context)
+ def button_journal_entries(self, cr, uid, ids, context=None):
+ mod_obj = self.pool.get('ir.model.data')
+ res = mod_obj.get_object_reference(cr, uid, 'account', 'view_move_line_tree')
+ res_id = res and res[1] or False
+ ctx = dict(context)
+ ctx.update({
+ 'active_model': 'account.bank.statement',
+ 'active_id': ids[0],
+ })
+ return {
+ 'view_type':'tree',
+ 'view_mode':'tree',
+ 'res_model':'account.move.line',
+ 'view_id':res_id,
+ 'type':'ir.actions.act_window',
+ 'domain':[('statement_id','=',ctx.get('active_id'))],
+ 'context':ctx,
+ }
+
account_bank_statement()
class account_bank_statement_line(osv.osv):
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index a946d04d2ff..059c96da4a4 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -680,25 +680,15 @@
-
- Journal Items
- account.move.line
- tree
- tree
-
- [('statement_id', '=', context.get('active_ids'))]
-
-
account.bank.statement.journal.items.form.inherit
account.bank.statement
-
+
From 156ba2f21c3793f0357989a9e75bed8f5fd1c382 Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Thu, 8 Nov 2012 12:48:54 +0100
Subject: [PATCH 12/16] [FIX] Fixed method.
bzr revid: vta@openerp.com-20121108114854-36dm65swirji13oq
---
addons/account/account_bank_statement.py | 18 ++++++------------
addons/account/account_view.xml | 3 ---
2 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index 93d9dec21b3..c7b6626c8f2 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -486,22 +486,16 @@ class account_bank_statement(osv.osv):
default['move_line_ids'] = []
return super(account_bank_statement, self).copy(cr, uid, id, default, context=context)
- def button_journal_entries(self, cr, uid, ids, context=None):
- mod_obj = self.pool.get('ir.model.data')
- res = mod_obj.get_object_reference(cr, uid, 'account', 'view_move_line_tree')
- res_id = res and res[1] or False
- ctx = dict(context)
- ctx.update({
- 'active_model': 'account.bank.statement',
- 'active_id': ids[0],
- })
+ def button_journal_entries(self, cr, uid, ids, context=None):
+ ctx = (context or {}).copy()
+ ctx['journal_id'] = self.browse(cr, uid, ids[0], context=context).journal_id.id
return {
- 'view_type':'tree',
+ 'view_type':'form',
'view_mode':'tree',
'res_model':'account.move.line',
- 'view_id':res_id,
+ 'view_id':False,
'type':'ir.actions.act_window',
- 'domain':[('statement_id','=',ctx.get('active_id'))],
+ 'domain':[('statement_id','in',ids)],
'context':ctx,
}
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 059c96da4a4..98df5ddee04 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -671,9 +671,6 @@
-
-
-
From 781c63db9f2ff6e218c72626b8aed3e78609810a Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Thu, 8 Nov 2012 14:16:05 +0100
Subject: [PATCH 13/16] [FIX] Typo.
bzr revid: vta@openerp.com-20121108131605-dmo1rysu4iipki1o
---
addons/account_voucher/voucher_payment_receipt_view.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index 100c657c901..8b6dc693347 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -510,7 +510,6 @@
-
From e93727ab0135a2de14ac4251bfb8490af3685360 Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Thu, 8 Nov 2012 16:43:39 +0100
Subject: [PATCH 14/16] [FIX] Many2OneButton, don't subscribe to write_complete
event.
bzr revid: vta@openerp.com-20121108154339-o5r1wzr08x53g6c4
---
addons/account_voucher/static/src/js/account_voucher.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/account_voucher/static/src/js/account_voucher.js b/addons/account_voucher/static/src/js/account_voucher.js
index 9d38ad252cf..f70ca275d49 100644
--- a/addons/account_voucher/static/src/js/account_voucher.js
+++ b/addons/account_voucher/static/src/js/account_voucher.js
@@ -3,7 +3,7 @@ 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) {
+ this.popup.on('create_completed', self, function(r) {
var voucher = new instance.web.Model('account.voucher');
voucher.call('write', [[r], {'active':false}]);
});
From 87a3464329fa55562d765c79cc006ff1f360f4c6 Mon Sep 17 00:00:00 2001
From: "vta vta@openerp.com" <>
Date: Sat, 10 Nov 2012 19:01:29 +0100
Subject: [PATCH 15/16] [IMP] Added onchange methods in
account_voucher.account_bank_statement_line for parent_id and amount in order
to set the voucher_id to False.
bzr revid: vta@openerp.com-20121110180129-ww29a3ciuo90iop5
---
addons/account_voucher/account_voucher.py | 8 ++++++++
addons/account_voucher/account_voucher_view.xml | 3 +++
2 files changed, 11 insertions(+)
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 061a213d8d0..cf2c25e3e5f 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -1557,6 +1557,14 @@ account_bank_statement()
class account_bank_statement_line(osv.osv):
_inherit = 'account.bank.statement.line'
+ def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
+ res = super(account_bank_statement_line, self).onchange_partner_id(cr, uid, ids, partner_id, context=context)
+ res['value'].update({'voucher_id' : False})
+ return res
+
+ def onchange_amount(self, cr, uid, ids, amount, context=None):
+ return {'value' : {'voucher_id' : False}}
+
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index 0bed5793587..7460feada15 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -225,6 +225,9 @@
+
+ onchange_amount(amount)
+
From ab297a3dadc0d5c47389baa6673e5f9f9e6cb596 Mon Sep 17 00:00:00 2001
From: "Quentin (OpenERP)"
Date: Tue, 13 Nov 2012 13:30:13 +0100
Subject: [PATCH 16/16] [REF] account_voucher: refactoring of new featured
button to create/edit the reconciliations on bank statement line
bzr revid: qdp-launchpad@openerp.com-20121113123013-htxy2ods9rkynt75
---
addons/account_voucher/__openerp__.py | 3 ---
addons/account_voucher/account_voucher.py | 23 ++++++++-----------
.../account_voucher/account_voucher_view.xml | 14 +++--------
.../static/src/js/account_voucher.js | 12 ----------
4 files changed, 12 insertions(+), 40 deletions(-)
delete mode 100644 addons/account_voucher/static/src/js/account_voucher.js
diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py
index 77a76723cdc..927fda19182 100644
--- a/addons/account_voucher/__openerp__.py
+++ b/addons/account_voucher/__openerp__.py
@@ -60,9 +60,6 @@ This module manages:
'security/account_voucher_security.xml',
'account_voucher_data.xml',
],
- 'js': [
- 'static/src/js/account_voucher.js',
- ],
'test' : [
'test/case5_suppl_usd_usd.yml',
'test/account_voucher.yml',
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index bfe6434613b..b0c53b72835 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -267,7 +267,7 @@ class account_voucher(osv.osv):
_order = "date desc, id desc"
# _rec_name = 'number'
_columns = {
- 'active':fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the payment term without removing it."),
+ 'active': fields.boolean('Active', help="By default, reconciliation vouchers made on draft bank statements are set as inactive, which allow to hide the customer/supplier payment while the bank statement isn't confirmed."),
'type':fields.selection([
('sale','Sale'),
('purchase','Purchase'),
@@ -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: True,
+ 'active': True,
'period_id': _get_period,
'partner_id': _get_partner,
'journal_id':_get_journal,
@@ -1510,12 +1510,12 @@ class account_bank_statement(osv.osv):
_inherit = 'account.bank.statement'
def button_confirm_bank(self, cr, uid, ids, context=None):
- statementLine = self.pool.get('account.bank.statement.line')
- voucher = self.pool.get('account.voucher')
+ voucher_obj = self.pool.get('account.voucher')
+ voucher_ids = []
for statement in self.browse(cr, uid, ids, context=context):
- for line in statement.line_ids:
- if line.voucher_id:
- voucher.write(cr, uid, line.voucher_id.id, {'active':True}, context=context)
+ voucher_ids += [line.voucher_id.id for line in statement.line_ids if line.voucher_id]
+ if voucher_ids:
+ voucher_obj.write(cr, uid, voucher_ids, {'active': True}, context=context)
return super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context)
def button_cancel(self, cr, uid, ids, context=None):
@@ -1548,13 +1548,6 @@ class account_bank_statement(osv.osv):
return move_line_obj.write(cr, uid, [x.id for x in v.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line.id, company_currency_id, next_number, context=context)
- def unlink(self, cr, uid, ids, context=None):
- statementLine = self.pool.get('account.bank.statement.line')
- for statement in self.read(cr, uid, ids, ['line_ids'], context=context):
- statementLine.unlink(cr, uid, statement['line_ids'], context=context)
- return super(account_bank_statement, self).unlink(cr, uid, ids, context=context)
-
-
account_bank_statement()
class account_bank_statement_line(osv.osv):
@@ -1562,6 +1555,8 @@ class account_bank_statement_line(osv.osv):
def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
res = super(account_bank_statement_line, self).onchange_partner_id(cr, uid, ids, partner_id, context=context)
+ if 'value' not in res:
+ res['value'] = {}
res['value'].update({'voucher_id' : False})
return res
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index 7460feada15..2cb393f4008 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -206,24 +206,16 @@
-
+
account.bank.statement.voucher.tree.inherit
account.bank.statement
-
+
-
-
-
-
- account.bank.statement.voucher.form.inherit
- account.bank.statement
-
-
-
+
onchange_amount(amount)
diff --git a/addons/account_voucher/static/src/js/account_voucher.js b/addons/account_voucher/static/src/js/account_voucher.js
deleted file mode 100644
index f70ca275d49..00000000000
--- a/addons/account_voucher/static/src/js/account_voucher.js
+++ /dev/null
@@ -1,12 +0,0 @@
-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', self, function(r) {
- var voucher = new instance.web.Model('account.voucher');
- voucher.call('write', [[r], {'active':false}]);
- });
- },
- });
-}
\ No newline at end of file