TaxLevelCode Type

This commit is contained in:
Alnus Tmp 2020-11-16 12:06:49 -05:00
parent 06b39c7c7b
commit 0374639330
6 changed files with 57 additions and 8 deletions

View File

@ -1,7 +1,7 @@
from trytond.pool import Pool
from . import party
from . import country
from . import rut
__all__ = ['register']
@ -9,8 +9,10 @@ def register():
Pool.register(
party.Party,
party.PartyIdentifier,
party.PartyTaxLevelCode,
party.Address,
country.Subdivision,
rut.TaxLevelCode,
module='account_co_co', type_='model')
Pool.register(
module='account_co_co', type_='wizard')

View File

@ -4,4 +4,16 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,subdivision_municipality:"
msgid "Municipality"
msgstr "Municipio"
msgstr "Municipio"
msgctxt "field:party.tax_level_code,code:"
msgid "Code"
msgstr "Código"
msgctxt "field:party.tax_level_code,name:"
msgid "Name"
msgstr "Nombre"
msgctxt "field:party.party,tax_level_code:"
msgid "TaxLevelCode"
msgstr "Responsabilidades"

View File

@ -6,7 +6,7 @@ from trytond.exceptions import UserError
logger = logging.getLogger(__name__)
__all__ = ['PartyIdentifier','Party','ContactMechanism','Address']
__all__ = ['PartyIdentifier','Party','ContactMechanism','Address','PartyTaxLevelCode']
CO_IDENTIFIERS = [
@ -65,7 +65,10 @@ class Party(ModelSQL,ModelView):
secondary_ciiu_code = fields.Char('Secondary CIIU Code', size=4)
other_ciiu_code = fields.Char('Other CIIU Code', size=4)
age = fields.Function(fields.Integer('Edad'),'on_change_with_age')
type_tax_identifier = fields.Function(fields.Selection('get_types_identifier','Tipo de Identidad'),'on_change_with_type_tax_identifier')
type_tax_identifier = fields.Function(fields.Selection('get_types_identifier',
'Tipo de Identidad'),
'on_change_with_type_tax_identifier')
tax_level_code =fields.Many2Many('party.party_tax_level_code','party', 'tax_level_code', "TaxLevelCode")
@staticmethod
@ -77,6 +80,13 @@ class Party(ModelSQL,ModelView):
#return ['11', '12', '13', '21', '22', '31', '41', '42', '43', '50', '91']
return ['31']
@classmethod
def get_tax_level_code(cls):
pool = Pool()
TaxLevelCode = pool.get('party.tax_level_code')
#raise UserError(str(TaxLevelCode.fields_get(['code'])['code']))
return TaxLevelCode.fields_get(['code'])['code']
@fields.depends('birth_date')
def on_change_with_age(self,name=None):
if self.birth_date:
@ -281,6 +291,15 @@ class PartyIdentifier(ModelSQL, ModelView):
return self.id
return ''
class PartyTaxLevelCode(ModelSQL, ModelView):
"Party Tax Level Code"
__name__ = 'party.party_tax_level_code'
party = fields.Many2One('party.party', 'Party', select=True)
tax_level_code = fields.Many2One('party.tax_level_code', 'TaxLevelCode', select=True)
class ContactMechanism(sequence_ordered(), ModelSQL, ModelView):
"Contact Mechanism"
__name__ = 'party.contact_mechanism'

View File

@ -2,8 +2,8 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<!-- Inicio Party -->
<record model="ir.ui.view" id="party_view_form">
<!-- Inicio Party -->
<record model="ir.ui.view" id="party_view_form">
<field name="model">party.party</field>
<field name="inherit" ref="party.party_view_form"/>
<field name="name">party_form</field>
@ -13,6 +13,18 @@ this repository contains the full copyright notices and license terms. -->
<field name="inherit" ref="party.party_view_tree"/>
<field name="name">party_tree</field>
</record>
<record model="ir.ui.view" id="party_tax_level_code_view_tree">
<field name="model">party.tax_level_code</field>
<field name="type">tree</field>
<field name="name">party_tax_level_code_tree</field>
</record>
<record model="ir.ui.view" id="party_tax_level_code_view_form">
<field name="model">party.tax_level_code</field>
<field name="type">form</field>
<field name="name">party_tax_level_code_form</field>
</record>
<!-- Fin Party -->
<!-- Inicio Identification -->
<record model="ir.ui.view" id="identifier_view_form">
@ -26,4 +38,4 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">identifier_tree</field>
</record>
<!-- Fin Identification -->
</tryton>
</tryton>

View File

@ -7,6 +7,8 @@ depends:
xml:
party.xml
address.xml
rut.xml
subdivisions_colombia.xml
municipalities_colombia.xml
address_subdivision_types_colombia.xml
tipo_responsabilidad.xml

View File

@ -45,7 +45,9 @@
<field name="secondary_ciiu_code"/>
<label name="other_ciiu_code"/>
<field name="other_ciiu_code"/>
</page>
<label name="tax_level_code"/>
<field name="tax_level_code"/>
</page>
</xpath>
</data>