diff --git a/CHANGELOG b/CHANGELOG
index 86b689ead8..717c018c4a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,5 @@
+* Enforce balance and income statement on stock accounts
+
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 f11a25d2fe..65e80a9151 100644
--- a/minimal_chart.xml
+++ b/minimal_chart.xml
@@ -18,6 +18,8 @@ this repository contains the full copyright notices and license terms. -->
Popisi
+ balance
+
@@ -34,10 +36,24 @@ this repository contains the full copyright notices and license terms. -->
Zaloga
-
-
- stock
+
+
+
+ Stock Expense
+ Разход на акции
+ Despeses de valors
+ Lagerkosten
+ Gastos de Stock
+ Variation des stocks
+ Voorraad
+ Despesa de estoque
+ Расходы на акции
+ Stroški zalog
+
+ income
+
+
Estoque do Fornecedor
Stock Supplier
Zaloga dobavitelja
-
+
-
- stock
@@ -71,12 +84,8 @@ this repository contains the full copyright notices and license terms. -->
Estoque do Cliente
Stock Customer
Zaloga kupca
-
-
-
+
- stock
Estoque da Produção
Stock Production
Zaloga proizvodnje
-
-
-
+
- stock
Estoque de Achados e Perdidos
Stock Lost and Found
Zaloga izgubljeno/najdeno
-
-
-
+
- stock
diff --git a/minimal_chart_bg.xml b/minimal_chart_bg.xml
index 8a39e4d960..bb9c41175b 100644
--- a/minimal_chart_bg.xml
+++ b/minimal_chart_bg.xml
@@ -14,7 +14,10 @@ this repository contains the full copyright notices and license terms. -->
+
+ balance
+
@@ -28,11 +31,26 @@ this repository contains the full copyright notices and license terms. -->
+
-
-
- stock
+
+
+
+
+ Разход на акции
+
+
+
+
+
+
+
+
+
+ income
+
+
@@ -45,11 +63,10 @@ this repository contains the full copyright notices and license terms. -->
-
+
+
-
- stock
@@ -61,11 +78,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -78,11 +93,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -95,11 +108,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
diff --git a/minimal_chart_ca.xml b/minimal_chart_ca.xml
index 0b9798d65e..41a27cca97 100644
--- a/minimal_chart_ca.xml
+++ b/minimal_chart_ca.xml
@@ -14,7 +14,10 @@ this repository contains the full copyright notices and license terms. -->
+
+ balance
+
@@ -28,11 +31,26 @@ this repository contains the full copyright notices and license terms. -->
+
-
-
- stock
+
+
+
+
+
+ Despeses de valors
+
+
+
+
+
+
+
+
+ income
+
+
@@ -45,11 +63,10 @@ this repository contains the full copyright notices and license terms. -->
-
+
+
-
- stock
@@ -61,11 +78,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -78,11 +93,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -95,11 +108,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
diff --git a/minimal_chart_de.xml b/minimal_chart_de.xml
index f774e97b18..21f4a2c0c1 100644
--- a/minimal_chart_de.xml
+++ b/minimal_chart_de.xml
@@ -14,7 +14,10 @@ this repository contains the full copyright notices and license terms. -->
+
+ balance
+
@@ -28,11 +31,26 @@ this repository contains the full copyright notices and license terms. -->
+
-
-
- stock
+
+
+
+
+
+
+ Lagerkosten
+
+
+
+
+
+
+
+ income
+
+
@@ -45,11 +63,10 @@ this repository contains the full copyright notices and license terms. -->
-
+
+
-
- stock
@@ -61,11 +78,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -78,11 +93,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -95,11 +108,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
diff --git a/minimal_chart_en.xml b/minimal_chart_en.xml
index 9ed6658a51..bdcc08530b 100644
--- a/minimal_chart_en.xml
+++ b/minimal_chart_en.xml
@@ -14,7 +14,10 @@ this repository contains the full copyright notices and license terms. -->
+
+ balance
+
@@ -28,11 +31,26 @@ this repository contains the full copyright notices and license terms. -->
+
-
-
- stock
+
+
+
+ Stock Expense
+
+
+
+
+
+
+
+
+
+
+ income
+
+
@@ -45,11 +63,10 @@ this repository contains the full copyright notices and license terms. -->
-
+
+
-
- stock
Stock Customer
@@ -61,11 +78,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -78,11 +93,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -95,11 +108,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
diff --git a/minimal_chart_es.xml b/minimal_chart_es.xml
index 1534bc9f17..a5e4a70e92 100644
--- a/minimal_chart_es.xml
+++ b/minimal_chart_es.xml
@@ -14,7 +14,10 @@ this repository contains the full copyright notices and license terms. -->
+
+ balance
+
@@ -28,11 +31,26 @@ this repository contains the full copyright notices and license terms. -->
+
-
-
- stock
+
+
+
+
+
+
+
+ Gastos de Stock
+
+
+
+
+
+
+ income
+
+
@@ -45,11 +63,10 @@ this repository contains the full copyright notices and license terms. -->
-
+
+
-
- stock
@@ -61,11 +78,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -78,11 +93,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -95,11 +108,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
diff --git a/minimal_chart_fr.xml b/minimal_chart_fr.xml
index fa9118df20..74c30a6986 100644
--- a/minimal_chart_fr.xml
+++ b/minimal_chart_fr.xml
@@ -14,7 +14,10 @@ this repository contains the full copyright notices and license terms. -->
+
+ balance
+
@@ -28,11 +31,26 @@ this repository contains the full copyright notices and license terms. -->
+
-
-
- stock
+
+
+
+
+
+
+
+
+ Variation des stocks
+
+
+
+
+
+ income
+
+
@@ -45,11 +63,10 @@ this repository contains the full copyright notices and license terms. -->
-
+
+
-
- stock
@@ -61,11 +78,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -78,11 +93,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
@@ -95,11 +108,9 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
+
+
- stock
diff --git a/minimal_chart_nl.xml b/minimal_chart_nl.xml
index aca0cd2693..b88b9211cb 100644
--- a/minimal_chart_nl.xml
+++ b/minimal_chart_nl.xml
@@ -14,7 +14,10 @@ this repository contains the full copyright notices and license terms. -->
Inventories
+
+ balance
+
@@ -28,11 +31,26 @@ this repository contains the full copyright notices and license terms. -->
Voorraad
+
-
-
- stock
+
+
+
+
+
+
+
+
+
+ Voorraad
+
+
+
+
+ income
+
+
@@ -45,11 +63,10 @@ this repository contains the full copyright notices and license terms. -->
Stock Supplier
-
+
+
-
- stock
@@ -61,11 +78,9 @@ this repository contains the full copyright notices and license terms. -->
Stock Customer
-
-
-
+
+
- stock
@@ -78,11 +93,9 @@ this repository contains the full copyright notices and license terms. -->
Stock Production
-
-
-
+
+
- stock
@@ -95,11 +108,9 @@ this repository contains the full copyright notices and license terms. -->
Stock Lost and Found
-
-
-
+
+
- stock
diff --git a/minimal_chart_pt.xml b/minimal_chart_pt.xml
index f28306fd14..5b4c5631a6 100644
--- a/minimal_chart_pt.xml
+++ b/minimal_chart_pt.xml
@@ -16,6 +16,8 @@ this repository contains the full copyright notices and license terms. -->
+ balance
+
@@ -31,10 +33,24 @@ this repository contains the full copyright notices and license terms. -->
-
-
- stock
+
+
+
+
+
+
+
+
+
+
+ Despesa de estoque
+
+
+
+ income
+
+
@@ -48,11 +64,9 @@ this repository contains the full copyright notices and license terms. -->
Estoque do Fornecedor
-
+
-
- stock
@@ -65,11 +79,8 @@ this repository contains the full copyright notices and license terms. -->
Estoque do Cliente
-
-
-
+
- stock
@@ -83,11 +94,8 @@ this repository contains the full copyright notices and license terms. -->
Estoque da Produção
-
-
-
+
- stock
@@ -101,11 +109,8 @@ this repository contains the full copyright notices and license terms. -->
Estoque de Achados e Perdidos
-
-
-
+
- stock
diff --git a/minimal_chart_ru.xml b/minimal_chart_ru.xml
index 6e1a780694..8ee9c87577 100644
--- a/minimal_chart_ru.xml
+++ b/minimal_chart_ru.xml
@@ -12,9 +12,12 @@ this repository contains the full copyright notices and license terms. -->
+
Инвентаризация
+ balance
+
@@ -26,13 +29,28 @@ this repository contains the full copyright notices and license terms. -->
+
Хранилище
-
-
- stock
+
+
+
+
+
+
+
+
+
+
+
+ Расходы на акции
+
+
+ income
+
+
@@ -43,13 +61,12 @@ this repository contains the full copyright notices and license terms. -->
+
Stock Supplier
-
+
-
- stock
@@ -59,13 +76,11 @@ this repository contains the full copyright notices and license terms. -->
+
Stock Customer
-
-
-
+
- stock
@@ -76,13 +91,11 @@ this repository contains the full copyright notices and license terms. -->
+
Stock Production
-
-
-
+
- stock
@@ -93,13 +106,11 @@ this repository contains the full copyright notices and license terms. -->
+
Stock Lost and Found
-
-
-
+
- stock
diff --git a/minimal_chart_sl.xml b/minimal_chart_sl.xml
index d43c2d6fd9..7d3c0f70fa 100644
--- a/minimal_chart_sl.xml
+++ b/minimal_chart_sl.xml
@@ -13,8 +13,11 @@ this repository contains the full copyright notices and license terms. -->
+
Popisi
+ balance
+
@@ -27,12 +30,27 @@ this repository contains the full copyright notices and license terms. -->
+
Zaloga
-
-
- stock
+
+
+
+
+
+
+
+
+
+
+
+
+ Stroški zalog
+
+ income
+
+
@@ -44,12 +62,11 @@ this repository contains the full copyright notices and license terms. -->
+
Zaloga dobavitelja
-
+
-
- stock
@@ -60,12 +77,10 @@ this repository contains the full copyright notices and license terms. -->
+
Zaloga kupca
-
-
-
+
- stock
@@ -77,12 +92,10 @@ this repository contains the full copyright notices and license terms. -->
+
Zaloga proizvodnje
-
-
-
+
- stock
@@ -94,12 +107,10 @@ this repository contains the full copyright notices and license terms. -->
+
Zaloga izgubljeno/najdeno
-
-
-
+
- stock
diff --git a/product.py b/product.py
index 487e3ab741..0883eb2d9c 100644
--- a/product.py
+++ b/product.py
@@ -28,7 +28,7 @@ class Category(metaclass=PoolMeta):
account_stock = fields.MultiValue(fields.Many2One(
'account.account', "Account Stock",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
('company', '=', Eval('context', {}).get('company', -1)),
],
states={
@@ -40,7 +40,7 @@ class Category(metaclass=PoolMeta):
account_stock_supplier = fields.MultiValue(fields.Many2One(
'account.account', "Account Stock Supplier",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
('company', '=', Eval('context', {}).get('company', -1)),
],
states={
@@ -52,7 +52,7 @@ class Category(metaclass=PoolMeta):
account_stock_customer = fields.MultiValue(fields.Many2One(
'account.account', "Account Stock Customer",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
('company', '=', Eval('context', {}).get('company', -1)),
],
states={
@@ -64,7 +64,7 @@ class Category(metaclass=PoolMeta):
account_stock_production = fields.MultiValue(fields.Many2One(
'account.account', "Account Stock Production",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
('company', '=', Eval('context', {}).get('company', -1)),
],
states={
@@ -76,7 +76,7 @@ class Category(metaclass=PoolMeta):
account_stock_lost_found = fields.MultiValue(fields.Many2One(
'account.account', "Account Stock Lost and Found",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
('company', '=', Eval('context', {}).get('company', -1)),
],
states={
@@ -124,35 +124,40 @@ class CategoryAccount(metaclass=PoolMeta):
account_stock = fields.Many2One(
'account.account', "Account Stock",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
+ ('type.statement', '=', 'balance'),
('company', '=', Eval('company', -1)),
],
depends=['company'])
account_stock_supplier = fields.Many2One(
'account.account', "Account Stock Supplier",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
+ ('type.statement', '=', 'income'),
('company', '=', Eval('company', -1)),
],
depends=['company'])
account_stock_customer = fields.Many2One(
'account.account', "Account Stock Customer",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
+ ('type.statement', '=', 'income'),
('company', '=', Eval('company', -1)),
],
depends=['company'])
account_stock_production = fields.Many2One(
'account.account', "Account Stock Production",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
+ ('type.statement', '=', 'income'),
('company', '=', Eval('company', -1)),
],
depends=['company'])
account_stock_lost_found = fields.Many2One(
'account.account', "Account Stock Lost and Found",
domain=[
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
+ ('type.statement', '=', 'income'),
('company', '=', Eval('company', -1)),
],
depends=['company'])
@@ -259,6 +264,7 @@ class UpdateCostPriceShowMove(ModelView):
('company', 'in',
[Eval('context', {}).get('company', -1), None]),
('id', '!=', Eval('stock_account')),
+ ('type.stock', '=', True),
],
depends=['stock_account'], required=True)
description = fields.Char('Description')
diff --git a/tests/tools.py b/tests/tools.py
index 6e2f865fba..1efba508ba 100644
--- a/tests/tools.py
+++ b/tests/tools.py
@@ -13,7 +13,7 @@ def add_stock_accounts(accounts, company=None, config=None):
company = get_company()
stock_accounts = Account.find([
- ('kind', '=', 'stock'),
+ ('type.stock', '=', True),
('company', '=', company.id),
])
for account in stock_accounts: