diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index dab5cfd1406..e8e027f9c23 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -834,17 +834,18 @@ class account_statement_operation_template(osv.osv):
_description = "Preset for the lines that can be created in a bank statement reconciliation"
_columns = {
'name': fields.char('Button Label', required=True),
- 'account_id': fields.many2one('account.account', 'Account', ondelete='cascade', domain=[('type','!=','view')]),
- 'label': fields.char('Label'),
- 'amount_type': fields.selection([('fixed', 'Fixed'),('percentage_of_total','Percentage of total amount'),('percentage_of_balance', 'Percentage of open balance')],
- 'Amount type', required=True),
- 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account'), help="The amount will count as a debit if it is negative, as a credit if it is positive (except if amount type is 'Percentage of open balance').", required=True),
- 'tax_id': fields.many2one('account.tax', 'Tax', ondelete='cascade'),
- 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', ondelete='cascade'),
+ 'account_id': fields.many2one('account.account', 'Account', ondelete='cascade', domain=[('type','not in',('view','closed','consolidation'))]),
+ 'label': fields.char('Journal Item Label'),
+ 'amount_type': fields.selection([('fixed', 'Fixed'),('percentage_of_total','Percentage of total amount'),('percentage_of_balance', 'Percentage of open balance')], 'Amount type', required=True),
+ 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account'), required=True, help="The amount will count as a debit if it is negative, as a credit if it is positive (except if amount type is 'Percentage of open balance')."),
+ 'tax_id': fields.many2one('account.tax', 'Tax', ondelete='restrict', domain=[('type_tax_use','in',('purchase','all')), ('parent_id','=',False)]),
+ 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', ondelete='set null', domain=[('type','!=','view'), ('state','not in',('close','cancelled'))]),
+ 'company_id': fields.many2one('res.company', 'Company', required=True),
}
_defaults = {
'amount_type': 'percentage_of_balance',
- 'amount': 100.0
+ 'amount': 100.0,
+ 'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 3a766a0d781..6215103bba7 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -700,9 +700,9 @@
-
+
-
+
@@ -711,7 +711,8 @@
-
+
+
diff --git a/addons/account/security/account_security.xml b/addons/account/security/account_security.xml
index 7b39dcf5a7f..058c6b2bb85 100644
--- a/addons/account/security/account_security.xml
+++ b/addons/account/security/account_security.xml
@@ -167,5 +167,12 @@
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
+ Account statement operation template company rule
+
+
+ ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
+
+
diff --git a/addons/account/static/src/js/account_widgets.js b/addons/account/static/src/js/account_widgets.js
index 04189e36d7f..edb9ec22d9f 100644
--- a/addons/account/static/src/js/account_widgets.js
+++ b/addons/account/static/src/js/account_widgets.js
@@ -120,6 +120,7 @@ openerp.account = function (instance) {
relation: "account.analytic.account",
string: _t("Analytic Acc."),
type: "many2one",
+ domain: [['type','!=','view'], ['state','not in',['close','cancelled']]],
},
},
};