changeset f571a71d81da in modules/account_stock_continental:6.0
details:
https://hg.tryton.org/modules/account_stock_continental?cmd=changeset&node=f571a71d81da
description:
Allow balance sheet account for stock IN/OUT
When anglo-saxon accounting is used, the stock IN/OUT is not necessary
booked
in the income statement but may stay in the balance sheet until the
COGS is
booked.
issue11004
review395071002
(grafted from b67caaed86d581afdfcb8b972ec497908df95354)
diffstat:
product.py | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diffs (80 lines):
diff -r f2ff15b8ec78 -r f571a71d81da product.py
--- a/product.py Fri Dec 10 22:28:35 2021 +0100
+++ b/product.py Fri Dec 10 22:35:57 2021 +0100
@@ -36,7 +36,6 @@
domain=[
('closed', '!=', True),
('type.stock', '=', True),
- ('type.statement', '=', 'income'),
('company', '=', Eval('context', {}).get('company', -1)),
],
states={
@@ -50,7 +49,6 @@
domain=[
('closed', '!=', True),
('type.stock', '=', True),
- ('type.statement', '=', 'income'),
('company', '=', Eval('context', {}).get('company', -1)),
],
states={
@@ -61,6 +59,18 @@
depends=['account_parent', 'accounting']))
@classmethod
+ def __setup__(cls):
+ pool = Pool()
+ CategoryAccount = pool.get('product.category.account')
+ super().__setup__()
+ for account in [cls.account_stock_in, cls.account_stock_out]:
+ account.domain = [
+ account.domain,
+ ('type.statement', 'in',
+ CategoryAccount.get_account_stock_type_statements()),
+ ]
+
+ @classmethod
def multivalue_model(cls, field):
pool = Pool()
if field in account_names:
@@ -108,7 +118,6 @@
domain=[
('closed', '!=', True),
('type.stock', '=', True),
- ('type.statement', '=', 'income'),
('company', '=', Eval('company', -1)),
],
depends=['company'])
@@ -117,12 +126,21 @@
domain=[
('closed', '!=', True),
('type.stock', '=', True),
- ('type.statement', '=', 'income'),
('company', '=', Eval('company', -1)),
],
depends=['company'])
@classmethod
+ def __setup__(cls):
+ super().__setup__()
+ for account in [cls.account_stock_in, cls.account_stock_out]:
+ account.domain = [
+ account.domain,
+ ('type.statement', 'in',
+ cls.get_account_stock_type_statements()),
+ ]
+
+ @classmethod
def __register__(cls, module_name):
exist = backend.TableHandler.table_exist(cls._table)
if exist:
@@ -149,6 +167,10 @@
super(CategoryAccount, cls)._migrate_property(
field_names, value_names, fields)
+ @classmethod
+ def get_account_stock_type_statements(cls):
+ return ['income']
+
class Template(metaclass=PoolMeta):
__name__ = 'product.template'