Hardik Ansodariya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-381830-han into 
lp:openobject-addons/6.0.

Requested reviews:
  nel (nel-tinyerp)
  Vinay Rana (openerp) (vra-openerp)
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-381830-han/+merge/91610

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
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-381830-han/+merge/91610
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-381830-han.
=== modified file 'account/report/account_tax_report.py'
--- account/report/account_tax_report.py	2011-01-14 00:11:01 +0000
+++ account/report/account_tax_report.py	2012-02-06 06:17:20 +0000
@@ -62,6 +62,11 @@
 
     def _get_basedon(self, form):
         return form['form']['based_on']
+    
+    def _get_account(self, data):
+        if data['model']=='account.tax.code':
+            return self.pool.get('account.tax.code').browse(self.cr, self.uid, data['form']['chart_tax_id']).company_id.name
+        return super(tax_report ,self)._get_account(data)
 
     def _get_lines(self, based_on, company_id=False, parent=False, level=0, context=None):
         period_list = self.period_ids
@@ -229,4 +234,4 @@
 report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code',
     'addons/account/report/account_tax_report.rml', parser=tax_report, header="internal")
 
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'account/wizard/account_vat.py'
--- account/wizard/account_vat.py	2011-01-14 00:11:01 +0000
+++ account/wizard/account_vat.py	2012-02-06 06:17:20 +0000
@@ -30,6 +30,8 @@
                                       ('payments', 'Payments'),],
                                       'Based On', required=True),
         'chart_tax_id': fields.many2one('account.tax.code', 'Chart of Tax', help='Select Charts of Taxes', required=True, domain = [('parent_id','=', False)]),
+        'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
+        'company_id': fields.many2one('res.company', 'Company', readonly=True),
     }
 
     def _get_tax(self, cr, uid, context=None):
@@ -41,6 +43,22 @@
         'chart_tax_id': _get_tax
     }
 
+    def onchange_fiscal(self, cr, uid, ids, fiscalyear_id, chart_tax_id, context=None):
+        fiscal_obj = self.pool.get('account.fiscalyear')
+        tax_obj = self.pool.get('account.tax.code')
+        if chart_tax_id:
+            comp_id = tax_obj.browse(cr, uid, chart_tax_id).company_id.id
+            if comp_id:
+                company = fiscal_obj.search(cr, uid, [('company_id','=',comp_id)])
+                final_id = company and company[0] or []
+                
+                if final_id:
+                    fiscal_year = fiscal_obj.browse(cr, uid, final_id)
+                    return {'value': {'fiscalyear_id': fiscal_year.id, 'company_id':final_id}}
+                else:
+                    return {'value': {'fiscalyear_id': False,'company_id':final_id}}
+        return {}
+    
     def create_vat(self, cr, uid, ids, context=None):
         if context is None:
             context = {}
@@ -56,4 +74,4 @@
 
 account_vat_declaration()
 
-#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'account/wizard/account_vat_view.xml'
--- account/wizard/account_vat_view.xml	2011-08-18 16:49:07 +0000
+++ account/wizard/account_vat_view.xml	2012-02-06 06:17:20 +0000
@@ -11,8 +11,9 @@
                 <separator string="Taxes Report" colspan="4"/>
                 <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."/>
                 <newline/>
-                <field name="chart_tax_id" widget='selection'/>
-                <field name="fiscalyear_id"/>
+               <field name="chart_tax_id" widget='selection' on_change="onchange_fiscal(fiscalyear_id,chart_tax_id)"/>
+               <field name="company_id" invisible="1"/>
+               <field name="fiscalyear_id" domain="[('company_id', '=', company_id)]" context="{'company_id':company_id}"/>
                 <!-- It seems that we don't really support the option based on payment. So it's better to hide this choice for now -->
                 <!--<field name="based_on"/>-->
                 <separator string="Periods"  colspan="4"/>

_______________________________________________
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

Reply via email to