30
30
form_fyear = """<?xml version="1.0"?>
31
31
<form string="Select Period">
32
32
<field name="period" />
33
<field name="ask_resitution"/>
34
<field name="ask_payment"/>
35
<field name="client_nihil"/>
36
39
'period': {'string': 'Period', 'type': 'many2one', 'relation': 'account.period', 'required': True,},
40
'ask_resitution': {'type': 'boolean', 'string': 'Ask Restitution',},
41
'ask_payment': {'type': 'boolean', 'string': 'Ask Payment',},
42
'client_nihil': {'type': 'boolean', 'string': 'Last Declaration of Entreprise', 'help': 'Thick this case only if it concerns only the last statement on the civil or cessation of activity'},
39
45
form = """<?xml version="1.0"?>
54
60
class wizard_vat_declaration(wizard.interface):
56
62
def _create_xml(self, cr, uid, data, context):
57
list_of_tags=['00','01','02','03','45','46','47','48','49','54','55','56','57','59','61','62','63','64','71','81','82','83','84','85','86','87','91']
63
list_of_tags=['00','01','02','03','44','45','46','47','48','49','54','55','56','57','59','61','62','63','64','71','81','82','83','84','85','86','87','88','91']
58
64
pool_obj = pooler.get_pool(cr.dbname)
59
65
#obj_company = pool_obj.get('res.company').browse(cr,uid,1)
60
66
obj_company = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid).company_id
68
74
ctx['period_id'] = data['form']['period'] #added context here
69
75
tax_info = pool_obj.get('account.tax.code').read(cr,uid,tax_ids,['code','sum_period'],context=ctx)
71
address=post_code=city=''
72
if not obj_company.partner_id.address:
73
address=post_code=city=''
77
address = post_code = city = country_code = ''
75
city, post_code, address = pooler.get_pool(cr.dbname).get('res.company')._get_default_ad(obj_company.partner_id.address)
79
city, post_code, address, country_code = pooler.get_pool(cr.dbname).get('res.company')._get_default_ad(obj_company.partner_id.address)
77
81
obj_fyear = pool_obj.get('account.fiscalyear')
78
82
year_id = obj_fyear.find(cr, uid)
80
84
account_period=pool_obj.get('account.period').browse(cr, uid, data['form']['period'])
81
current_year = account_period.fiscalyear_id.name
82
85
period_code = account_period.code
86
send_ref = send_ref + period_code
87
send_ref = str(obj_company.partner_id.id) + str(account_period.date_start[5:7]) + str(account_period.date_stop[:4])
88
89
data_of_file='<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-14.xml">'
89
90
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>'
90
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>'
91
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'
91
data_of_file +='\n\t\t<POSTCODE>'+post_code+'</POSTCODE>\n\t\t<CITY>'+city+'</CITY>\n\t\t<COUNTRY>'+country_code+'</COUNTRY>\n\t\t<SENDINGREFERENCE>'+send_ref+'</SENDINGREFERENCE>\n\t</DECLARER>'
92
data_of_file +='\n\t<VATRECORD>\n\t\t<RECNUM>1</RECNUM>\n\t\t<VATNUMBER>'+str(vat_no[2:])+'</VATNUMBER>\n\t\t<DPERIODE>\n\t\t\t'
93
94
starting_month = account_period.date_start[5:7]
94
95
ending_month = account_period.date_stop[5:7]
101
102
data_of_file += '<MONTH>'+starting_month+'</MONTH>\n\t\t\t'
102
103
data_of_file += '<YEAR>' + str(account_period.date_stop[:4]) + '</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
104
data_of_file += '\n\t\t<ClientListingNihil>'+ (data['form']['client_nihil'] and 'YES' or 'NO') +'</ClientListingNihil>'
103
105
data_of_file +='\n\t\t<DATA>\n\t\t\t<DATA_ELEM>'
105
107
for item in tax_info:
107
109
if item['code'] == '71-72':
108
110
item['code']='71'
109
111
if item['code'] in list_of_tags:
110
data_of_file +='\n\t\t\t\t<D'+str(int(item['code'])) +'>' + str(int(item['sum_period']*100)) + '</D'+str(int(item['code'])) +'>'
112
data_of_file +='\n\t\t\t\t<D'+str(int(item['code'])) +'>' + str(abs(int(item['sum_period']*100))) + '</D'+str(int(item['code'])) +'>'
112
114
data_of_file +='\n\t\t\t</DATA_ELEM>\n\t\t</DATA>\n\t</VATRECORD>\n</VATSENDING>'
113
115
data['form']['msg']='Save the File with '".xml"' extension.'