Merge lp:~qdp/openobject-addons/5.0-l10nbe-intervat5.1.0-compliancy into lp:openobject-addons/5.0

Proposed by qdp (OpenERP)
Status: Merged
Merged at revision: not available
Proposed branch: lp:~qdp/openobject-addons/5.0-l10nbe-intervat5.1.0-compliancy
Merge into: lp:openobject-addons/5.0
Diff against target: 434 lines (+110/-147)
5 files modified
account/account_bank_statement.py (+26/-21)
l10n_be/account_pcmn_belgium.xml (+29/-7)
l10n_be/company.py (+4/-2)
l10n_be/wizard/account_vat_declaration.py (+14/-12)
l10n_be/wizard/wizard_vat_intra.py (+37/-105)
To merge this branch: bzr merge lp:~qdp/openobject-addons/5.0-l10nbe-intervat5.1.0-compliancy
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+22893@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_bank_statement.py'
2--- account/account_bank_statement.py 2010-02-04 11:47:04 +0000
3+++ account/account_bank_statement.py 2010-04-06 17:52:20 +0000
4@@ -529,35 +529,40 @@
5
6 def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id,
7 context={}):
8+ res = {'value': {}}
9 if not partner_id:
10- return {}
11- res_currency_obj = self.pool.get('res.currency')
12- res_users_obj = self.pool.get('res.users')
13-
14- company_currency_id = res_users_obj.browse(cursor, user, user,
15- context=context).company_id.currency_id.id
16-
17- if not currency_id:
18- currency_id = company_currency_id
19-
20- part = self.pool.get('res.partner').browse(cursor, user, partner_id,
21+ return res
22+ line = self.browse(cursor, user, line_id)
23+
24+ if not line or (line and not line[0].account_id):
25+ part = self.pool.get('res.partner').browse(cursor, user, partner_id,
26 context=context)
27- if type == 'supplier':
28- account_id = part.property_account_payable.id
29- else:
30- account_id = part.property_account_receivable.id
31-
32- cursor.execute('SELECT sum(debit-credit) \
33+ if type == 'supplier':
34+ account_id = part.property_account_payable.id
35+ else:
36+ account_id = part.property_account_receivable.id
37+ res['value']['account_id'] = account_id
38+
39+ if not line or (line and not line[0].amount):
40+ res_users_obj = self.pool.get('res.users')
41+ res_currency_obj = self.pool.get('res.currency')
42+ company_currency_id = res_users_obj.browse(cursor, user, user,
43+ context=context).company_id.currency_id.id
44+ if not currency_id:
45+ currency_id = company_currency_id
46+
47+ cursor.execute('SELECT sum(debit-credit) \
48 FROM account_move_line \
49 WHERE (reconcile_id is null) \
50 AND partner_id = %s \
51 AND account_id=%s', (partner_id, account_id))
52- res = cursor.fetchone()
53- balance = res and res[0] or 0.0
54+ pgres = cursor.fetchone()
55+ balance = pgres and pgres[0] or 0.0
56
57- balance = res_currency_obj.compute(cursor, user, company_currency_id,
58+ balance = res_currency_obj.compute(cursor, user, company_currency_id,
59 currency_id, balance, context=context)
60- return {'value': {'amount': balance, 'account_id': account_id}}
61+ res['value']['amount'] = balance
62+ return res
63
64 def _reconcile_amount(self, cursor, user, ids, name, args, context=None):
65 if not ids:
66
67=== modified file 'l10n_be/account_pcmn_belgium.xml'
68--- l10n_be/account_pcmn_belgium.xml 2010-03-08 13:26:39 +0000
69+++ l10n_be/account_pcmn_belgium.xml 2010-04-06 17:52:20 +0000
70@@ -6466,9 +6466,20 @@
71 </record>
72 <record id="vat_code_a44" model="account.tax.code.template">
73 <field name="code">44</field>
74+ <field name="name">Services intra-communautaires et ABC</field>
75+ <field name="parent_id" ref="vat_code_out"/>
76+ </record>
77+ <record id="vat_code_a44a" model="account.tax.code.template">
78+ <field name="code">44a</field>
79 <field name="name">Services intra-communautaires</field>
80- <field name="parent_id" ref="vat_code_out"/>
81- </record>
82+ <field name="parent_id" ref="vat_code_a44"/>
83+ </record>
84+ <record id="vat_code_a44b" model="account.tax.code.template">
85+ <field name="code">44b</field>
86+ <field name="name">ABC intra-communautaires</field>
87+ <field name="parent_id" ref="vat_code_a44"/>
88+ </record>
89+
90 <record id="vat_code_a45" model="account.tax.code.template">
91 <field name="code">45</field>
92 <field name="name">Operations avec TVA due par le cocontractant</field>
93@@ -7053,14 +7064,25 @@
94 </record>
95 <record id="vat_IO_S" model="account.tax.template">
96 <field name="chart_template_id" ref="l10nbe_chart_template"/>
97- <field name="name">TVA 0% Intracommunautaire (Services et ABC)</field>
98+ <field name="name">TVA 0% Services Intracommunautaires</field>
99 <field name="description">V-INTRA-S 0</field>
100 <field eval="0.00" name="amount"/>
101 <field name="type">percent</field>
102- <field name="base_code_id" ref="vat_code_a44"/>
103- <field name="ref_base_code_id" ref="vat_code_a48"/>
104- <field name="type_tax_use">sale</field>
105- </record>
106+ <field name="base_code_id" ref="vat_code_a44a"/>
107+ <field name="ref_base_code_id" ref="vat_code_a48"/>
108+ <field name="type_tax_use">sale</field>
109+ </record>
110+ <record id="vat_IO_S" model="account.tax.template">
111+ <field name="chart_template_id" ref="l10nbe_chart_template"/>
112+ <field name="name">TVA 0% ABC Intracommunautaire</field>
113+ <field name="description">V-INTRA-ABC 0</field>
114+ <field eval="0.00" name="amount"/>
115+ <field name="type">percent</field>
116+ <field name="base_code_id" ref="vat_code_a44b"/>
117+ <field name="ref_base_code_id" ref="vat_code_a48"/>
118+ <field name="type_tax_use">sale</field>
119+ </record>
120+
121
122 <!-- Purchases VAT -->
123 <record id="vat_IO_buy_21b" model="account.tax.template">
124
125=== modified file 'l10n_be/company.py'
126--- l10n_be/company.py 2009-02-05 05:43:13 +0000
127+++ l10n_be/company.py 2010-04-06 17:52:20 +0000
128@@ -28,7 +28,7 @@
129
130
131 def _get_default_ad(self, addresses):
132- city = post_code = address = ""
133+ city = post_code = address = country_code = ""
134 for ads in addresses:
135 if ads.type == 'default':
136 city = ads.city or ""
137@@ -37,7 +37,9 @@
138 address = ads.street or ""
139 if ads.street2:
140 address += " " + ads.street2
141- return city, post_code, address
142+ if ads.country_id:
143+ country_code = ads.country_id and ads.country_id.code or ""
144+ return city, post_code, address, country_code
145 res_company()
146
147 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
148
149=== modified file 'l10n_be/wizard/account_vat_declaration.py'
150--- l10n_be/wizard/account_vat_declaration.py 2009-04-09 10:02:19 +0000
151+++ l10n_be/wizard/account_vat_declaration.py 2010-04-06 17:52:20 +0000
152@@ -30,10 +30,16 @@
153 form_fyear = """<?xml version="1.0"?>
154 <form string="Select Period">
155 <field name="period" />
156+ <field name="ask_resitution"/>
157+ <field name="ask_payment"/>
158+ <field name="client_nihil"/>
159 </form>"""
160
161 fields_fyear = {
162 'period': {'string': 'Period', 'type': 'many2one', 'relation': 'account.period', 'required': True,},
163+ 'ask_resitution': {'type': 'boolean', 'string': 'Ask Restitution',},
164+ 'ask_payment': {'type': 'boolean', 'string': 'Ask Payment',},
165+ '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'},
166 }
167
168 form = """<?xml version="1.0"?>
169@@ -54,7 +60,7 @@
170 class wizard_vat_declaration(wizard.interface):
171
172 def _create_xml(self, cr, uid, data, context):
173- 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']
174+ 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']
175 pool_obj = pooler.get_pool(cr.dbname)
176 #obj_company = pool_obj.get('res.company').browse(cr,uid,1)
177 obj_company = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid).company_id
178@@ -68,27 +74,22 @@
179 ctx['period_id'] = data['form']['period'] #added context here
180 tax_info = pool_obj.get('account.tax.code').read(cr,uid,tax_ids,['code','sum_period'],context=ctx)
181
182- address=post_code=city=''
183- if not obj_company.partner_id.address:
184- address=post_code=city=''
185+ address = post_code = city = country_code = ''
186
187- city, post_code, address = pooler.get_pool(cr.dbname).get('res.company')._get_default_ad(obj_company.partner_id.address)
188+ city, post_code, address, country_code = pooler.get_pool(cr.dbname).get('res.company')._get_default_ad(obj_company.partner_id.address)
189
190 obj_fyear = pool_obj.get('account.fiscalyear')
191 year_id = obj_fyear.find(cr, uid)
192
193 account_period=pool_obj.get('account.period').browse(cr, uid, data['form']['period'])
194- current_year = account_period.fiscalyear_id.name
195 period_code = account_period.code
196
197- send_ref = user_cmpny
198- if period_code:
199- send_ref = send_ref + period_code
200+ send_ref = str(obj_company.partner_id.id) + str(account_period.date_start[5:7]) + str(account_period.date_stop[:4])
201
202 data_of_file='<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-14.xml">'
203 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>'
204- 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>'
205- 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'
206+ 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>'
207+ 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'
208
209 starting_month = account_period.date_start[5:7]
210 ending_month = account_period.date_stop[5:7]
211@@ -100,6 +101,7 @@
212 else:
213 data_of_file += '<MONTH>'+starting_month+'</MONTH>\n\t\t\t'
214 data_of_file += '<YEAR>' + str(account_period.date_stop[:4]) + '</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
215+ data_of_file += '\n\t\t<ClientListingNihil>'+ (data['form']['client_nihil'] and 'YES' or 'NO') +'</ClientListingNihil>'
216 data_of_file +='\n\t\t<DATA>\n\t\t\t<DATA_ELEM>'
217
218 for item in tax_info:
219@@ -107,7 +109,7 @@
220 if item['code'] == '71-72':
221 item['code']='71'
222 if item['code'] in list_of_tags:
223- data_of_file +='\n\t\t\t\t<D'+str(int(item['code'])) +'>' + str(int(item['sum_period']*100)) + '</D'+str(int(item['code'])) +'>'
224+ 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'])) +'>'
225
226 data_of_file +='\n\t\t\t</DATA_ELEM>\n\t\t</DATA>\n\t</VATRECORD>\n</VATSENDING>'
227 data['form']['msg']='Save the File with '".xml"' extension.'
228
229=== modified file 'l10n_be/wizard/wizard_vat_intra.py'
230--- l10n_be/wizard/wizard_vat_intra.py 2009-03-24 11:01:43 +0000
231+++ l10n_be/wizard/wizard_vat_intra.py 2010-04-06 17:52:20 +0000
232@@ -30,6 +30,7 @@
233 import datetime
234 import pooler
235 import base64
236+from tools.translate import _
237
238 form_intra = """<?xml version="1.0"?>
239 <form string="Partner VAT Intra">
240@@ -37,13 +38,12 @@
241 <page string="General Information">
242 <label string="This wizard will create an XML file for Vat Intra" colspan="4"/>
243 <newline/>
244- <field name="fyear" />
245+ <field name="period_code"/>
246+ <newline/>
247+ <field name="period_ids"/>
248 <newline/>
249 <field name="mand_id" help="This identifies the representative of the sending company. This is a string of 14 characters"/>
250 <newline/>
251- <field name="trimester" help="it will be the first digit of period" />
252- <newline/>
253- <field name="test_xml" help="Set the XML output as test file"/>
254 </page>
255 <page string="European Countries">
256 <field name="country_ids" colspan="4" nolabel="1" />
257@@ -51,14 +51,18 @@
258 </notebook>
259 </form>"""
260 fields_intra = {
261- 'trimester': {'string': 'Trimester Number', 'type': 'selection', 'selection':[
262- ('1','Jan/Feb/Mar'),
263- ('2','Apr/May/Jun'),
264- ('3','Jul/Aug/Sep'),
265- ('4','Oct/Nov/Dec')], 'required': True},
266- 'test_xml': {'string':'Test XML file', 'type':'boolean'},
267+ 'period_code': {'string':'Period Code','type':'char','size':'6','required': True, 'help': '''This is where you have to set the period code for the intracom declaration using the format: ppyyyy
268+
269+ PP can stand for a month: from '01' to '12'.
270+ PP can stand for a trimester: '31','32','33','34'
271+ The first figure means that it is a trimester,
272+ The second figure identify the trimester.
273+ PP can stand for a complete fiscal year: '00'.
274+ YYYY stands for the year (4 positions).
275+'''
276+},
277+ 'period_ids': {'string': 'Period(s)', 'type': 'many2many', 'relation': 'account.period', 'required': True, 'help': 'Select here the period(s) you want to include in your intracom declaration'},
278 'mand_id':{'string':'MandataireId','type':'char','size':'14','required': True},
279- 'fyear': {'string': 'Fiscal Year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'required': True},
280 'country_ids': {
281 'string': 'European Countries',
282 'type': 'many2many',
283@@ -89,19 +93,16 @@
284 def _create_xml(self, cr, uid, data, context):
285 pool = pooler.get_pool(cr.dbname)
286 data_cmpny = pool.get('res.users').browse(cr, uid, uid).company_id
287- data_fiscal = pool.get('account.fiscalyear').browse(cr,uid,data['form']['fyear'])
288 company_vat = data_cmpny.partner_id.vat
289-
290 if not company_vat:
291 raise wizard.except_wizard('Data Insufficient','No VAT Number Associated with Main Company!')
292
293 seq_controlref = pool.get('ir.sequence').get(cr, uid,'controlref')
294 seq_declarantnum = pool.get('ir.sequence').get(cr, uid,'declarantnum')
295- cref = company_vat + seq_controlref
296- dnum = cref + seq_declarantnum
297- if len(data_fiscal.date_start.split('-')[0]) < 4:
298- raise wizard.except_wizard('Data Insufficient','Trimester year should be length of 4 digits!')
299- period_trimester = data['form']['trimester'] + data_fiscal.date_start.split('-')[0]
300+ cref = company_vat[2:] + seq_controlref[-4:]
301+ dnum = cref + seq_declarantnum[-5:]
302+ if len(data['form']['period_code']) != 6:
303+ raise wizard.except_wizard(_('Wrong Period Code'), _('The period code you entered is not valid.'))
304
305 street = zip_city = country = ''
306 addr = pool.get('res.partner').address_get(cr, uid, [data_cmpny.partner_id.id], ['invoice'])
307@@ -121,103 +122,34 @@
308 sender_date = time.strftime('%Y-%m-%d')
309 data_file = '<?xml version="1.0"?>\n<VatIntra xmlns="http://www.minfin.fgov.be/VatIntra" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RecipientId="VAT-ADMIN" SenderId="' + str(company_vat) + '"'
310 data_file +=' ControlRef="' + cref + '" MandataireId="' + data['form']['mand_id'] + '" SenderDate="'+ str(sender_date)+ '"'
311- if data['form']['test_xml']:
312- data_file += ' Test="1"'
313- data_file += ' VersionTech="1.2">'
314+ data_file += ' VersionTech="1.3">'
315 data_file +='\n\t<AgentRepr DecNumber="1">\n\t\t<CompanyInfo>\n\t\t\t<VATNum>' + str(company_vat)+'</VATNum>\n\t\t\t<Name>'+str(data_cmpny.name)+'</Name>\n\t\t\t<Street>'+ str(street) +'</Street>\n\t\t\t<CityAndZipCode>'+ str(zip_city) +'</CityAndZipCode>'
316 data_file +='\n\t\t\t<Country>' + str(country) +'</Country>\n\t\t</CompanyInfo>\n\t</AgentRepr>'
317
318- data_comp ='\n\t\t<CompanyInfo>\n\t\t\t<VATNum>'+str(company_vat)+'</VATNum>\n\t\t\t<Name>'+str(data_cmpny.name)+'</Name>\n\t\t\t<Street>'+ str(street) +'</Street>\n\t\t\t<CityAndZipCode>'+ str(zip_city) +'</CityAndZipCode>\n\t\t\t<Country>'+ str(country) +'</Country>\n\t\t</CompanyInfo>'
319- data_period = '\n\t\t<Period>'+ str(period_trimester) +'</Period>' #trimester
320+ data_comp ='\n\t\t<CompanyInfo>\n\t\t\t<VATNum>'+str(company_vat[2:])+'</VATNum>\n\t\t\t<Name>'+str(data_cmpny.name)+'</Name>\n\t\t\t<Street>'+ str(street) +'</Street>\n\t\t\t<CityAndZipCode>'+ str(zip_city) +'</CityAndZipCode>\n\t\t\t<Country>'+ str(country) +'</Country>\n\t\t</CompanyInfo>'
321+ data_period = '\n\t\t<Period>'+ data['form']['period_code'] +'</Period>' #trimester
322
323 error_message = []
324 seq = 0
325 amount_sum = 0
326- p_id_list = pool.get('res.partner').search(cr,uid,[('vat','!=',False)])
327- if not p_id_list:
328- raise wizard.except_wizard('Data Insufficient!','No partner has a VAT Number asociated with him.')
329-
330- nb_period = len(data_fiscal.period_ids)
331- fiscal_periods = data_fiscal.period_ids
332-
333- if data['form']['trimester'] == '1':
334- if nb_period == 12:
335- start_date = fiscal_periods[0].date_start
336- end_date = fiscal_periods[2].date_stop
337- elif nb_period == 4:
338- start_date = fiscal_periods[0].date_start
339- end_date = fiscal_periods[0].date_stop
340- elif data['form']['trimester'] == '2':
341- if nb_period == 12:
342- start_date = fiscal_periods[3].date_start
343- end_date = fiscal_periods[5].date_stop
344- elif nb_period == 4:
345- start_date = fiscal_periods[1].date_start
346- end_date = fiscal_periods[1].date_stop
347- elif data['form']['trimester'] == '3':
348- if nb_period == 12:
349- start_date = fiscal_periods[6].date_start
350- end_date = fiscal_periods[8].date_stop
351- elif nb_period == 4:
352- start_date = fiscal_periods[2].date_start
353- end_date = fiscal_periods[2].date_stop
354- elif data['form']['trimester'] == '4':
355- if nb_period == 12:
356- start_date = fiscal_periods[9].date_start
357- end_date = fiscal_periods[11].date_stop
358- elif nb_period == 4:
359- start_date = fiscal_periods[3].date_start
360- end_date = fiscal_periods[3].date_stop
361-
362- period = "to_date('" + str(start_date) + "','yyyy-mm-dd') and to_date('" + str(end_date) +"','yyyy-mm-dd')"
363- record = {}
364-
365- for p_id in p_id_list:
366- list_partner = []
367- partner = pool.get('res.partner').browse(cr, uid, p_id)
368- go_ahead = False
369- country_code = ''
370- for ads in partner.address:
371- if ads.type == 'default' and (ads.country_id and ads.country_id.id in data['form']['country_ids'][0][2]):
372- go_ahead = True
373- country_code = ads.country_id.code
374- break
375- if not go_ahead:
376- continue
377-
378- cr.execute('select sum(debit)-sum(credit) as amount from account_move_line l left join account_account a on (l.account_id=a.id) where a.type in ('"'receivable'"') and l.partner_id=%%s and l.date between %s' % (period,), (p_id,))
379- res = cr.dictfetchall()
380- list_partner.append(res[0]['amount'])
381- list_partner.append('T') #partner.ref ...should be check
382- list_partner.append(partner.vat)
383- list_partner.append(country_code)
384- #...deprecated...
385-# addr = pool.get('res.partner').address_get(cr, uid, [partner.id], ['invoice'])
386-# if addr.get('invoice',False):
387-# ads = pool.get('res.partner.address').browse(cr,uid,[addr['invoice']])[0]
388-#
389-# if ads.country_id:
390-# code_country = ads.country_id.code
391-# list_partner.append(code_country)
392-# else:
393-# error_message.append('Data Insufficient! : '+ 'The Partner "'+partner.name + '"'' has no country associated with its Invoice address!')
394-# if len(list_partner)<4:
395-# list_partner.append('')
396-# error_message.append('Data Insufficient! : '+ 'The Partner "'+partner.name + '"'' has no Invoice address!')
397-# list_partner.append(code_country or 'not avail')
398- record[p_id] = list_partner
399-
400- if len(error_message):
401- data['form']['msg'] = 'Exception : \n' +'-'*50+'\n'+ '\n'.join(error_message)
402- return data['form']
403+
404+ list_partner = []
405 data_clientinfo = ''
406-
407- for r in record:
408+ cr.execute('''SELECT l.partner_id AS partner_id, p.vat AS vat, t.code AS intra_code, SUM(l.tax_amount) AS amount
409+ FROM account_move_line l
410+ LEFT JOIN account_tax_code t ON (l.tax_code_id = t.id)
411+ LEFT JOIN res_partner p ON (l.partner_id = p.id)
412+ WHERE t.code IN ('44a','44b','88')
413+ AND l.period_id IN %s
414+ GROUP BY l.partner_id, p.vat, t.code''', (tuple(data['form']['period_ids'][0][2]), ))
415+ for row in cr.dictfetchall():
416 seq += 1
417- amt = record[r][0] or 0
418+ amt = row['amount'] or 0
419 amt = int(amt * 100)
420 amount_sum += amt
421- data_clientinfo +='\n\t\t<ClientList SequenceNum="'+str(seq)+'">\n\t\t\t<CompanyInfo>\n\t\t\t\t<VATNum>'+record[r][2] +'</VATNum>\n\t\t\t\t<Country>'+record[r][3] +'</Country>\n\t\t\t</CompanyInfo>\n\t\t\t<Amount>'+str(amt) +'</Amount>\n\t\t\t<Period>'+str(period_trimester) +'</Period>\n\t\t\t<Code>'+str(record[r][1]) +'</Code>\n\t\t</ClientList>'
422+ intra_code = row['intra_code'] == '88' and 'L' or (row['intra_code'] == '44b' and 'T' or (row['intra_code'] == '44a' and 'S' or ''))
423+ data_clientinfo +='\n\t\t<ClientList SequenceNum="'+str(seq)+'">\n\t\t\t<CompanyInfo>\n\t\t\t\t<VATNum>'+row['vat'][2:] +'</VATNum>\n\t\t\t\t<Country>'+row['vat'][:2] +'</Country>\n\t\t\t</CompanyInfo>\n\t\t\t<Amount>'+str(amt) +'</Amount>\n\t\t\t<Code>'+str(intra_code) +'</Code>\n\t\t</ClientList>'
424+
425 amount_sum = int(amount_sum)
426 data_decl = '\n\t<DeclarantList SequenceNum="1" DeclarantNum="'+ dnum + '" ClientNbr="'+ str(seq) +'" AmountSum="'+ str(amount_sum) +'" >'
427 data_file += str(data_decl) + str(data_comp) + str(data_period) + str(data_clientinfo) + '\n\t</DeclarantList>\n</VatIntra>'
428@@ -235,4 +167,4 @@
429 'result': {'type':'form', 'arch':msg_form, 'fields':msg_fields, 'state':[('end','Ok')]},
430 }
431 }
432-parter_vat_intra('vat.intra.xml')
433\ No newline at end of file
434+parter_vat_intra('vat.intra.xml')