Turkesh Patel (openERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-addons9-accounting-apa-reporting-tpa 
into lp:~openerp-dev/openobject-addons/trunk-addons9-accounting-apa.

Requested reviews:
  Amit Patel (OpenERP) (apa-tiny)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons9-accounting-apa-reporting-tpa/+merge/124140

                     l10n_be
===================================================
--> improved code of periodical vat declaration wizard.
--> improve typo of warning.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons9-accounting-apa-reporting-tpa/+merge/124140
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-addons9-accounting-apa.
=== modified file 'l10n_be/__init__.py'
--- l10n_be/__init__.py	2011-01-14 00:11:01 +0000
+++ l10n_be/__init__.py	2012-09-13 09:31:19 +0000
@@ -19,7 +19,6 @@
 #
 ##############################################################################
 
-import company
 import wizard
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file

=== removed file 'l10n_be/company.py'
--- l10n_be/company.py	2012-01-18 10:18:48 +0000
+++ l10n_be/company.py	1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-from osv import osv
-
-class res_company(osv.osv):
-    _inherit = "res.company"
-    _description = 'Company'
-
-    def _get_default_ad(self, addresses):
-        name = email = phone = city = post_code = address = country_code = ""
-        for ads in addresses:
-            if ads.type == 'default':
-                city = ads.city or ""
-                post_code = ads.zip or ""
-                if ads.street:
-                    address = ads.street or ""
-                if ads.street2:
-                    address += " " + ads.street2
-                if ads.country_id:
-                    country_code = ads.country_id and ads.country_id.code or ""
-                name = ads.name or ""
-                email = ads.email or ""
-                phone = ads.phone or ""
-        return name, email, phone, city, post_code, address, country_code
-res_company()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'l10n_be/wizard/l10n_be_account_vat_declaration.py'
--- l10n_be/wizard/l10n_be_account_vat_declaration.py	2012-08-07 10:23:26 +0000
+++ l10n_be/wizard/l10n_be_account_vat_declaration.py	2012-09-13 09:31:19 +0000
@@ -45,8 +45,8 @@
         'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', domain=[('parent_id', '=', False)], required=True),
         'msg': fields.text('File created', size=64, readonly=True),
         'file_save': fields.binary('Save File'),
-        'ask_restitution': fields.boolean('Ask Restitution',help='It indicates whether a restitution is to made or not?'),
-        'ask_payment': fields.boolean('Ask Payment',help='It indicates whether a payment is to made or not?'),
+        'ask_restitution': fields.boolean('Ask Restitution',help='It indicates whether a restitution is to make or not?'),
+        'ask_payment': fields.boolean('Ask Payment',help='It indicates whether a payment is to make or not?'),
         'client_nihil': fields.boolean('Last Declaration, no clients in client listing', help='Tick this case only if it concerns only the last statement on the civil or cessation of activity: ' \
             'no clients to be included in the client listing.'),
         'comments': fields.text('Comments'),
@@ -70,6 +70,7 @@
         obj_tax_code = self.pool.get('account.tax.code')
         obj_acc_period = self.pool.get('account.period')
         obj_user = self.pool.get('res.users')
+        obj_partner = self.pool.get('res.partner')
         mod_obj = self.pool.get('ir.model.data')
 
         if context is None:
@@ -83,7 +84,7 @@
             obj_company = obj_user.browse(cr, uid, uid, context=context).company_id
         vat_no = obj_company.partner_id.vat
         if not vat_no:
-            raise osv.except_osv(_('Insufficient Data!'), _('No VAT Number Associated with Main Company.'))
+            raise osv.except_osv(_('insufficient data!'), _('no vat number associated with company.'))
         vat_no = vat_no.replace(' ','').upper()
         vat = vat_no[2:]
 
@@ -93,8 +94,9 @@
         ctx['period_id'] = data['period_id'][0]
         tax_info = obj_tax_code.read(cr, uid, tax_code_ids, ['code','sum_period'], context=ctx)
 
-        name = email = phone = address = post_code = city = country_code = ''
-        name, email, phone, city, post_code, address, country_code = self.pool.get('res.company')._get_default_ad(obj_company.partner_id)
+        default_address = obj_partner.address_get(cr, uid, [obj_company.partner_id.id])
+        default_address_id = default_address.get("default", obj_company.partner_id.id)
+        address_id= obj_partner.browse(cr, uid, default_address_id, context)
 
         account_period = obj_acc_period.browse(cr, uid, data['period_id'][0], context=context)
         issued_by = vat_no[:2]
@@ -106,21 +108,21 @@
         ending_month = account_period.date_stop[5:7]
         quarter = str(((int(starting_month) - 1) / 3) + 1)
 
-        if not email:
+        if not address_id.email:
             raise osv.except_osv(_('Insufficient Data!'),_('No email address associated with the company.'))
-        if not phone:
+        if not address_id.phone:
             raise osv.except_osv(_('Insufficient Data!'),_('No phone associated with the company.'))
         file_data = {
                         'issued_by': issued_by,
                         'vat_no': vat_no,
                         'only_vat': vat_no[2:],
                         'cmpny_name': obj_company.name,
-                        'address': address,
-                        'post_code': post_code,
-                        'city': city,
-                        'country_code': country_code,
-                        'email': email,
-                        'phone': phone.replace('.','').replace('/','').replace('(','').replace(')','').replace(' ',''),
+                        'address': "%s %s"%(address_id.street or "",address_id.street2 or ""),
+                        'post_code': address_id.zip or "",
+                        'city': address_id.city or "",
+                        'country_code': address_id.country_id and address_id.country_id.code or "",
+                        'email': address_id.email or "",
+                        'phone': address_id.phone.replace('.','').replace('/','').replace('(','').replace(')','').replace(' ',''),
                         'send_ref': send_ref,
                         'quarter': quarter,
                         'month': starting_month,

=== modified file 'l10n_be/wizard/l10n_be_partner_vat_listing.py'
--- l10n_be/wizard/l10n_be_partner_vat_listing.py	2012-08-07 10:23:26 +0000
+++ l10n_be/wizard/l10n_be_partner_vat_listing.py	2012-09-13 09:31:19 +0000
@@ -61,7 +61,7 @@
             company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
         period_ids = obj_period.search(cr, uid, [('date_start' ,'>=', date_start), ('date_stop','<=',date_stop), ('company_id','=',company_id)])
         if not period_ids:
-             raise osv.except_osv(_('Insufficient Data!'), _('No data for the selected year.'))
+             raise osv.except_osv(_('insufficient data!'), _('no data for the selected year.'))
 
         partners = []
         partner_ids = obj_partner.search(cr, uid, [('vat_subjected', '!=', False), ('vat','ilike','BE%')], context=context)

=== modified file 'l10n_be/wizard/l10n_be_vat_intra.py'
--- l10n_be/wizard/l10n_be_vat_intra.py	2012-08-07 10:23:26 +0000
+++ l10n_be/wizard/l10n_be_vat_intra.py	2012-09-13 09:31:19 +0000
@@ -108,7 +108,7 @@
         # Get Company vat
         company_vat = data_company.partner_id.vat
         if not company_vat:
-            raise osv.except_osv(_('Insufficient Data!'),_('No VAT number associated with the company.'))
+            raise osv.except_osv(_('insufficient data!'),_('no vat number associated with company.'))
         company_vat = company_vat.replace(' ','').upper()
         issued_by = company_vat[:2]
 

_______________________________________________
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