modifications to the asset class
This commit is contained in:
parent
c80f4e250f
commit
081237b91b
|
@ -33,6 +33,7 @@ def register():
|
|||
account.CashflowTemplate,
|
||||
account.Cashflow,
|
||||
asset.Asset,
|
||||
asset.AssetLocation,
|
||||
account.Account,
|
||||
move.Move,
|
||||
move.Line,
|
||||
|
|
62
asset.py
62
asset.py
|
@ -1,9 +1,57 @@
|
|||
from dataclasses import Field, fields
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from datetime import timedelta
|
||||
|
||||
KINDLIST = {
|
||||
'1': {'name': 'Constructions and buildings', 'days': 16425},
|
||||
'2': {'name': 'Aqueduct, plant and networks', 'days': 14600},
|
||||
'3': {'name': 'Communication channels', 'days': 14600},
|
||||
'5': {'name': 'Fleet and air equipment', 'days': 10950},
|
||||
'6': {'name': 'Fleet and railway equipment', 'days': 7300},
|
||||
'7': {'name': 'Fleet and river equipment', 'days': 5475},
|
||||
'8': {'name': 'Weapons and surveillance equipment', 'days': 3650},
|
||||
'9': {'name': 'Electric equipment', 'days': 3650},
|
||||
'10': {'name': 'Fleet and ground transportation equipment', 'days': 3650},
|
||||
'11': {'name': 'Machinery, equipment', 'days': 3650},
|
||||
'12': {'name': 'Furniture and fixtures', 'days': 3650},
|
||||
'13': {'name': 'Scientific medical equipment', 'days': 2920},
|
||||
'14': {'name': 'Containers, packaging and tools', 'days': 1825},
|
||||
'15': {'name': 'Computer equipment', 'days': 1825},
|
||||
'16': {'name': 'Data processing networks', 'days': 1825},
|
||||
'17': {'name': 'Communication equipment', 'days': 1825},
|
||||
}
|
||||
|
||||
|
||||
class AssetLocation(ModelView, ModelSQL):
|
||||
'Location Asset'
|
||||
__name__ = 'account_col.asset_location'
|
||||
|
||||
name = fields.Char('name')
|
||||
address = fields.Char('address')
|
||||
|
||||
|
||||
|
||||
|
||||
class Asset(metaclass=PoolMeta):
|
||||
__name__ = 'account.asset'
|
||||
|
||||
kind = fields.Selection('get_kind_list','Kind')
|
||||
location = fields.Many2One('account_col.asset_location', "Location")
|
||||
type = fields.Selection([
|
||||
('AFP' ,'Activo fijo propios'),
|
||||
('CD', 'Comodato'),
|
||||
('AC', 'Activo Controlado'),], 'Type')
|
||||
code = fields.Char('Code')
|
||||
|
||||
@fields.depends('kind')
|
||||
def on_change_with_end_date(self, name=None):
|
||||
if self.kind:
|
||||
print(self.kind)
|
||||
days = KINDLIST[self.kind]['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')
|
||||
|
@ -13,3 +61,17 @@ class Asset(metaclass=PoolMeta):
|
|||
if line.account.type.statement == 'income':
|
||||
line.party = company[0].party
|
||||
return move
|
||||
|
||||
@classmethod
|
||||
def get_kind_list(cls):
|
||||
return [(k,v['name']) for k,v in KINDLIST.items()]
|
||||
|
||||
|
||||
@classmethod
|
||||
def create_lines(cls, assets):
|
||||
for asset in assets:
|
||||
if asset.type == 'AC':
|
||||
continue
|
||||
super(Asset, cls).create_lines([asset])
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- 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>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="asset_view_form">
|
||||
<field name="model">account.asset</field>
|
||||
<field name="inherit" ref="account_asset.asset_view_form"/>
|
||||
<field name="name">asset_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- 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>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="asset_location_view_list">
|
||||
<field name="model">account_col.asset_location</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">Asset location list</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="asset_location_view_form">
|
||||
<field name="model">account_col.asset_location</field>
|
||||
<field name="type">form</field>
|
||||
<field name="priority" eval="10"/>
|
||||
<field name="name">Asset location form</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
11
invoice.py
11
invoice.py
|
@ -15,9 +15,9 @@ from trytond.modules.company import CompanyReport
|
|||
from trytond.exceptions import UserError
|
||||
|
||||
from .exceptions import (
|
||||
NotificationAuthError, NotificationAuthWarning,
|
||||
InvalidTypeInvoiceError, NotificationAdvanceWarning,
|
||||
)
|
||||
NotificationAuthError, NotificationAuthWarning, InvalidTypeInvoiceError,
|
||||
NotificationAdvanceWarning,
|
||||
)
|
||||
|
||||
conversor = None
|
||||
try:
|
||||
|
@ -254,9 +254,6 @@ class Invoice(metaclass=PoolMeta):
|
|||
to_reconcile_lines.append(ml)
|
||||
to_reconcile_lines.extend([l for l in origin.payment_lines])
|
||||
MoveLine.reconcile(to_reconcile_lines)
|
||||
else:
|
||||
lines = [l for l in invoice.move.lines if l.account == invoice.account]
|
||||
origin.add_payment_lines({origin: lines})
|
||||
|
||||
@classmethod
|
||||
def set_number(cls, invoices):
|
||||
|
@ -416,7 +413,7 @@ class Invoice(metaclass=PoolMeta):
|
|||
class InvoiceLine(ModelSQL, ModelView):
|
||||
__name__ = 'account.invoice.line'
|
||||
|
||||
@classmethod
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(InvoiceLine, cls).__setup__()
|
||||
|
||||
|
|
149
locale/es.po
149
locale/es.po
|
@ -70,6 +70,22 @@ msgctxt "field:account.account.cashflow.template,sequence:"
|
|||
msgid "Sequence"
|
||||
msgstr "Secuencia"
|
||||
|
||||
msgctxt "field:account.asset,code:"
|
||||
msgid "Code"
|
||||
msgstr "Código / Número Interno"
|
||||
|
||||
msgctxt "field:account.asset,kind:"
|
||||
msgid "Kind"
|
||||
msgstr "Clase"
|
||||
|
||||
msgctxt "field:account.asset,location:"
|
||||
msgid "Location"
|
||||
msgstr "Ubicación"
|
||||
|
||||
msgctxt "field:account.asset,type:"
|
||||
msgid "Type"
|
||||
msgstr "Tipo"
|
||||
|
||||
msgctxt "field:account.balance_sheet.col.context,company:"
|
||||
msgid "Company"
|
||||
msgstr "Empresa"
|
||||
|
@ -230,10 +246,18 @@ msgctxt "field:account.open_chart.start,period:"
|
|||
msgid "Period"
|
||||
msgstr "Período"
|
||||
|
||||
msgctxt "field:account.party_withholding.start,classification:"
|
||||
msgid "Certificate Report"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:account.party_withholding.start,company:"
|
||||
msgid "Company"
|
||||
msgstr "Compañía"
|
||||
|
||||
msgctxt "field:account.party_withholding.start,detailed:"
|
||||
msgid "Detailed"
|
||||
msgstr "Detallado"
|
||||
|
||||
msgctxt "field:account.party_withholding.start,end_period:"
|
||||
msgid "End Period"
|
||||
msgstr "Período Final"
|
||||
|
@ -306,6 +330,14 @@ msgctxt "field:account.tax,taxable_base:"
|
|||
msgid "Taxable Base"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:account_col.asset_location,address:"
|
||||
msgid "address"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:account_col.asset_location,name:"
|
||||
msgid "name"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:account_col.move.fix_number.start,number:"
|
||||
msgid "New Number"
|
||||
msgstr "Nuevo Número"
|
||||
|
@ -842,10 +874,6 @@ msgctxt "field:product.product,extra_tax:"
|
|||
msgid "Extra Tax"
|
||||
msgstr "Impuesto Adicional"
|
||||
|
||||
msgctxt "field:purchase.line,requests:"
|
||||
msgid "Requests"
|
||||
msgstr "Solicitudes"
|
||||
|
||||
msgctxt "field:purchase.update.start,date:"
|
||||
msgid "Date"
|
||||
msgstr "Fecha"
|
||||
|
@ -878,6 +906,10 @@ msgctxt "field:sale.sale,total_amount_words:"
|
|||
msgid "Total Amount Words"
|
||||
msgstr "Valor Total en Letras"
|
||||
|
||||
msgctxt "field:sale.sale,total_discount:"
|
||||
msgid "Total Discount"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:sale.sale,vouchers:"
|
||||
msgid "Vouchers"
|
||||
msgstr "Comprobantes"
|
||||
|
@ -914,9 +946,10 @@ msgctxt "help:account.account.cashflow,sequence:"
|
|||
msgid "Use to order the account cashflow"
|
||||
msgstr "Se usa para ordenar las cuentas"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "help:account.balance_sheet.col.context,posted:"
|
||||
msgid "Only include posted moves."
|
||||
msgstr "Sólo asientos contabilizados"
|
||||
msgstr "Muestra solo asientos contabilizados."
|
||||
|
||||
msgctxt "help:account.balance_sheet.col.context,utility_temp:"
|
||||
msgid "Permited see the utility without have any account move"
|
||||
|
@ -930,6 +963,10 @@ msgctxt "help:account.configuration,remove_tax:"
|
|||
msgid "Remove taxes on invoice if not exceeding the base"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:account.party_withholding.start,detailed:"
|
||||
msgid "Detailed the registers when applied tax"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:account.print_trial_balance.start,accounts_with_balance:"
|
||||
msgid "Show accounts with balances in previous periods"
|
||||
msgstr "Mostrar cuentas con saldos de periodos anteriores"
|
||||
|
@ -1030,6 +1067,10 @@ msgctxt "model:account.print_trial_balance.start,name:"
|
|||
msgid "Print Trial Balance"
|
||||
msgstr "Balance de Prueba"
|
||||
|
||||
msgctxt "model:account_col.asset_location,name:"
|
||||
msgid "Location Asset"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:account_col.move.fix_number.start,name:"
|
||||
msgid "Move Fix Number Start"
|
||||
msgstr "Arreglar Número de Asiento"
|
||||
|
@ -1138,10 +1179,6 @@ msgctxt "model:ir.action,name:act_party_fix_code"
|
|||
msgid "Party Fix Code"
|
||||
msgstr "Modificar Codigo de Tercero"
|
||||
|
||||
msgctxt "model:ir.action,name:act_purchase_force_draft"
|
||||
msgid "Force Draft"
|
||||
msgstr "Forzar a Borrador"
|
||||
|
||||
msgctxt "model:ir.action,name:act_purchase_generate_invoice"
|
||||
msgid "Generate Invoice"
|
||||
msgstr "Generar Factura"
|
||||
|
@ -1272,6 +1309,10 @@ msgctxt "model:ir.action,name:wizard_trial_balance_detailed"
|
|||
msgid "Trial Balance Detailed"
|
||||
msgstr "Balance de Prueba Detallado"
|
||||
|
||||
msgctxt "model:ir.message,text:msg_analytic_required"
|
||||
msgid "Missing required analytic"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.message,text:msg_auth_about_expire"
|
||||
msgid "The authorization is about to expire!"
|
||||
msgstr ""
|
||||
|
@ -1289,7 +1330,7 @@ msgid "This price list have lines of products defined"
|
|||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.message,text:msg_dont_write_account"
|
||||
msgid "Dont write account \"%(account)\" to kind view because have moves."
|
||||
msgid "Dont write account \"%(account)s\" to kind view because have moves."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:ir.message,text:msg_duplicated_reference_invoice"
|
||||
|
@ -4161,6 +4202,82 @@ msgctxt "selection:account.account.cashflow.template,display_balance:"
|
|||
msgid "Debit - Credit"
|
||||
msgstr "Debe - Haber"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Aqueduct, plant and networks"
|
||||
msgstr "Acueducto, planta y redes"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Communication channels"
|
||||
msgstr "Vías de comunicación"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Communication equipment"
|
||||
msgstr "Equipo de comunicación"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Constructions and buildings"
|
||||
msgstr "Construcciones y edificaciones"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Containers, packaging and tools"
|
||||
msgstr "Envases, empaques y herramientas"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Electric equipment"
|
||||
msgstr "Equipo eléctrico"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Fleet and air equipment"
|
||||
msgstr "Flota y equipo aéreo"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Fleet and ground transportation equipment"
|
||||
msgstr "Flota y equipo de transporte terrestre"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Fleet and railway equipment"
|
||||
msgstr "Flota y equipo férreo"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Fleet and river equipment"
|
||||
msgstr "Flota y equipo fluvial"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Furniture and fixtures"
|
||||
msgstr "Muebles y enseres"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Machinery, equipment"
|
||||
msgstr "Maquinaria, equipos"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "Weapons and surveillance equipment"
|
||||
msgstr "Armamento y equipo de vigilancia"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "computer equipment"
|
||||
msgstr "Equipo de computación"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "data processing networks"
|
||||
msgstr "Redes de procesamiento de datos"
|
||||
|
||||
msgctxt "selection:account.asset,kind:"
|
||||
msgid "scientific medical equipment"
|
||||
msgstr "Equipo médico científico"
|
||||
|
||||
msgctxt "selection:account.asset,type:"
|
||||
msgid "Activo Controlado"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:account.asset,type:"
|
||||
msgid "Activo fijo propios"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:account.asset,type:"
|
||||
msgid "Comodato"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:account.invoice,invoice_type:"
|
||||
msgid ""
|
||||
|
@ -4194,9 +4311,10 @@ msgctxt "selection:account.invoice,invoice_type:"
|
|||
msgid "Nota Débito Eléctronica"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:account.invoice,invoice_type:"
|
||||
msgid "POS"
|
||||
msgstr ""
|
||||
msgstr "POS"
|
||||
|
||||
msgctxt "selection:account.invoice,invoice_type:"
|
||||
msgid "Venta Electronica"
|
||||
|
@ -4235,9 +4353,10 @@ msgctxt "selection:account.invoice.authorization,kind:"
|
|||
msgid "Nota Débito Eléctronica"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:account.invoice.authorization,kind:"
|
||||
msgid "POS"
|
||||
msgstr ""
|
||||
msgstr "POS"
|
||||
|
||||
msgctxt "selection:account.invoice.authorization,kind:"
|
||||
msgid "Venta Electronica"
|
||||
|
@ -4534,9 +4653,10 @@ msgctxt "selection:party.party,invoice_type:"
|
|||
msgid "Nota Débito Eléctronica"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:party.party,invoice_type:"
|
||||
msgid "POS"
|
||||
msgstr ""
|
||||
msgstr "POS"
|
||||
|
||||
msgctxt "selection:party.party,invoice_type:"
|
||||
msgid "Venta Electronica"
|
||||
|
@ -4662,9 +4782,10 @@ msgctxt "selection:sale.sale,invoice_type:"
|
|||
msgid "Nota Débito Eléctronica"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:sale.sale,invoice_type:"
|
||||
msgid "POS"
|
||||
msgstr ""
|
||||
msgstr "POS"
|
||||
|
||||
msgctxt "selection:sale.sale,invoice_type:"
|
||||
msgid "Venta Electronica"
|
||||
|
|
8
party.py
8
party.py
|
@ -110,7 +110,7 @@ class Party(ModelSQL, ModelView):
|
|||
born_city = fields.Many2One('party.city_code', 'City Born', domain=[
|
||||
('department', '=', Eval('born_subdivision')),
|
||||
], depends=['born_subdivision'])
|
||||
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Party, cls).__setup__()
|
||||
|
@ -119,7 +119,11 @@ class Party(ModelSQL, ModelView):
|
|||
('id_number_uniq', Unique(table, table.id_number),
|
||||
'Id Number already exists!'),
|
||||
]
|
||||
|
||||
cls.first_name.states['invisible'] = ~Eval('type_person').in_(['persona_natural'])
|
||||
cls.second_name.states['invisible'] = ~Eval('type_person').in_(['persona_natural'])
|
||||
cls.first_family_name.states['invisible'] = ~Eval('type_person').in_(['persona_natural'])
|
||||
cls.second_family_name.states['invisible'] = ~Eval('type_person').in_(['persona_natural'])
|
||||
|
||||
@classmethod
|
||||
def search_rec_name(cls, name, clause):
|
||||
parties = cls.search([
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
[tryton]
|
||||
version=6.0.8
|
||||
version=6.0.7
|
||||
depends:
|
||||
ir
|
||||
res
|
||||
party
|
||||
product
|
||||
account
|
||||
|
@ -12,8 +14,8 @@ depends:
|
|||
product_price_list
|
||||
account_payment
|
||||
account_voucher
|
||||
party_personal
|
||||
xml:
|
||||
asset.xml
|
||||
purchase.xml
|
||||
move.xml
|
||||
account.xml
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="/form/field[@name='depreciated_amount']" position="after">
|
||||
<label name="code"/>
|
||||
<field name="code"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/field[@name='code']" position="after">
|
||||
<label name="kind"/>
|
||||
<field name="kind"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='info']/field[@name='company']" position="after">
|
||||
<label name="type"/>
|
||||
<field name="type"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='info']/field[@name='customer_invoice_line']" position="after">
|
||||
<label name="location"/>
|
||||
<field name="location"/>
|
||||
</xpath>
|
||||
</data>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of this
|
||||
repository contains the full copyright notices and license terms. -->
|
||||
<form col="2">
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="address"/>
|
||||
<field name="address"/>
|
||||
</form>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
<field name="direction"/>
|
||||
</tree>
|
|
@ -0,0 +1,7 @@
|
|||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="code"/>
|
||||
<field name="code"/>
|
||||
<field name="childs" colspan="4"/>
|
||||
</form>
|
Loading…
Reference in New Issue