Rohan Nayani(Open ERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-l10n-control-dev-add-chart_template_id-in-acc-templt-ron
into lp:~openerp-dev/openobject-addons/trunk-l10n-control-dev.
Requested reviews:
Rucha (Open ERP) (rpa-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-l10n-control-dev-add-chart_template_id-in-acc-templt-ron/+merge/73217
Hello,
* Added chart_template_id field in account.account.template
* Overwrited search method for chart_template only access the Accounts
belongs to related chart_template or False
Thanks
RON
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-l10n-control-dev-add-chart_template_id-in-acc-templt-ron/+merge/73217
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-l10n-control-dev.
=== modified file 'account/account.py'
--- account/account.py 2011-08-18 06:01:58 +0000
+++ account/account.py 2011-08-29 10:04:52 +0000
@@ -2340,6 +2340,7 @@
'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 @@
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.
=== modified file 'account/account_view.xml'
--- account/account_view.xml 2011-08-17 20:46:53 +0000
+++ account/account_view.xml 2011-08-29 10:04:52 +0000
@@ -2064,6 +2064,7 @@
<field name="currency_id"/>
<field name="reconcile"/>
+ <field name="chart_template_id"/>
<separator string="Default taxes" colspan="4"/>
<field name="tax_ids" colspan="4" nolabel="1"/>
</page>
@@ -2135,7 +2136,7 @@
<group>
<field name="name"/>
<field name="account_root_id" attrs="{'required': [('parent_id', '=', False)]}"/>
- <field name="bank_account_view_id" attrs="{'required': [('parent_id', '=', False)]}"/>
+ <field name="bank_account_view_id" attrs="{'required': [('parent_id', '=', False)]}" context="{'coa_template': active_id}"/>
<field name="tax_code_root_id" attrs="{'required': [('parent_id', '=', False)]}"/>
<field name="parent_id" />
<field name="code_digits" />
@@ -2145,14 +2146,14 @@
<field name="tax_template_ids" colspan="4" readonly="1" nolabel="1"/>
<separator string="Properties" colspan="4"/>
<group>
- <field name="property_account_receivable" domain="[('id', 'child_of', [account_root_id])]"/>
- <field name="property_account_payable" domain="[('id', 'child_of', [account_root_id])]"/>
- <field name="property_account_expense_categ" domain="[('id', 'child_of', [account_root_id])]"/>
- <field name="property_account_income_categ" domain="[('id', 'child_of', [account_root_id])]" />
- <field name="property_account_expense" domain="[('id', 'child_of', [account_root_id])]"/>
- <field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/>
- <field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]"/>
- <field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]"/>
+ <field name="property_account_receivable" domain="[('id', 'child_of', [account_root_id])]" context="{'coa_template': active_id}"/>
+ <field name="property_account_payable" domain="[('id', 'child_of', [account_root_id])]" context="{'coa_template': active_id}"/>
+ <field name="property_account_expense_categ" domain="[('id', 'child_of', [account_root_id])]" context="{'coa_template': active_id}"/>
+ <field name="property_account_income_categ" domain="[('id', 'child_of', [account_root_id])]" context="{'coa_template': active_id}"/>
+ <field name="property_account_expense" domain="[('id', 'child_of', [account_root_id])]" context="{'coa_template': active_id}"/>
+ <field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]" context="{'coa_template': active_id}"/>
+ <field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]" context="{'coa_template': active_id}"/>
+ <field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]" context="{'coa_template': active_id}"/>
<field name="property_reserve_and_surplus_account" />
</group>
</form>
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp