Merge account kind and account type
issue4990 review68401002
This commit is contained in:
1 parent
b252f19bed
commit
dc238e9086
20 files changed
+336
-103
No files matched your search
@@ -1,3 +1,5 @@
|
||||
* Add asset on account type
|
||||
|
||||
Version 5.0.0 - 2018-10-01
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
* Allow to set when the depreciation move should be created
|
||||
|
||||
@@ -25,6 +25,8 @@ def register():
|
||||
account.Configuration,
|
||||
account.ConfigurationAssetSequence,
|
||||
account.ConfigurationAssetDate,
|
||||
account.AccountTypeTemplate,
|
||||
account.AccountType,
|
||||
account.Move,
|
||||
account.Period,
|
||||
account.Journal,
|
||||
|
||||
+39
-4
@@ -4,14 +4,11 @@ from trytond import backend
|
||||
from trytond.i18n import gettext
|
||||
from trytond.model import ModelSQL, fields
|
||||
from trytond.model.exceptions import AccessError
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pyson import Eval, If, Bool
|
||||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.tools.multivalue import migrate_property
|
||||
from trytond.modules.company.model import CompanyValueMixin
|
||||
|
||||
__all__ = ['Configuration', 'ConfigurationAssetSequence',
|
||||
'ConfigurationAssetDate', 'Move', 'Period', 'Journal']
|
||||
|
||||
asset_bymonthday = fields.Selection([
|
||||
('1', "First"),
|
||||
('-1', "Last"),
|
||||
@@ -122,6 +119,44 @@ class ConfigurationAssetDate(ModelSQL, CompanyValueMixin):
|
||||
return "12"
|
||||
|
||||
|
||||
def AccountTypeMixin(template=False):
|
||||
|
||||
class Mixin:
|
||||
fixed_asset = fields.Boolean(
|
||||
"Fixed Asset",
|
||||
domain=[
|
||||
If(Eval('statement') != 'balance',
|
||||
('fixed_asset', '=', False), ()),
|
||||
],
|
||||
states={
|
||||
'invisible': ((Eval('statement') != 'balance')
|
||||
| ~Eval('assets', True)),
|
||||
},
|
||||
depends=['statement', 'assets'])
|
||||
if not template:
|
||||
for fname in dir(Mixin):
|
||||
field = getattr(Mixin, fname)
|
||||
if not isinstance(field, fields.Field):
|
||||
continue
|
||||
field.states['readonly'] = (
|
||||
Bool(Eval('template', -1)) & ~Eval('template_override', False))
|
||||
return Mixin
|
||||
|
||||
|
||||
class AccountTypeTemplate(AccountTypeMixin(template=True), metaclass=PoolMeta):
|
||||
__name__ = 'account.account.type.template'
|
||||
|
||||
def _get_type_value(self, type=None):
|
||||
values = super()._get_type_value(type=type)
|
||||
if not type or type.fixed_asset != self.fixed_asset:
|
||||
values['fixed_asset'] = self.fixed_asset
|
||||
return values
|
||||
|
||||
|
||||
class AccountType(AccountTypeMixin(), metaclass=PoolMeta):
|
||||
__name__ = 'account.account.type'
|
||||
|
||||
|
||||
class Move(metaclass=PoolMeta):
|
||||
__name__ = 'account.move'
|
||||
|
||||
|
||||
+12
@@ -8,5 +8,17 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="inherit" ref="account.configuration_view_form"/>
|
||||
<field name="name">configuration_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="account_type_template_view_form">
|
||||
<field name="model">account.account.type.template</field>
|
||||
<field name="inherit" ref="account.account_type_template_view_form"/>
|
||||
<field name="name">account_type_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="account_type_view_form">
|
||||
<field name="model">account.account.type</field>
|
||||
<field name="inherit" ref="account.account_type_view_form"/>
|
||||
<field name="name">account_type_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
@@ -913,7 +913,7 @@ class AssetDepreciationTable(CompanyReport):
|
||||
|
||||
@cached_property
|
||||
def update_lines(self):
|
||||
filter_ = lambda l: (l.account.kind == 'other'
|
||||
filter_ = lambda l: (l.account.type.expense
|
||||
and self.start_date < l.move.date <= self.end_date)
|
||||
return list(filter(filter_,
|
||||
(l for m in self.asset.update_moves for l in m.lines)))
|
||||
|
||||
@@ -33,6 +33,13 @@ class InvoiceLine(metaclass=PoolMeta):
|
||||
'account_asset.msg_invoice_line_asset_unique'),
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def _account_domain(cls, type_):
|
||||
domain = super()._account_domain(type_)
|
||||
if type_ == 'in':
|
||||
domain.append(('type.fixed_asset', '=', True))
|
||||
return domain
|
||||
|
||||
@fields.depends('product', 'invoice', 'invoice_type',
|
||||
'_parent_invoice.invoice_date', '_parent_invoice.accounting_date')
|
||||
def on_change_product(self):
|
||||
|
||||
+23
-11
@@ -3,6 +3,25 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="account.account.type.template"
|
||||
id="account_type_template_fixed_assets">
|
||||
<field name="name" lang="en">Fixed Assets</field>
|
||||
<field name="name" lang="bg">дълготрайни активи</field>
|
||||
<field name="name" lang="ca">Actius fixos</field>
|
||||
<field name="name" lang="de">Anlagevermögen</field>
|
||||
<field name="name" lang="es">Activos fijos</field>
|
||||
<field name="name" lang="fr">Immobilisations</field>
|
||||
<field name="name" lang="nl">Vaste activa</field>
|
||||
<field name="name" lang="pt">Ativo permanente</field>
|
||||
<field name="name" lang="ru">Основные средства</field>
|
||||
<field name="name" lang="sl">Osnovna sredstva</field>
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record model="account.account.template"
|
||||
id="account_template_assets">
|
||||
<field name="name" lang="en">Assets</field>
|
||||
@@ -15,16 +34,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name" lang="pt">Ativos</field>
|
||||
<field name="name" lang="ru">Assets</field>
|
||||
<field name="name" lang="sl">Sredstva</field>
|
||||
<field name="type"
|
||||
ref="account.account_type_template_asset_long_term"/>
|
||||
<field name="type" ref="account_type_template_fixed_assets"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record model="account.account.template"
|
||||
id="account_template_depretiation">
|
||||
<record model="account.account.template" id="account_template_depretiation">
|
||||
<field name="name" lang="en">Depreciation</field>
|
||||
<field name="name" lang="bg">Depreciation</field>
|
||||
<field name="name" lang="ca">Amortització</field>
|
||||
@@ -35,12 +50,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name" lang="pt">Depreciação</field>
|
||||
<field name="name" lang="ru">Depreciation</field>
|
||||
<field name="name" lang="sl">Amortizacija</field>
|
||||
<field name="type"
|
||||
ref="account.account_type_template_asset_long_term"/>
|
||||
<field name="type" ref="account_type_template_fixed_assets"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+23
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_bg" model="account.account.type.template">
|
||||
|
||||
<field name="name">дълготрайни активи</field>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_bg"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_bg" model="account.account.template">
|
||||
|
||||
<field name="name">Assets</field>
|
||||
@@ -13,11 +31,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_bg"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_bg"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_bg"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_bg" model="account.account.template">
|
||||
@@ -30,11 +47,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_bg"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_bg"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_bg"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_bg"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+23
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_ca" model="account.account.type.template">
|
||||
|
||||
|
||||
<field name="name">Actius fixos</field>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_ca"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_ca" model="account.account.template">
|
||||
|
||||
|
||||
@@ -13,11 +31,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_ca"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_ca"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_ca"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_ca" model="account.account.template">
|
||||
@@ -30,11 +47,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_ca"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_ca"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_ca"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_ca"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+23
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_de" model="account.account.type.template">
|
||||
|
||||
|
||||
|
||||
<field name="name">Anlagevermögen</field>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_de"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_de" model="account.account.template">
|
||||
|
||||
|
||||
@@ -13,11 +31,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_de"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_de"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_de"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_de" model="account.account.template">
|
||||
@@ -30,11 +47,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_de"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_de"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_de"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_de"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+23
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_en" model="account.account.type.template">
|
||||
<field name="name">Fixed Assets</field>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_en"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_en" model="account.account.template">
|
||||
<field name="name">Assets</field>
|
||||
|
||||
@@ -13,11 +31,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_en"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_en"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_en"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_en" model="account.account.template">
|
||||
@@ -30,11 +47,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_en"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_en"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_en"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_en"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+23
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_es" model="account.account.type.template">
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Activos fijos</field>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_es"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_es" model="account.account.template">
|
||||
|
||||
|
||||
@@ -13,11 +31,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_es"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_es"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_es"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_es" model="account.account.template">
|
||||
@@ -30,11 +47,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_es"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_es"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_es"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_es"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+23
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_fr" model="account.account.type.template">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Immobilisations</field>
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_fr"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_fr" model="account.account.template">
|
||||
|
||||
|
||||
@@ -13,11 +31,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_fr"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_fr"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_fr"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_fr" model="account.account.template">
|
||||
@@ -30,11 +47,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_fr"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_fr"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_fr"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_fr"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+23
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_nl" model="account.account.type.template">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Vaste activa</field>
|
||||
|
||||
|
||||
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_nl"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_nl" model="account.account.template">
|
||||
|
||||
|
||||
@@ -13,11 +31,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Assets</field>
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_nl"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_nl"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_nl"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_nl" model="account.account.template">
|
||||
@@ -30,11 +47,10 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Depreciation</field>
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_nl"/>
|
||||
|
||||
<field name="type" ref="account_type_template_fixed_assets_nl"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_nl"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_nl"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+21
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_pt" model="account.account.type.template">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Ativo permanente</field>
|
||||
|
||||
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_pt"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_pt" model="account.account.template">
|
||||
|
||||
|
||||
@@ -14,11 +32,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Ativos</field>
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_pt"/>
|
||||
<field name="type" ref="account_type_template_fixed_assets_pt"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_pt"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_pt" model="account.account.template">
|
||||
@@ -32,11 +48,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="name">Depreciação</field>
|
||||
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_pt"/>
|
||||
<field name="type" ref="account_type_template_fixed_assets_pt"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_pt"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_pt"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+23
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_ru" model="account.account.type.template">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Основные средства</field>
|
||||
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_ru"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_ru" model="account.account.template">
|
||||
|
||||
|
||||
@@ -11,13 +29,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Assets</field>
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_ru"/>
|
||||
<field name="type" ref="account_type_template_fixed_assets_ru"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_ru"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_ru" model="account.account.template">
|
||||
@@ -28,13 +45,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Depreciation</field>
|
||||
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_ru"/>
|
||||
<field name="type" ref="account_type_template_fixed_assets_ru"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_ru"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_ru"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+23
-7
@@ -3,6 +3,24 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record id="account_type_template_fixed_assets_sl" model="account.account.type.template">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Osnovna sredstva</field>
|
||||
<field name="parent" ref="account.account_type_template_asset_long_term_sl"/>
|
||||
<field name="statement">balance</field>
|
||||
<field name="assets" eval="True"/>
|
||||
<field name="fixed_asset" eval="True"/>
|
||||
<field name="sequence" eval="10"/>
|
||||
</record>
|
||||
|
||||
<record id="account_template_assets_sl" model="account.account.template">
|
||||
|
||||
|
||||
@@ -12,12 +30,11 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Sredstva</field>
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_sl"/>
|
||||
<field name="type" ref="account_type_template_fixed_assets_sl"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account.account_template_root_sl"/>
|
||||
<field name="kind">expense</field>
|
||||
</record>
|
||||
|
||||
<record id="account_template_depretiation_sl" model="account.account.template">
|
||||
@@ -29,12 +46,11 @@ this repository contains the full copyright notices and license terms. -->
|
||||
|
||||
|
||||
|
||||
|
||||
<field name="name">Amortizacija</field>
|
||||
<field name="type" ref="account.account_type_template_asset_long_term_sl"/>
|
||||
<field name="type" ref="account_type_template_fixed_assets_sl"/>
|
||||
<field name="reconcile" eval="False"/>
|
||||
<field name="deferral" eval="True"/>
|
||||
<field name="parent" ref="account_template_assets_sl"/>
|
||||
<field name="kind">other</field>
|
||||
<field name="parent" ref="account.account_template_root_sl"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
+4
-4
@@ -14,7 +14,7 @@ class Category(metaclass=PoolMeta):
|
||||
__name__ = 'product.category'
|
||||
account_depreciation = fields.MultiValue(fields.Many2One('account.account',
|
||||
'Account Depreciation', domain=[
|
||||
('kind', '=', 'other'),
|
||||
('type.fixed_asset', '=', True),
|
||||
('company', '=', Eval('context', {}).get('company', -1)),
|
||||
],
|
||||
states={
|
||||
@@ -26,7 +26,7 @@ class Category(metaclass=PoolMeta):
|
||||
account_asset = fields.MultiValue(fields.Many2One('account.account',
|
||||
'Account Asset',
|
||||
domain=[
|
||||
('kind', '=', 'expense'),
|
||||
('type.fixed_asset', '=', True),
|
||||
('company', '=', Eval('context', {}).get('company', -1)),
|
||||
],
|
||||
states={
|
||||
@@ -59,14 +59,14 @@ class CategoryAccount(metaclass=PoolMeta):
|
||||
account_depreciation = fields.Many2One(
|
||||
'account.account', "Account Depreciation",
|
||||
domain=[
|
||||
('kind', '=', 'other'),
|
||||
('type.fixed_asset', '=', True),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
depends=['company'])
|
||||
account_asset = fields.Many2One(
|
||||
'account.account', "Account Asset",
|
||||
domain=[
|
||||
('kind', '=', 'expense'),
|
||||
('type.fixed_asset', '=', True),
|
||||
('company', '=', Eval('company', -1)),
|
||||
],
|
||||
depends=['company'])
|
||||
|
||||
+9
-13
@@ -12,18 +12,14 @@ def add_asset_accounts(accounts, company=None, config=None):
|
||||
if not company:
|
||||
company = get_company()
|
||||
|
||||
expense_accounts = Account.find([
|
||||
('kind', '=', 'expense'),
|
||||
accounts['asset'], = Account.find([
|
||||
('type.fixed_asset', '=', True),
|
||||
('name', '=', "Assets"),
|
||||
('company', '=', company.id),
|
||||
])
|
||||
for account in expense_accounts:
|
||||
if account.name == 'Expense':
|
||||
accounts['expense'] = account
|
||||
elif account.name == 'Assets':
|
||||
accounts['asset'] = account
|
||||
depreciation, = Account.find([
|
||||
('kind', '=', 'other'),
|
||||
('name', '=', 'Depreciation'),
|
||||
])
|
||||
accounts['depreciation'] = depreciation
|
||||
], limit=1)
|
||||
accounts['depreciation'], = Account.find([
|
||||
('type.fixed_asset', '=', True),
|
||||
('name', '=', "Depreciation"),
|
||||
('company', '=', company.id),
|
||||
], limit=1)
|
||||
return accounts
|
||||
@@ -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. -->
|
||||
<data>
|
||||
<xpath expr="//group[@id='checkboxes']" position="inside">
|
||||
<label name="fixed_asset"/>
|
||||
<field name="fixed_asset"/>
|
||||
</xpath>
|
||||
</data>
|
||||
Reference in new issue
Block a user