diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra.py b/addons/l10n_be/wizard/l10n_be_vat_intra.py index 800535286ae..57fb2994d7d 100644 --- a/addons/l10n_be/wizard/l10n_be_vat_intra.py +++ b/addons/l10n_be/wizard/l10n_be_vat_intra.py @@ -52,19 +52,23 @@ class partner_vat_intra(osv.osv_memory): ''' ), 'period_ids': fields.many2many('account.period', 'account_period_rel', 'acc_id', 'period_id', 'Period (s)', help = 'Select here the period(s) you want to include in your intracom declaration'), - 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', domain=[('parent_id', '=', False)]), + 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', domain=[('parent_id', '=', False)], help="Keep empty to use the user's company"), 'test_xml': fields.boolean('Test XML file', help="Sets the XML output as test file"), 'mand_id' : fields.char('MandataireId', size=14, required=True, help="This identifies the representative of the sending company. This is a string of 14 characters"), 'msg': fields.text('File created', size=14, readonly=True), 'no_vat': fields.text('Partner With No VAT', size=14, readonly=True, help="The Partner whose VAT number is not defined they doesn't include in XML File."), 'file_save' : fields.binary('Save File', readonly=True), 'country_ids': fields.many2many('res.country', 'vat_country_rel', 'vat_id', 'country_id', 'European Countries'), + 'comments': fields.text('Comments'), + 'identification_type': fields.selection([('tin','TIN'), ('nvat','NVAT'), ('other','Other')], 'Identification Type', required=True), + 'other': fields.char('Other Qlf', size=16, help="Description of Identification Type"), } _defaults = { 'country_ids': _get_europe_country, 'file_save': _get_xml_data, 'name': 'vat_Intra.xml', + 'identification_type': 'tin', } def _get_datas(self, cr, uid, ids, context=None): @@ -86,17 +90,21 @@ class partner_vat_intra(osv.osv_memory): seq = amount_sum = 0 wiz_data = self.browse(cr, uid, ids[0], context=context) + type = wiz_data.identification_type or '' + other = wiz_data.other or '' + comments = wiz_data.comments if wiz_data.tax_code_id: data_cmpny = wiz_data.tax_code_id.company_id else: data_cmpny = obj_user.browse(cr, uid, uid, context=context).company_id - + # Get Company vat company_vat = data_cmpny.partner_id.vat if not company_vat: raise osv.except_osv(_('Data Insufficient'),_('No VAT Number Associated with Main Company!')) company_vat = company_vat.replace(' ','').upper() + issued_by = company_vat[:2] if len(wiz_data.period_code) != 6: raise osv.except_osv(_('Wrong Period Code'), _('The period code you entered is not valid.')) @@ -144,7 +152,12 @@ class partner_vat_intra(osv.osv_memory): 'email': email, 'phone': phone, 'period': wiz_data.period_code, - 'clientlist': [] + 'clientlist': [], + 'comments': comments, + 'type': type.upper(), + 'other': other, + 'issued_by': issued_by, + 'company_registry': data_cmpny.company_registry, }) codes = ('44', '46L', '46T') @@ -202,25 +215,34 @@ class partner_vat_intra(osv.osv_memory): # Can't we do this by etree? data_head = """ - - %(company_name)s + + + %(company_registry)s + %(company_name)s + %(street)s + %(post_code)s + %(city)s + %(country)s + %(email)s + %(phone)s + %(mand_id)s""" % (xml_data) - data_comp_period = '\n\t\t\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) + data_comp_period = '\n\t\t\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\t%(email)s\n\t\t\t%(phone)s\n\t\t' % (xml_data) if month_quarter.startswith('3'): - data_comp_period += '\n\t\t\n\t'+month_quarter+' \n\t'+year+'' + data_comp_period += '\n\t\t\n\t\t\t'+month_quarter+' \n\t\t\t'+year+'\n\t\t' 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_comp_period += '\n\t\t\n\t\t\t'+month_quarter+' \n\t\t\t'+year+'\n\t\t' data_clientinfo = '' for client in xml_data['clientlist']: - 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_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\t\n\t\t\t\t \n\t\t\t\t\n\t\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\n\n\t\n' + data_file += data_head + data_decl + data_comp_period + data_clientinfo + '\n\t\t \n\t\t%(comments)s\n\t\n' % (xml_data) context['file_save'] = data_file model_data_ids = mod_obj.search(cursor, user,[('model','=','ir.ui.view'),('name','=','view_vat_intra_save')], context=context) diff --git a/addons/l10n_be/wizard/l10n_be_vat_intra_view.xml b/addons/l10n_be/wizard/l10n_be_vat_intra_view.xml index a6d251983d3..b770c00b265 100644 --- a/addons/l10n_be/wizard/l10n_be_vat_intra_view.xml +++ b/addons/l10n_be/wizard/l10n_be_vat_intra_view.xml @@ -23,12 +23,17 @@ - + + + +