Minor fix
This commit is contained in:
parent
6a92c7857b
commit
0df8360351
29
asset.py
29
asset.py
|
@ -1,10 +1,10 @@
|
|||
from dataclasses import Field, fields
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from datetime import timedelta
|
||||
|
||||
KINDLIST = {
|
||||
'construccion': {'name': 'Constructions and buildings, blablablablab', 'days': 16425},
|
||||
'construccion': {
|
||||
'name': 'Constructions and buildings, blablablablab', 'days': 16425},
|
||||
'aqueduct': {'name': 'Aqueduct, plant and networks', 'days': 14600},
|
||||
'communication': {'name': 'Communication channels', 'days': 14600},
|
||||
'fleet_air': {'name': 'Fleet and air equipment', 'days': 10950},
|
||||
|
@ -12,14 +12,16 @@ KINDLIST = {
|
|||
'fleet_river': {'name': 'Fleet and river equipment', 'days': 5475},
|
||||
'weapons': {'name': 'Weapons and surveillance equipment', 'days': 3650},
|
||||
'electric': {'name': 'Electric equipment', 'days': 3650},
|
||||
'fleet_transportation': {'name': 'Fleet and ground transportation equipment', 'days': 3650},
|
||||
'fleet_transportation': {
|
||||
'name': 'Fleet and ground transportation equipment', 'days': 3650},
|
||||
'machinery': {'name': 'Machinery, equipment', 'days': 3650},
|
||||
'furniture': {'name': 'Furniture and fixtures', 'days': 3650},
|
||||
'scientific': {'name': 'Scientific medical equipment', 'days': 2920},
|
||||
'containers': {'name': 'Containers, packaging and tools', 'days': 1825},
|
||||
'computer': {'name': 'Computer equipment', 'days': 1825},
|
||||
'data': {'name': 'Data processing networks', 'days': 1825},
|
||||
'communication': {'name': 'Communication equipment', 'days': 1825},
|
||||
'communication_equipment': {
|
||||
'name': 'Communication equipment', 'days': 1825},
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,25 +43,21 @@ class DepreciationKind(ModelView, ModelSQL):
|
|||
|
||||
class Asset(metaclass=PoolMeta):
|
||||
__name__ = 'account.asset'
|
||||
|
||||
#kind = fields.Selection('get_kind_list','Kind')
|
||||
kind = fields.Many2One('account_col.depreciation_kind', 'Kind', required=True)
|
||||
location = fields.Many2One('account_col.asset_location', "Location")
|
||||
type = fields.Selection([
|
||||
('AFP' ,'Activo fijo propios'),
|
||||
('CD', 'Comodato'),
|
||||
('AC', 'Activo Controlado'),], 'Type', required=True)
|
||||
('AFP', 'Activo fijo propios'),
|
||||
('CD', 'Comodato'),
|
||||
('AC', 'Activo Controlado')
|
||||
], 'Type', required=True)
|
||||
code = fields.Char('Code')
|
||||
|
||||
@fields.depends('kind')
|
||||
def on_change_with_end_date(self, name=None):
|
||||
if self.kind:
|
||||
print(self.kind.name)
|
||||
#days = KINDLIST[self.kind]['days']
|
||||
days = 365 * self.kind.years
|
||||
return self.start_date + timedelta(days=days)
|
||||
return self.start_date + timedelta(days=days)
|
||||
|
||||
|
||||
def get_move(self, line):
|
||||
move = super(Asset, self).get_move(line)
|
||||
Company = Pool().get('company.company')
|
||||
|
@ -72,8 +70,7 @@ class Asset(metaclass=PoolMeta):
|
|||
|
||||
@classmethod
|
||||
def get_kind_list(cls):
|
||||
return [(k,v['name']) for k,v in KINDLIST.items()]
|
||||
|
||||
return [(k, v['name']) for k, v in KINDLIST.items()]
|
||||
|
||||
@classmethod
|
||||
def create_lines(cls, assets):
|
||||
|
@ -81,5 +78,3 @@ class Asset(metaclass=PoolMeta):
|
|||
if asset.type == 'AC' or asset.type == 'CD':
|
||||
continue
|
||||
super(Asset, cls).create_lines([asset])
|
||||
|
||||
|
|
@ -7,8 +7,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
position="after">
|
||||
</xpath> -->
|
||||
|
||||
<xpath
|
||||
expr="/form/notebook/page[@id='general']/field[@name='addresses']"
|
||||
<xpath expr="/form/notebook/page[@id='general']/field[@name='addresses']"
|
||||
position="before">
|
||||
<separator string="Identifier" colspan="4" id="identifier"/>
|
||||
<group colspan="4" col="6" id="group_fiscal_info">
|
||||
|
@ -49,7 +48,7 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<label name="invoice_type"/>
|
||||
<field name="invoice_type"/>
|
||||
</xpath>
|
||||
<xpath
|
||||
<xpath
|
||||
expr="/form/notebook/page[@id='personal_information']/notebook/page[@id='personal_info']/field[@name='nationality']"
|
||||
position="after">
|
||||
<label name="born_country"/>
|
||||
|
@ -58,5 +57,5 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="born_subdivision" widget="selection"/>
|
||||
<label name="born_city"/>
|
||||
<field name="born_city" widget="selection"/>
|
||||
</xpath>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in New Issue