From ed62109fe260883599b1064fdb82e7139a7880da Mon Sep 17 00:00:00 2001 From: "Bharat Devnani (OpenERP)" Date: Fri, 27 Jan 2012 11:28:00 +0530 Subject: [PATCH] [IMP] converted the wizard according to new format bzr revid: bde@tinyerp.com-20120127055800-lzeiu5uqvm58lg8w --- .../wizard/l10n_be_partner_vat_listing.py | 41 ++++-- .../wizard/l10n_be_partner_vat_listing.xml | 127 ++++++++++-------- 2 files changed, 97 insertions(+), 71 deletions(-) diff --git a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py index d6d56ac653c..516fa7cfb4c 100644 --- a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py +++ b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.py @@ -148,6 +148,9 @@ class partner_vat_list_13(osv.osv_memory): 'name': fields.char('File Name', size=32), 'msg': fields.text('File created', size=64, readonly=True), 'file_save' : fields.binary('Save File', readonly=True), + 'identification_type': fields.selection([('tin','TIN'), ('nvat','NVAT'), ('other','Other')], 'Identification Type', required=True), + 'other': fields.char('Other Qlf', size=16, help="Description of a Identification Type"), + 'comments': fields.text('Comments'), } def _get_partners(self, cursor, user, context=None): @@ -156,6 +159,7 @@ class partner_vat_list_13(osv.osv_memory): _defaults={ # TODO the referenced model has been deleted at revno 4672.1.2. # 'partner_ids': _get_partners + 'identification_type' : 'tin' } def create_xml(self, cursor, user, ids, context=None): @@ -166,7 +170,7 @@ class partner_vat_list_13(osv.osv_memory): obj_fyear = self.pool.get('account.fiscalyear') obj_addr = self.pool.get('res.partner.address') obj_vat_lclient = self.pool.get('vat.listing.clients') - + seq_controlref = obj_sequence.get(cursor, user, 'controlref') seq_declarantnum = obj_sequence.get(cursor, user, 'declarantnum') obj_cmpny = obj_users.browse(cursor, user, user, context=context).company_id @@ -177,6 +181,7 @@ class partner_vat_list_13(osv.osv_memory): company_vat = company_vat.replace(' ','').upper() SenderId = company_vat[2:] + issued_by = company_vat[:2] cref = SenderId + seq_controlref dnum = cref + seq_declarantnum #obj_year= obj_fyear.browse(cursor, user, context['fyear'], context=context) @@ -189,7 +194,7 @@ class partner_vat_list_13(osv.osv_memory): name = ads.name or '' city = obj_addr.get_city(cursor, user, ads.id) - zip = obj_addr.browse(cursor, user, ads.id, context=context).zip + zip = obj_addr.browse(cursor, user, ads.id, context=context).zip or '' if not city: city = '' if ads.street: @@ -198,16 +203,27 @@ class partner_vat_list_13(osv.osv_memory): street += ads.street2 if ads.country_id: country = ads.country_id.code - + + data = self.read(cursor, user, ids)[0] + other = data['other'] or '' sender_date = time.strftime('%Y-%m-%d') comp_name = obj_cmpny.name - data_file = '\n\n' - data_comp = '\n\n\t'+SenderId+'\n\t'+ name +'\n\t'+ street +'\n\t'+ zip +'\n\t'+ city +'\n\t'+ country +'\n\t'+ email +'\n\t'+ phone +'\n' - data_period = '\n' + context['year'] +' \n\n' + data_file = '\n' + data_file += '\n\t' + data_file += '\n\t\t'+company_vat+'' + data_file += '\n\t\t'+ comp_name +'' + data_file += '\n\t\t'+ street +'' + data_file += '\n\t\t'+ zip +'' + data_file += '\n\t\t'+ city +'' + data_file += '\n\t\t'+ country +'' + data_file += '\n\t\t'+ email +'' + data_file += '\n\t\t'+ phone +'' + data_file += '\n\t' + data_file += '\n\t' + data_comp = '\n\t\t \n\t\t\n\t\t\t'+SenderId+' \n\t\t\t'+ comp_name +' \n\t\t\t'+ street +' \n\t\t\t'+ zip +' \n\t\t\t'+ city +' \n\t\t\t'+ country +' \n\t\t\t'+ email +' \n\t\t\t'+ phone +' \n\t\t' + data_period = '\n\t\t' + context['year'] +'' error_message = [] - data = self.read(cursor, user, ids)[0] + for partner in data['partner_ids']: if isinstance(partner, list) and partner: datas.append(partner[2]) @@ -233,10 +249,9 @@ class partner_vat_list_13(osv.osv_memory): seq += 1 sum_tax += line['amount'] sum_turnover += line['turnover'] - data_clientinfo += '\n\n\t'+line['vat'].replace(' ','').upper()[2:] +'\n\t'+str(int(round(line['turnover'] * 100))) +'\n\t'+str(int(round(line['amount'] * 100))) +'\n' - data_decl ='\n' - data_decl +='\n\t' - data_file += data_decl + data_comp + str(data_period) + data_clientinfo + '\n\t\n\t\n\n' + data_clientinfo += '\n\t\t\n\t\t\t'+line['vat'].replace(' ','').upper()[2:] +'\n\t\t\t'+str(int(round(line['turnover'] * 100))) +'\n\t\t\t'+str(int(round(line['amount'] * 100))) +'\n\t\t' + data_decl ='\n\t' + data_file += data_decl + data_comp + str(data_period) + data_clientinfo + '\n\t\t \n\t\t'+data['comments']+'\n\t\n' msg = 'Save the File with '".xml"' extension.' file_save = base64.encodestring(data_file.encode('utf8')) self.write(cursor, user, ids, {'file_save':file_save, 'msg':msg, 'name':'vat_list.xml'}, context=context) diff --git a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.xml b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.xml index ff05e5ecefb..3b6679b9d61 100644 --- a/addons/l10n_be/wizard/l10n_be_partner_vat_listing.xml +++ b/addons/l10n_be/wizard/l10n_be_partner_vat_listing.xml @@ -1,63 +1,74 @@ - + + + Partner VAT Listing + partner.vat_13 + form + +
+