Merge account kind and account type

issue4990
review68401002
This commit is contained in:
Cédric Krier
2019-03-24 18:00:01 +01:00
parent c2187bfb27
commit cad3c3f8fd
14 changed files with 15 additions and 26 deletions
+2
View File
@@ -1,3 +1,5 @@
* Enforce expense type for COGS account
Version 5.0.0 - 2018-10-01
* Bug fixes (see mercurial logs for details)
* Remove support for Python 2.7
-2
View File
@@ -17,9 +17,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="name" lang="sl">COGS</field>
<field name="type" ref="account.account_type_template_expense"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root"/>
<field name="kind">other</field>
</record>
</data>
+1 -2
View File
@@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="type" ref="account.account_type_template_expense_bg"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_bg"/>
<field name="kind">other</field>
</record>
</data>
+1 -2
View File
@@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="type" ref="account.account_type_template_expense_ca"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_ca"/>
<field name="kind">other</field>
</record>
</data>
+1 -2
View File
@@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="type" ref="account.account_type_template_expense_de"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_de"/>
<field name="kind">other</field>
</record>
</data>
+1 -2
View File
@@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="type" ref="account.account_type_template_expense_en"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_en"/>
<field name="kind">other</field>
</record>
</data>
+1 -2
View File
@@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="type" ref="account.account_type_template_expense_es"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_es"/>
<field name="kind">other</field>
</record>
</data>
+1 -2
View File
@@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="type" ref="account.account_type_template_expense_fr"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_fr"/>
<field name="kind">other</field>
</record>
</data>
+1 -2
View File
@@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">COGS</field>
<field name="type" ref="account.account_type_template_expense_nl"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_nl"/>
<field name="kind">other</field>
</record>
</data>
-2
View File
@@ -17,9 +17,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="type" ref="account.account_type_template_expense_pt"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_pt"/>
<field name="kind">other</field>
</record>
</data>
+1 -2
View File
@@ -12,13 +12,12 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">COGS</field>
<field name="type" ref="account.account_type_template_expense_ru"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_ru"/>
<field name="kind">other</field>
</record>
</data>
+1 -2
View File
@@ -13,12 +13,11 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">COGS</field>
<field name="type" ref="account.account_type_template_expense_sl"/>
<field name="reconcile" eval="True"/>
<field name="deferral" eval="True"/>
<field name="parent" ref="account.account_template_root_sl"/>
<field name="kind">other</field>
</record>
</data>
+2 -2
View File
@@ -15,7 +15,7 @@ class Category(metaclass=PoolMeta):
__name__ = 'product.category'
account_cogs = fields.MultiValue(fields.Many2One('account.account',
'Account Cost of Goods Sold', domain=[
('kind', '!=', 'view'),
('type.expense', '=', True),
('company', '=', Eval('context', {}).get('company', -1)),
],
states={
@@ -43,7 +43,7 @@ class CategoryAccount(metaclass=PoolMeta):
account_cogs = fields.Many2One(
'account.account', "Account Cost of Goods Sold",
domain=[
('kind', '!=', 'view'),
('type.expense', '=', True),
('company', '=', Eval('company', -1)),
],
depends=['company'])
+2 -2
View File
@@ -13,8 +13,8 @@ def add_cogs_accounts(accounts, company=None, config=None):
company = get_company()
accounts['cogs'], = Account.find([
('kind', '=', 'other'),
('type.expense', '=', True),
('id', '!=', accounts['expense'].id),
('company', '=', company.id),
('name', '=', 'COGS'),
])
return accounts