Bharat Devnani (Open ERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-l10n-be-annual-listing-of-vat-subjected-customers-bde
 into lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-l10n-be-annual-listing-of-vat-subjected-customers-bde/+merge/90373

Hello Sir,

I have converted the wizard according to new format.

Thanks & Regards,
Devnani Bharat R.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-l10n-be-annual-listing-of-vat-subjected-customers-bde/+merge/90373
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-l10n-be-annual-listing-of-vat-subjected-customers-bde.
=== modified file 'l10n_be/wizard/l10n_be_partner_vat_listing.py'
--- l10n_be/wizard/l10n_be_partner_vat_listing.py	2011-10-16 01:28:00 +0000
+++ l10n_be/wizard/l10n_be_partner_vat_listing.py	2012-01-27 06:03:27 +0000
@@ -28,6 +28,32 @@
 from tools.translate import _
 from osv import fields, osv
 
+class vat_listing_clients(osv.osv_memory):
+    
+    _name = 'vat.listing.clients'
+    _columns = {
+        'name': fields.char('Client Name', size=64),
+        'vat': fields.char('VAT', size=64),
+        'country': fields.char('Country', size=64),
+        'amount': fields.float('Amount'),
+        'turnover': fields.float('Turnover'),
+            }
+    
+    def name_get(self, cr, uid, ids, context=None):
+        if not len(ids):
+            return []
+        return [(r['id'], r['name'] or '' + ' - ' + r['vat'] or '') \
+                for r in self.read(cr, uid, ids, ['name', 'vat'],
+                    context, load='_classic_write')]
+
+    def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
+        client = self.search(cr, uid, [('vat', '=', name)]+args, limit=limit, context=context)
+        if not client:
+            client = self.search(cr, uid, [('name', 'ilike', '%%%s%%' % name)]+args, limit=limit, context=context)
+        return self.name_get(cr, uid, client, context=context)
+ 
+vat_listing_clients()
+
 class partner_vat_13(osv.osv_memory):
     """ Vat Listing """
     _name = "partner.vat_13"
@@ -118,10 +144,13 @@
     _name = "partner.vat.list_13"
     _columns = {
         # TODO the referenced model has been deleted at revno 4672.1.2.
-        #'partner_ids': fields.many2many('vat.listing.clients', 'vat_partner_rel', 'vat_id', 'partner_id', 'Clients', required=False, help='You can remove clients/partners which you do not want to show in xml file'),
+        'partner_ids': fields.many2many('vat.listing.clients', 'vat_partner_rel', 'vat_id', 'partner_id', 'Clients', required=False, help='You can remove clients/partners which you do not want to show in xml file'),
         '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):
@@ -130,6 +159,7 @@
     _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):
@@ -140,7 +170,7 @@
         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
@@ -151,35 +181,49 @@
 
         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)
-        street = zip_city = country = ''
+        street = city = country = ''
         addr = obj_partner.address_get(cursor, user, [obj_cmpny.partner_id.id], ['invoice'])
         if addr.get('invoice',False):
             ads = obj_addr.browse(cursor, user, [addr['invoice']], context=context)[0]
+            phone = ads.phone or ''
+            email = ads.email or ''
+            name = ads.name or ''
 
-            zip_city = obj_addr.get_city(cursor, user, ads.id)
-            if not zip_city:
-                zip_city = ''
+            city = obj_addr.get_city(cursor, user, ads.id)
+            zip = obj_addr.browse(cursor, user, ads.id, context=context).zip or ''
+            if not city:
+                city = ''
             if ads.street:
-                street = ads.street
+                street = ads.street + ' ' 
             if ads.street2:
                 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 = '<?xml version="1.0"?>\n<VatList xmlns="http://www.minfin.fgov.be/VatList"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; RecipientId="VAT-ADMIN" SenderId="'+ SenderId + '"'
-        data_file +=' ControlRef="'+ cref + '" MandataireId="'+ cref + '" SenderDate="'+ str(sender_date)+ '"'
-        data_file += ' VersionTech="1.3">'
-        data_file += '\n<AgentRepr DecNumber="1">\n\t<CompanyInfo>\n\t\t<VATNum>'+str(company_vat)+'</VATNum>\n\t\t<Name>'+ comp_name +'</Name>\n\t\t<Street>'+ street +'</Street>\n\t\t<CityAndZipCode>'+ zip_city +'</CityAndZipCode>'
-        data_file += '\n\t\t<Country>'+ country +'</Country>\n\t</CompanyInfo>\n</AgentRepr>'
-        data_comp = '\n<CompanyInfo>\n\t<VATNum>'+SenderId+'</VATNum>\n\t<Name>'+ comp_name +'</Name>\n\t<Street>'+ street +'</Street>\n\t<CityAndZipCode>'+ zip_city +'</CityAndZipCode>\n\t<Country>'+ country +'</Country>\n</CompanyInfo>'
-        data_period = '\n<Period>' + context['year'] +'</Period>'
+        data_file = '<?xml version="1.0"?>\n<ClientListingConsignment xmlns="http://www.minfin.fgov.be/ClientListingConsignment"; ClientListingsNbr="1">'
+        data_file += '\n\t<Representative>'
+        data_file += '\n\t\t<RepresentativeID identificationType="'+data['identification_type'].upper()+'" issuedBy="'+issued_by+'" otherQlf="'+other+'">'+company_vat+'</RepresentativeID>'
+        data_file += '\n\t\t<Name>'+ comp_name +'</Name>'
+        data_file += '\n\t\t<Street>'+ street +'</Street>'
+        data_file += '\n\t\t<PostCode>'+ zip +'</PostCode>'
+        data_file += '\n\t\t<City>'+ city +'</City>'
+        data_file += '\n\t\t<CountryCode>'+ country +'</CountryCode>'
+        data_file += '\n\t\t<EmailAddress>'+ email +'</EmailAddress>'
+        data_file += '\n\t\t<Phone>'+ phone +'</Phone>'
+        data_file += '\n\t</Representative>'
+        data_file += '\n\t<RepresentativeReference></RepresentativeReference>'
+        data_comp =  '\n\t\t<ReplacedClientListing></ReplacedClientListing> \n\t\t<Declarant>\n\t\t\t<VATNumber xmlns="http://www.minfin.fgov.be/InputCommon";>'+SenderId+'</VATNumber> \n\t\t\t<Name>'+ comp_name +'</Name> \n\t\t\t<Street>'+ street +'</Street> \n\t\t\t<PostCode>'+ zip +'</PostCode> \n\t\t\t<City>'+ city +'</City> \n\t\t\t<CountryCode>'+ country +'</CountryCode> \n\t\t\t<EmailAddress>'+ email +'</EmailAddress> \n\t\t\t<Phone>'+ phone +'</Phone> \n\t\t</Declarant>'
+        data_period = '\n\t\t<Period>' + context['year'] +'</Period>'
         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])
@@ -193,6 +237,11 @@
         if len(error_message):
             return 'Exception : \n' +'-'*50+'\n'+ '\n'.join(error_message)
         for line in datas:
+            vat_issued = line['vat'][:2]
+            if vat_issued == 'BE':
+                vat_issued = ''
+            else:
+                vat_issued = vat_issued
             if not line:
                 continue
             if line['turnover'] < context['limit_amount']:
@@ -200,10 +249,9 @@
             seq += 1
             sum_tax += line['amount']
             sum_turnover += line['turnover']
-            data_clientinfo += '\n<ClientList SequenceNum="'+str(seq)+'">\n\t<CompanyInfo>\n\t\t<VATNum>'+line['vat'].replace(' ','').upper()[2:] +'</VATNum>\n\t\t<Country>' + line['country'] +'</Country>\n\t</CompanyInfo>\n\t<Amount>'+str(int(round(line['amount'] * 100))) +'</Amount>\n\t<TurnOver>'+str(int(round(line['turnover'] * 100))) +'</TurnOver>\n</ClientList>'
-
-        data_decl ='\n<DeclarantList SequenceNum="1" DeclarantNum="'+ dnum + '" ClientNbr="'+ str(seq) +'" TurnOverSum="'+ str(int(round(sum_turnover * 100))) +'" TaxSum="'+ str(int(round(sum_tax * 100))) +'">'
-        data_file += data_decl + data_comp + str(data_period) + data_clientinfo + '\n</DeclarantList>\n</VatList>'
+            data_clientinfo += '\n\t\t<Client SequenceNumber="'+str(seq)+'">\n\t\t\t<CompanyVATNumber issuedby="'+vat_issued+'">'+line['vat'].replace(' ','').upper()[2:] +'</CompanyVATNumber>\n\t\t\t<TurnOver>'+str(int(round(line['turnover'] * 100))) +'</TurnOver>\n\t\t\t<VATAmount>'+str(int(round(line['amount'] * 100))) +'</VATAmount>\n\t\t</Client>'
+        data_decl ='\n\t<ClientListing SequenceNumber="1" ClientsNbr="'+ str(seq) +'" DeclarantReference="'+ dnum + '" TurnOverSum="'+ str(int(round(sum_turnover * 100))) +'" VATAmountSum="'+ str(int(round(sum_tax * 100))) +'">'
+        data_file += data_decl + data_comp + str(data_period) + data_clientinfo + '\n\t\t<FileAttachment></FileAttachment> \n\t\t<Comment>'+data['comments']+'</Comment>\n\t</ClientListing>\n</ClientListingConsignment>'
         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)

=== modified file 'l10n_be/wizard/l10n_be_partner_vat_listing.xml'
--- l10n_be/wizard/l10n_be_partner_vat_listing.xml	2011-05-05 14:33:29 +0000
+++ l10n_be/wizard/l10n_be_partner_vat_listing.xml	2012-01-27 06:03:27 +0000
@@ -1,63 +1,74 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <openerp>
-    <data>
-
-      <record id="view_partner_vat_listing_13" model="ir.ui.view">
-        <field name="name">Partner VAT Listing</field>
-        <field name="model">partner.vat_13</field>
-        <field name="type">form</field>
-        <field name="arch" type="xml">
-          <form string="Partner VAT Listing">
-            <label string="This wizard will create an XML file for VAT details and total invoiced amounts per partner." colspan="4"/>
-            <newline/>
-            <field name="year"/>
-            <newline/>
-            <field name="limit_amount"/>
-            <separator colspan="4"/>
-            <group colspan="4">
-              <button special="cancel" string="Cancel" icon="gtk-cancel"/>
-              <button colspan="1" name="get_partner" string="View Customers" type="object" icon="terp-partner"/>
-            </group>
-          </form>
-        </field>
-      </record>
-
-      <record id="action_partner_vat_listing_13" model="ir.actions.act_window">
-        <field name="name">Partner VAT Listing</field>
-        <field name="type">ir.actions.act_window</field>
-        <field name="res_model">partner.vat_13</field>
-        <field name="view_type">form</field>
-        <field name="view_mode">form</field>
-        <field name="view_id" ref="view_partner_vat_listing_13"/>
-        <field name="target">new</field>
-      </record>
-
-	    <menuitem name="Annual Listing Of VAT-Subjected Customers" parent="l10n_be.menu_finance_belgian_statement" action="action_partner_vat_listing_13" id="l10n_be.partner_vat_listing"/>
-
-      <record id="view_vat_listing_13" model="ir.ui.view">
-        <field name="name">Vat Listing</field>
-        <field name="model">partner.vat.list_13</field>
-        <field name="type">form</field>
-        <field name="arch" type="xml">
-          <form string="Select Fiscal Year">
-            <label string="You can remove customers which you do not want in exported xml file" colspan="4"/>
-            <separator string="Customers" colspan="4"/>
-            <field name="partner_ids" colspan="4" nolabel="1" default_focus="1" height="200" width="500"/>
-            <separator colspan="4"/>
-            <group colspan="4">
-              <button colspan="2" name="create_xml" string="Create XML" type="object" icon="gtk-execute"/>
-              <button colspan="2" name="print_vatlist" string="Print" type="object" icon="gtk-print"/>
-            </group>
-            <separator string="XML File has been Created." colspan="4"/>
-            <field name="msg" colspan="4" nolabel="1"/>
-            <field name="name"/>
-            <newline/>
-            <field name="file_save"/>
-            <separator colspan="4"/>
-            <button special="cancel" string="Close" icon="gtk-cancel"/>
-          </form>
-        </field>
-      </record>
-      
-    </data>
-</openerp>
\ No newline at end of file
+	<data>
+		<record id="view_partner_vat_listing_13" model="ir.ui.view">
+			<field name="name">Partner VAT Listing</field>
+			<field name="model">partner.vat_13</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+ 				<form string="Partner VAT Listing">
+					<label string="This wizard will create an XML file for VAT details and total invoiced amounts per partner." colspan="4"/>
+					<newline/>
+					<field name="year"/>
+					<newline/>
+					<field name="limit_amount"/>
+					<separator colspan="4"/>
+					<group colspan="4">
+						<button special="cancel" string="Cancel" icon="gtk-cancel"/>
+						<button colspan="1" name="get_partner" string="View Customers" type="object" icon="terp-partner"/>
+					</group>
+				</form>
+			</field>
+		</record>
+
+		<record id="action_partner_vat_listing_13" model="ir.actions.act_window">
+			<field name="name">Partner VAT Listing</field>
+			<field name="type">ir.actions.act_window</field>
+			<field name="res_model">partner.vat_13</field>
+			<field name="view_type">form</field>
+			<field name="view_mode">form</field>
+			<field name="view_id" ref="view_partner_vat_listing_13"/>
+			<field name="target">new</field>
+		</record>
+
+		<menuitem name="Annual Listing Of VAT-Subjected Customers" parent="l10n_be.menu_finance_belgian_statement" action="action_partner_vat_listing_13" id="l10n_be.partner_vat_listing"/>
+
+		<record id="view_vat_listing_13" model="ir.ui.view">
+			<field name="name">Vat Listing</field>
+			<field name="model">partner.vat.list_13</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Select Fiscal Year">
+					<notebook colspan="4">
+						<page string="Partners">
+							<label string="You can remove customers which you do not want in exported xml file" colspan="4"/>
+							<separator string="Customers" colspan="4"/>
+							<field name="partner_ids" colspan="4" nolabel="1" default_focus="1" height="200" width="500"/>
+						</page>
+						<page string="Details">
+							<group colspan="4">
+								<field name="identification_type"/>
+								<newline/>
+								<field name="other" attrs="{'invisible':[('identification_type','!=','other')], 'required': [('identification_type','=','other')]}"/>
+							</group>
+							<separator string="Comments" colspan="4"/>
+							<field name="comments" colspan="4" nolabel="1"/>
+						</page>
+					</notebook>
+					<separator colspan="4"/>
+					<group colspan="4">
+						<button colspan="2" name="create_xml" string="Create XML" type="object" icon="gtk-execute"/>
+						<button colspan="2" name="print_vatlist" string="Print" type="object" icon="gtk-print"/>
+					</group>
+					<separator string="XML File has been Created." colspan="4"/>
+					<field name="msg" colspan="4" nolabel="1"/>
+					<field name="name"/>
+					<newline/>
+					<field name="file_save"/>
+					<separator colspan="4"/>
+					<button special="cancel" string="Close" icon="gtk-cancel"/>
+				</form>
+			</field>
+		</record>
+	</data>
+</openerp>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to