fix bug
authorHarry (Open ERP) <hmo@tinyerp.com>
Thu, 5 Feb 2009 05:43:13 +0000 (11:13 +0530)
committerHarry (Open ERP) <hmo@tinyerp.com>
Thu, 5 Feb 2009 05:43:13 +0000 (11:13 +0530)
* [DMS] file can not upload from ftp client
* [l10n_be] in VAT declaration xml report , YEAR is wrong

bzr revid: hmo@tinyerp.com-20090205054313-ukjf6nwh43fg8mp4

addons/document/document.py
addons/l10n_be/company.py
addons/l10n_be/wizard/account_vat_declaration.py

index 6cc2e7f..ada5c78 100644 (file)
@@ -609,7 +609,7 @@ class document_file(osv.osv):
 
     def create(self, cr, uid, vals, context={}):
         vals['title']=vals['name']
-        vals['parent_id'] = context.get('parent_id',False)
+        vals['parent_id'] = context.get('parent_id',False) or vals.get('parent_id',False)
         if not vals.get('res_id', False) and context.get('default_res_id',False):
             vals['res_id']=context.get('default_res_id',False)
         if not vals.get('res_model', False) and context.get('default_res_model',False):
index 3538f6e..0ef4191 100644 (file)
@@ -31,10 +31,10 @@ class res_company(osv.osv):
         city = post_code = address = ""
         for ads in addresses:
             if ads.type == 'default':
-                city = ads.city
-                post_code = ads.zip
+                city = ads.city or ""
+                post_code = ads.zip or ""
                 if ads.street:
-                    address = ads.street
+                    address = ads.street or ""
                 if ads.street2:
                     address += " " + ads.street2
         return city, post_code, address
index a6123d7..942b3f7 100644 (file)
@@ -76,9 +76,10 @@ class wizard_vat_declaration(wizard.interface):
 
         obj_fyear = pool_obj.get('account.fiscalyear')
         year_id = obj_fyear.find(cr, uid)
-        current_year = obj_fyear.browse(cr,uid,year_id).name
-
-        period_code = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).code
+        
+        account_period=pool_obj.get('account.period').browse(cr, uid, data['form']['period'])
+        current_year = account_period.fiscalyear_id.name
+        period_code = account_period.code
 
         send_ref = user_cmpny
         if period_code:
@@ -89,8 +90,8 @@ class wizard_vat_declaration(wizard.interface):
         data_of_file +='\n\t\t<POSTCODE>'+post_code+'</POSTCODE>\n\t\t<CITY>'+city+'</CITY>\n\t\t<SENDINGREFERENCE>'+send_ref+'</SENDINGREFERENCE>\n\t</DECLARER>'
         data_of_file +='\n\t<VATRECORD>\n\t\t<RECNUM>1</RECNUM>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<DPERIODE>\n\t\t\t'
 
-        starting_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_start[5:7]
-        ending_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_stop[5:7]
+        starting_month = account_period.date_start[5:7]
+        ending_month = account_period.date_stop[5:7]
         if starting_month != ending_month:
             #starting month and ending month of selected period are not the same 
             #it means that the accounting isn't based on periods of 1 month but on quarters