diff --git a/CHANGELOG b/CHANGELOG index ab985613c8..b55a073cba 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/minimal_chart.xml b/minimal_chart.xml index 3f39fde123..df51e6b23c 100644 --- a/minimal_chart.xml +++ b/minimal_chart.xml @@ -17,9 +17,7 @@ this repository contains the full copyright notices and license terms. --> COGS - - other diff --git a/minimal_chart_bg.xml b/minimal_chart_bg.xml index bc7345d05a..9c5cf80110 100644 --- a/minimal_chart_bg.xml +++ b/minimal_chart_bg.xml @@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. --> + - - other diff --git a/minimal_chart_ca.xml b/minimal_chart_ca.xml index fde2a48e6a..f431fe8a3f 100644 --- a/minimal_chart_ca.xml +++ b/minimal_chart_ca.xml @@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. --> + - - other diff --git a/minimal_chart_de.xml b/minimal_chart_de.xml index 45e792f33b..048ecd79e6 100644 --- a/minimal_chart_de.xml +++ b/minimal_chart_de.xml @@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. --> + - - other diff --git a/minimal_chart_en.xml b/minimal_chart_en.xml index 22a22d85c0..1b00dba8b4 100644 --- a/minimal_chart_en.xml +++ b/minimal_chart_en.xml @@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. --> + - - other diff --git a/minimal_chart_es.xml b/minimal_chart_es.xml index 304dff1f8f..ff65dfd2dd 100644 --- a/minimal_chart_es.xml +++ b/minimal_chart_es.xml @@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. --> + - - other diff --git a/minimal_chart_fr.xml b/minimal_chart_fr.xml index dd7f6385bc..f261281a98 100644 --- a/minimal_chart_fr.xml +++ b/minimal_chart_fr.xml @@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. --> + - - other diff --git a/minimal_chart_nl.xml b/minimal_chart_nl.xml index e419652531..15b4442f26 100644 --- a/minimal_chart_nl.xml +++ b/minimal_chart_nl.xml @@ -14,11 +14,10 @@ this repository contains the full copyright notices and license terms. --> COGS + - - other diff --git a/minimal_chart_pt.xml b/minimal_chart_pt.xml index b89dafb8ab..def717695f 100644 --- a/minimal_chart_pt.xml +++ b/minimal_chart_pt.xml @@ -17,9 +17,7 @@ this repository contains the full copyright notices and license terms. --> - - other diff --git a/minimal_chart_ru.xml b/minimal_chart_ru.xml index 69c64d8870..3acf525e4b 100644 --- a/minimal_chart_ru.xml +++ b/minimal_chart_ru.xml @@ -12,13 +12,12 @@ this repository contains the full copyright notices and license terms. --> + COGS - - other diff --git a/minimal_chart_sl.xml b/minimal_chart_sl.xml index e42268ee4d..6936eb1ff1 100644 --- a/minimal_chart_sl.xml +++ b/minimal_chart_sl.xml @@ -13,12 +13,11 @@ this repository contains the full copyright notices and license terms. --> + COGS - - other diff --git a/product.py b/product.py index 4a412d6080..a538ae538f 100644 --- a/product.py +++ b/product.py @@ -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']) diff --git a/tests/tools.py b/tests/tools.py index d78cd794f2..96b56195c3 100644 --- a/tests/tools.py +++ b/tests/tools.py @@ -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