diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra.py b/addons/l10n_be/wizard/l10n_be_vat_intra.py
index d61af532ce9..3c31de4d5bd 100644
--- a/addons/l10n_be/wizard/l10n_be_vat_intra.py
+++ b/addons/l10n_be/wizard/l10n_be_vat_intra.py
@@ -82,7 +82,7 @@ class partner_vat_intra(osv.osv_memory):
obj_partner_add = self.pool.get('res.partner.address')
xmldict = {}
- street = zip_city = country = p_list = data_clientinfo = ''
+ post_code = street = city = country = p_list = data_clientinfo = ''
seq = amount_sum = 0
wiz_data = self.browse(cr, uid, ids[0], context=context)
@@ -114,11 +114,21 @@ class partner_vat_intra(osv.osv_memory):
dnum = cref + seq_declarantnum[-5:]
addr = obj_partner.address_get(cr, uid, [data_cmpny.partner_id.id], ['invoice'])
+ email = data_cmpny.partner_id.email
+ phone = data_cmpny.partner_id.phone
+ if email == False:
+ email = ''
+ if phone == False:
+ phone = ''
+
if addr.get('invoice',False):
ads = obj_partner_add.browse(cr, uid, [addr['invoice']])[0]
- zip_city = (ads.city or '') + ' ' + (ads.zip or '')
- if zip_city== ' ':
- zip_city = ''
+ city = (ads.city or '')
+ post_code = (ads.zip or '')
+ if city == ' ':
+ city = ''
+ if post_code == ' ':
+ post_code = ''
if ads.street:
street = ads.street
if ads.street2:
@@ -136,8 +146,11 @@ class partner_vat_intra(osv.osv_memory):
'mand_id': wiz_data.mand_id,
'sender_date': str(time.strftime('%Y-%m-%d')),
'street': street,
- 'zip_city': zip_city,
+ 'city': city,
+ 'post_code': post_code,
'country': country,
+ 'email': email,
+ 'phone': phone,
'period': wiz_data.period_code,
'clientlist': []
})
@@ -186,30 +199,36 @@ class partner_vat_intra(osv.osv_memory):
"""
mod_obj = self.pool.get('ir.model.data')
xml_data = self._get_datas(cursor, user, ids, context=context)
+ month_quarter = xml_data['period'][:2]
+ year = xml_data['period'][2:]
data_file = ''
+ for country in xml_data['clientlist']:
+ if country['country'] == 'BE':
+ country['country'] = ''
+ else:
+ country['country'] = country['country']
# Can't we do this by etree?
data_head = """
-
-
-
- %(company_vat)s
- %(company_name)s
- %(street)s
- %(zip_city)s
- %(country)s
-
- """ % (xml_data)
-
- data_comp_period = '\n\t\t\n\t\t\t%(vatnum)s\n\t\t\t%(company_name)s\n\t\t\t%(street)s\n\t\t\t%(zip_city)s\n\t\t\t%(country)s\n\t\t\n\t\t%(period)s' % (xml_data)
+
+ %(company_name)s
+ %(mand_id)s""" % (xml_data)
+
+ data_comp_period = '\n\t\t\n\t\t\t%(vatnum)s\n\t\t\t%(company_name)s\n\t\t\t%(street)s\n\t\t\t%(post_code)s\n\t\t\t%(city)s\n\t\t\t%(country)s\n\t\t%(email)s\n\t\t%(phone)s' % (xml_data)
+ if month_quarter.startswith('3'):
+ data_comp_period += '\n\t\t\n\t'+month_quarter+' \n\t'+year+''
+ elif month_quarter.startswith('0') and month_quarter.endswith('0'):
+ data_comp_period+= '\n\t\t%(period)s' % (xml_data)
+ else:
+ data_comp_period += '\n\t\t\n\t'+month_quarter+' \n\t'+year+''
data_clientinfo = ''
for client in xml_data['clientlist']:
- data_clientinfo +='\n\t\t\n\t\t\t\n\t\t\t\t%(vatnum)s\n\t\t\t\t%(country)s\n\t\t\t\n\t\t\t%(amount)s\n\t\t\t%(code)s\n\t\t' % (client)
+ data_clientinfo +='\n\t\t\n\t\t\t%(vatnum)s\n\t\t\t%(code)s\n\t\t\t%(amount)s\n\t\t\n\t\t' % (client)
- data_decl = '\n\t' % (xml_data)
+ data_decl = '\n\t' % (xml_data)
- data_file += data_head + data_decl + data_comp_period + data_clientinfo + '\n\t\n'
+ data_file += data_head + data_decl + data_comp_period + data_clientinfo + '\n\n\n\t\n'
context['file_save'] = data_file
model_data_ids = mod_obj.search(cursor, user,[('model','=','ir.ui.view'),('name','=','view_vat_intra_save')], context=context)