Merge lp:~openerp-dev/openobject-addons/6.0-opw-381830-han into lp:openobject-addons/6.0

Proposed by Hardik Ansodariya (OpenERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/6.0-opw-381830-han
Merge into: lp:openobject-addons/6.0
Diff against target: 81 lines (+28/-4)
3 files modified
account/report/account_tax_report.py (+6/-1)
account/wizard/account_vat.py (+19/-1)
account/wizard/account_vat_view.xml (+3/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.0-opw-381830-han
Reviewer Review Type Date Requested Status
nel Pending
Vinay Rana (OpenERP) Pending
Naresh(OpenERP) Pending
Review via email: mp+91610@code.launchpad.net

Description of the change

Hello,

I have fixed the issue of The wizard proposes the first company in the list, linked to an incorrect
financial year! I select the correct company, but I cannot see whether the
correct financial year is proposed, because all financial years have the
same code (2012) and I cannot see the company of the financial year.

The system must automatically propose the correct financial year for the
company.

Thanks
Hardik

To post a comment you must log in.

Unmerged revisions

5033. By Hardik Ansodariya (OpenERP)

[Fix] account_vat_declaration: The system must automatically propose the correct financial year for the company(Maintenance Case : 381830)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/report/account_tax_report.py'
2--- account/report/account_tax_report.py 2011-01-14 00:11:01 +0000
3+++ account/report/account_tax_report.py 2012-02-06 06:17:20 +0000
4@@ -62,6 +62,11 @@
5
6 def _get_basedon(self, form):
7 return form['form']['based_on']
8+
9+ def _get_account(self, data):
10+ if data['model']=='account.tax.code':
11+ return self.pool.get('account.tax.code').browse(self.cr, self.uid, data['form']['chart_tax_id']).company_id.name
12+ return super(tax_report ,self)._get_account(data)
13
14 def _get_lines(self, based_on, company_id=False, parent=False, level=0, context=None):
15 period_list = self.period_ids
16@@ -229,4 +234,4 @@
17 report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code',
18 'addons/account/report/account_tax_report.rml', parser=tax_report, header="internal")
19
20-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
21\ No newline at end of file
22+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
23
24=== modified file 'account/wizard/account_vat.py'
25--- account/wizard/account_vat.py 2011-01-14 00:11:01 +0000
26+++ account/wizard/account_vat.py 2012-02-06 06:17:20 +0000
27@@ -30,6 +30,8 @@
28 ('payments', 'Payments'),],
29 'Based On', required=True),
30 'chart_tax_id': fields.many2one('account.tax.code', 'Chart of Tax', help='Select Charts of Taxes', required=True, domain = [('parent_id','=', False)]),
31+ 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
32+ 'company_id': fields.many2one('res.company', 'Company', readonly=True),
33 }
34
35 def _get_tax(self, cr, uid, context=None):
36@@ -41,6 +43,22 @@
37 'chart_tax_id': _get_tax
38 }
39
40+ def onchange_fiscal(self, cr, uid, ids, fiscalyear_id, chart_tax_id, context=None):
41+ fiscal_obj = self.pool.get('account.fiscalyear')
42+ tax_obj = self.pool.get('account.tax.code')
43+ if chart_tax_id:
44+ comp_id = tax_obj.browse(cr, uid, chart_tax_id).company_id.id
45+ if comp_id:
46+ company = fiscal_obj.search(cr, uid, [('company_id','=',comp_id)])
47+ final_id = company and company[0] or []
48+
49+ if final_id:
50+ fiscal_year = fiscal_obj.browse(cr, uid, final_id)
51+ return {'value': {'fiscalyear_id': fiscal_year.id, 'company_id':final_id}}
52+ else:
53+ return {'value': {'fiscalyear_id': False,'company_id':final_id}}
54+ return {}
55+
56 def create_vat(self, cr, uid, ids, context=None):
57 if context is None:
58 context = {}
59@@ -56,4 +74,4 @@
60
61 account_vat_declaration()
62
63-#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
64\ No newline at end of file
65+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
66
67=== modified file 'account/wizard/account_vat_view.xml'
68--- account/wizard/account_vat_view.xml 2011-08-18 16:49:07 +0000
69+++ account/wizard/account_vat_view.xml 2012-02-06 06:17:20 +0000
70@@ -11,8 +11,9 @@
71 <separator string="Taxes Report" colspan="4"/>
72 <label colspan="4" nolabel="1" string="This menu prints a VAT declaration based on invoices. Select one or several periods of the fiscal year. The information required for a tax declaration is automatically generated by OpenERP from invoices (or payments, in some countries). This data is updated in real time. That’s very useful because it enables you to preview at any time the tax that you owe at the start and end of the month or quarter."/>
73 <newline/>
74- <field name="chart_tax_id" widget='selection'/>
75- <field name="fiscalyear_id"/>
76+ <field name="chart_tax_id" widget='selection' on_change="onchange_fiscal(fiscalyear_id,chart_tax_id)"/>
77+ <field name="company_id" invisible="1"/>
78+ <field name="fiscalyear_id" domain="[('company_id', '=', company_id)]" context="{'company_id':company_id}"/>
79 <!-- It seems that we don't really support the option based on payment. So it's better to hide this choice for now -->
80 <!--<field name="based_on"/>-->
81 <separator string="Periods" colspan="4"/>