[MERGE] Merge pap branch for l10n_be module, bug fixes on it

bzr revid: mra@mra-laptop-20100614091741-v00to5ssxh1ynkus
This commit is contained in:
Mustufa Rangwala 2010-06-14 14:47:41 +05:30
commit 8621f59c64
4 changed files with 22 additions and 9 deletions

View File

@ -36,6 +36,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
_columns = {
'name': fields.char('File Name', size=32),
'period_id': fields.many2one('account.period','Period', required=True),
'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', domain=[('parent_id', '=', False)]),
'msg': fields.text('File created', size=64, readonly=True),
'file_save': fields.binary('Save File'),
'ask_resitution': fields.boolean('Ask Restitution'),
@ -61,11 +62,16 @@ class l10n_be_vat_declaration(osv.osv_memory):
context = {}
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']
obj_company = obj_user.browse(cr, uid, uid, context=context).company_id
data_tax = self.browse(cr, uid, ids[0])
if data_tax.tax_code_id:
obj_company = data_tax.tax_code_id.company_id
else:
obj_company = obj_user.browse(cr, uid, uid, context=context).company_id
user_cmpny = obj_company.name
vat_no = obj_company.partner_id.vat
if not vat_no:
osv.except_osv(_('Data Insufficient'), _('No VAT Number Associated with Main Company!'))
raise osv.except_osv(_('Data Insufficient'), _('No VAT Number Associated with Main Company!'))
tax_code_ids = obj_tax_code.search(cr, uid, [], context=context)
ctx = context.copy()

View File

@ -13,25 +13,25 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Periodical VAT Declaration" >
<group height="220" width="330">
<group height="250" width="330">
<group>
<separator string="Declare Periodical VAT" colspan="2" /><newline/>
<field name="period_id" /><newline/>
<field name="tax_code_id" string="Company" widget="selection"/><newline/>
<field name="ask_resitution" colspan="2" align="1"/><newline/>
<field name="ask_payment" colspan="2"/><newline/>
<field name="client_nihil" colspan="2" string="Is Last Declaration"/><newline/><label/>
</group>
<newline/>
<group>
<button special="cancel" string="Close" icon="gtk-cancel"/>
<button icon="gtk-execute" name="create_xml" string="Create XML" type="object" default_focus="1" />
<button special="cancel" string="Close" icon="gtk-cancel"/>
</group>
</group>
</form>
</field>
</record>
<record id="view_vat_save" model="ir.ui.view">
<field name="name">Save XML</field>
<field name="model">l1on_be.vat.declaration</field>
@ -52,7 +52,7 @@
</form>
</field>
</record>
<record id="action_vat_declaration" model="ir.actions.act_window">
<field name="name">Vat Declaraion</field>
<field name="type">ir.actions.act_window</field>

View File

@ -51,6 +51,7 @@ 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)]),
'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),
@ -79,7 +80,11 @@ class partner_vat_intra(osv.osv_memory):
if context is None:
context = {}
data_cmpny = obj_user.browse(cursor, user, user).company_id
data_tax = self.browse(cursor, user, ids[0], context=context)
if data_tax.tax_code_id:
data_cmpny = data_tax.tax_code_id.company_id
else:
data_cmpny = obj_user.browse(cursor, user, user).company_id
data = self.read(cursor, user, ids)[0]
company_vat = data_cmpny.partner_id.vat
if not company_vat:

View File

@ -23,6 +23,8 @@
<newline/>
<field name="mand_id" colspan="4"/>
<newline/>
<field name="tax_code_id" string="Company" colspan="4" widget="selection"/>
<newline/>
</group>
<separator string="Periods" colspan="4"/>
<field name="period_ids" nolabel="1" colspan="4"/>
@ -33,8 +35,8 @@
</page>
</notebook>
<separator colspan="4"/><label/>
<button name="create_xml" string="Create XML" type="object" icon="gtk-execute"/>
<button special="cancel" string="Close" icon="gtk-cancel"/>
<button name="create_xml" string="Create XML" type="object" icon="gtk-execute"/>
</group>
</form>
</field>