-
How to Recursively load the template objects and create the real objects in openerp
over 9 years ago
over 9 years ago
To Recursively load the template objects and create the real objects in openerp show detail given below.
1-param company: company the wizard is running for
2-param code_digits: number of digits the accounts code should have in the COA
3-param transfer_account_id: reference to the account template that will be used as intermediary account for transfers between 2 liquidity accounts
4-param obj_wizard: the current wizard for generating the COA from the templates
5-param acc_ref: Mapping between ids of account templates and real accounts created from them
6-param taxes_ref: Mapping between ids of tax templates and real taxes created from them
7-returns: tuple with a dictionary containing
* the mapping between the account template ids and the ids of the real accounts that have been generated from them, as first item,
* a similar dictionary for mapping the tax templates and taxes, as second item.
Use this code given below in .py file in openerp
- def _install_template(self, company, code_digits=None, transfer_account_id=None, obj_wizard=None, acc_ref=None, taxes_ref=None):
- """ Recursively load the template objects and create the real objects from them.
- self.ensure_one()
- if acc_ref is None:
- acc_ref = {}
- if taxes_ref is None:
- taxes_ref = {}
- if self.parent_id:
- tmp1, tmp2 = self.parent_id._install_template(company, code_digits=code_digits, transfer_account_id=transfer_account_id, acc_ref=acc_ref, taxes_ref=taxes_ref)
- acc_ref.update(tmp1)
- taxes_ref.update(tmp2)
- tmp1, tmp2 = self._load_template(company, code_digits=code_digits, transfer_account_id=transfer_account_id, account_ref=acc_ref, taxes_ref=taxes&_ref)
- acc_ref.update(tmp1)
- taxes_ref.update(tmp2)
- return acc_ref, taxes_ref
def _install_template(self, company, code_digits=None, transfer_account_id=None, obj_wizard=None, acc_ref=None, taxes_ref=None): """ Recursively load the template objects and create the real objects from them. self.ensure_one() if acc_ref is None: acc_ref = {} if taxes_ref is None: taxes_ref = {} if self.parent_id: tmp1, tmp2 = self.parent_id._install_template(company, code_digits=code_digits, transfer_account_id=transfer_account_id, acc_ref=acc_ref, taxes_ref=taxes_ref) acc_ref.update(tmp1) taxes_ref.update(tmp2) tmp1, tmp2 = self._load_template(company, code_digits=code_digits, transfer_account_id=transfer_account_id, account_ref=acc_ref, taxes_ref=taxes&_ref) acc_ref.update(tmp1) taxes_ref.update(tmp2) return acc_ref, taxes_ref
Can you help out the community by solving one of the following Automation problems?
Do activity (Answer, Blog) > Earn Rep Points > Improve Rank > Get more opportunities to work and get paid!
For more topics, questions and answers, please visit the Tech Q&A page.
0 Comment(s)