Merge lp:~openerp-commiter/openobject-addons/trunk-company-currency-accounting-option-wizard-pna into lp:~openerp-dev/openobject-addons/trunk-company-currency

Proposed by Pinakin Nayi (OpenERP)
Status: Merged
Merged at revision: 7053
Proposed branch: lp:~openerp-commiter/openobject-addons/trunk-company-currency-accounting-option-wizard-pna
Merge into: lp:~openerp-dev/openobject-addons/trunk-company-currency
Diff against target: 53 lines (+24/-1)
2 files modified
account/account.py (+22/-0)
account/account_view.xml (+2/-1)
To merge this branch: bzr merge lp:~openerp-commiter/openobject-addons/trunk-company-currency-accounting-option-wizard-pna
Reviewer Review Type Date Requested Status
Priyesh (OpenERP) Pending
Review via email: mp+116194@code.launchpad.net

Description of the change

Hello,

  I improved Accounting Options wizard and add the options on to select currency.

Thanks,
pna

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account.py'
2--- account/account.py 2012-07-18 16:08:28 +0000
3+++ account/account.py 2012-07-23 06:14:56 +0000
4@@ -2991,6 +2991,7 @@
5
6 _columns = {
7 'company_id':fields.many2one('res.company', 'Company', required=True),
8+ 'currency_id': fields.many2one('res.currency', 'Currency', help="Currency as per company's country."),
9 'only_one_chart_template': fields.boolean('Only One Chart Template Available'),
10 'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', required=True),
11 'bank_accounts_id': fields.one2many('account.bank.accounts.wizard', 'bank_account_id', 'Cash and Banks', required=True),
12@@ -3001,6 +3002,27 @@
13 'purchase_tax_rate': fields.float('Purchase Tax(%)'),
14 'complete_tax_set': fields.boolean('Complete Set of Taxes', help='This boolean helps you to choose if you want to propose to the user to encode the sales and purchase rates or use the usual m2o fields. This last choice assumes that the set of tax defined for the chosen template is complete'),
15 }
16+ def _default_company(self, cr, uid, context=None):
17+ user_company = self.pool.get('res.users').browse(cr, uid, [uid], context=context)[0].company_id.id
18+ return user_company or False
19+
20+ def _default_currency(self, cr, uid, context=None):
21+ company_id=self._default_company(cr, uid, context=context)
22+ currency= self.pool.get('res.company').browse(cr, uid, company_id, context=context)
23+ return currency.currency_id and currency.currency_id.id or False
24+
25+ _defaults = {
26+ 'company_id': _default_company,
27+ 'currency_id':_default_currency,
28+ }
29+
30+ def onchange_company_id(self, cr, uid, ids, company_id):
31+ if company_id:
32+ company = self.pool.get('res.company').browse(cr, uid, company_id)
33+ return {'value':{'currency_id':company.currency_id and company.currency_id.id}}
34+ else :
35+ return False
36+
37 def onchange_tax_rate(self, cr, uid, ids, rate=False, context=None):
38 return {'value': {'purchase_tax_rate': rate or False}}
39
40
41=== modified file 'account/account_view.xml'
42--- account/account_view.xml 2012-07-18 14:28:10 +0000
43+++ account/account_view.xml 2012-07-23 06:14:56 +0000
44@@ -2409,7 +2409,8 @@
45 <field name="complete_tax_set" invisible="1"/>
46 <div groups="base.group_multi_company">
47 <label for="company_id"/>
48- <field name="company_id" widget="selection"/> <!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
49+ <field name="company_id" widget="selection" on_change="onchange_company_id(company_id)"/> <!-- we assume that this wizard will be run only by administrators and as this field may cause problem if hidden (because of the default company of the user removed from the selection because already configured), we simply choosed to remove the group "multi company" of it -->
50+ <field name="currency_id" />
51 </div>
52 <group>
53 <div attrs="{'invisible': [('only_one_chart_template','=',True)]}">

Subscribers

People subscribed via source and target branches