58
61
user_cmpny = obj_company.name
59
62
vat_no=obj_company.partner_id.vat
61
raise wizard.except_wizard('Data Insufficient','No VAT Number Associated with Main Company!')
64
raise wizard.except_wizard(_('Data Insufficient'),_('No VAT Number Associated with Main Company!'))
63
66
tax_ids = pool_obj.get('account.tax.code').search(cr,uid,[])
64
67
ctx = context.copy()
69
72
if not obj_company.partner_id.address:
70
73
address=post_code=city=''
72
for ads in obj_company.partner_id.address:
73
if ads.type=='default':
76
post_code=ads.zip_id.name
75
city, post_code, address = pooler.get_pool(cr.dbname).get('res.company')._get_default_ad(obj_company.partner_id.address)
82
77
obj_fyear = pool_obj.get('account.fiscalyear')
83
78
year_id = obj_fyear.find(cr, uid)
84
79
current_year = obj_fyear.browse(cr,uid,year_id).name
85
month=time.strftime('%m')
87
81
period_code = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).code
88
83
send_ref = user_cmpny
90
85
send_ref = send_ref + period_code
92
87
data_of_file='<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-14.xml">'
93
data_of_file +='\n\t<DECLARER>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<NAME>'+str(obj_company.name)+'</NAME>\n\t\t<ADDRESS>'+str(address)+'</ADDRESS>'
94
data_of_file +='\n\t\t<POSTCODE>'+str(post_code)+'</POSTCODE>\n\t\t<CITY>'+str(city)+'</CITY>\n\t\t<SENDINGREFERENCE>'+send_ref+'</SENDINGREFERENCE>\n\t</DECLARER>'
95
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<MONTH>'+str(month)+'</MONTH>\n\t\t\t<YEAR>'+str(current_year[-4:])+'</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
88
data_of_file +='\n\t<DECLARER>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<NAME>'+str(obj_company.name)+'</NAME>\n\t\t<ADDRESS>'+address+'</ADDRESS>'
89
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>'
90
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'
92
starting_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_start[5:7]
93
ending_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_stop[5:7]
94
if starting_month != ending_month:
95
#starting month and ending month of selected period are not the same
96
#it means that the accounting isn't based on periods of 1 month but on quarters
97
quarter = str(((int(starting_month) - 1) / 3) + 1)
98
data_of_file += '<QUARTER>'+quarter+'</QUARTER>\n\t\t\t'
100
data_of_file += '<MONTH>'+starting_month+'</MONTH>\n\t\t\t'
101
data_of_file += '<YEAR>'+str(current_year[-4:])+'</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
96
102
data_of_file +='\n\t\t<DATA>\n\t\t\t<DATA_ELEM>'
98
104
for item in tax_info: