From 753855c3408f194e0d2c5c20772e99e244d23db2 Mon Sep 17 00:00:00 2001
From: "ron@tinyerp.com" <>
Date: Tue, 30 Aug 2011 10:59:01 +0530
Subject: [PATCH] [ADD]: account: l10n fullness and inheritancy : 1)Added
chart_template_id field in account.account.template, 2)Overwrited search
method for chart_template only access the Accounts belongs to related
chart_template or False
bzr revid: ron@tinyerp.com-20110830052901-abjkwtgh2siams14
---
addons/account/account.py | 11 +++++++++++
addons/account/account_view.xml | 19 ++++++++++---------
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/addons/account/account.py b/addons/account/account.py
index b134c6aa5dc..9fc51f65701 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -2340,6 +2340,7 @@ class account_account_template(osv.osv):
'child_parent_ids':fields.one2many('account.account.template', 'parent_id', 'Children'),
'tax_ids': fields.many2many('account.tax.template', 'account_account_template_tax_rel', 'account_id', 'tax_id', 'Default Taxes'),
'nocreate': fields.boolean('Optional create', help="If checked, the new chart of accounts will not contain this by default."),
+ 'chart_template_id': fields.many2one('account.chart.template', 'Chart Template'),
}
_defaults = {
@@ -2376,6 +2377,16 @@ class account_account_template(osv.osv):
res.append((record['id'],name ))
return res
+
+ def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
+ if context is None:
+ context = {}
+ if context.get("coa_template"):
+ args += ['|',('chart_template_id', '=', context.get("coa_template")),('chart_template_id', '=', False)]
+ return super(account_account_template, self).search(cr, uid, args, offset, limit,
+ order, context=context, count=count)
+
+
def generate_account(self, cr, uid, account_root_id, tax_template_ref, code_digits, company_id, context=None):
"""
This method for generating accounts from templates.
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index afef9585579..ebca360884b 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -2064,6 +2064,7 @@
+
@@ -2135,7 +2136,7 @@
-
+
@@ -2145,14 +2146,14 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+