Compare commits

..

51 commits

Author SHA1 Message Date
Frederik Jaeckel
064fec927e fix amounts on view-cashbooks to include non-asset-cashbooks 2024-01-20 18:15:31 +01:00
Frederik Jaeckel
12b5442f19 fix sorting/searcher of field 'yield_balance' 2024-01-03 21:38:33 +01:00
Frederik Jaeckel
6d9a5b080d add license 2023-12-31 11:23:22 +01:00
Frederik Jaeckel
728b2fa6c2 add sorting 2023-12-30 11:44:33 +01:00
Frederik Jaeckel
c38737076f add columns to cashbook tree/list-view 2023-12-30 11:18:49 +01:00
Frederik Jaeckel
4a23e1ae81 add update of cashbooks on update of asset-rates 2023-12-30 10:57:17 +01:00
Frederik Jaeckel
49d3a2fec5 cashbook: optimize for speed for checking rows 2023-12-29 23:09:00 +01:00
Frederik Jaeckel
ec97351db9 add worker-based precalculation of cashbook-values 2023-12-29 23:07:39 +01:00
Frederik Jaeckel
fb062243d6 remove caching 2023-12-23 10:44:55 +01:00
Frederik Jaeckel
82c390caae Tryton 7.0 2023-12-06 21:34:08 +01:00
Frederik Jaeckel
3d0ce89df8 columns optional 2023-12-06 20:04:52 +01:00
Frederik Jaeckel
8dafa0bce0 tests: formatting 2023-12-03 17:37:43 +01:00
Frederik Jaeckel
27c12d4ad1 formatting 2023-12-03 17:31:42 +01:00
Frederik Jaeckel
21b014183a Tryton 6.8: index, info, tests 2023-06-08 17:13:40 +02:00
Frederik Jaeckel
1f47dfe6b1 tests: add company to context 2023-06-08 16:00:36 +02:00
Frederik Jaeckel
1047345ae8 tests: formatting 2023-06-08 14:34:56 +02:00
Frederik Jaeckel
ad067475f8 formatting 2023-06-08 14:00:59 +02:00
Frederik Jaeckel
6c1fac8672 line: formatting, fix - on_change_with_quantity_digits() 2023-04-19 09:43:29 +02:00
Frederik Jaeckel
f7109b013f line: selection of digits for quantity 2023-04-17 12:01:51 +02:00
Frederik Jaeckel
e96aa6fad7 remove logging, add trytond.conf-settings 2023-03-05 10:26:39 +01:00
Frederik Jaeckel
da7fc9cb65 book: optimize query for speed 2023-03-04 21:21:54 +01:00
Frederik Jaeckel
e244e75d8a readme 2023-02-28 09:22:09 +01:00
Frederik Jaeckel
6bcb4efc2b fix: import + no symbol if None 2023-02-27 21:17:48 +01:00
Frederik Jaeckel
17a4499ac7 book:caching for line, settings: cache clear 2023-02-27 20:46:41 +01:00
Frederik Jaeckel
02bde17f6b book: add cache for asset-rates 2023-02-27 10:20:23 +01:00
Frederik Jaeckel
91b88a48e5 book: new field 'purchase_amount', optimize form
speedup: indexes, caching
2023-02-26 22:51:24 +01:00
Frederik Jaeckel
5e7552e589 line: fix exception if missing config; book: optimize form 2023-02-23 10:35:30 +01:00
Frederik Jaeckel
f95a9ed710 book: optimized field 'yield_balance' 2023-02-22 21:24:58 +01:00
Frederik Jaeckel
20f465ae3a book: added fields to book-form 2023-02-22 20:33:12 +01:00
Frederik Jaeckel
91de15e093 cashbook: yield-info prepared 2023-02-22 16:21:23 +01:00
Frederik Jaeckel
6177b5d691 line: add help, fix form 2023-02-21 22:36:20 +01:00
Frederik Jaeckel
0c60a8c313 line: tests... ok 2023-02-21 22:22:23 +01:00
Frederik Jaeckel
9f22341005 line: field 'trade_fee' ok + test 2023-02-21 12:57:10 +01:00
Frederik Jaeckel
fe07c4a17f line: fee tests ergänzt 2023-02-20 23:22:31 +01:00
Frederik Jaeckel
6b042bca3b line: field 'asset_gainloss' ok + test 2023-02-18 20:55:04 +01:00
Frederik Jaeckel
313892d2d5 line: gain/loss ok + test 2023-02-17 10:20:06 +01:00
Frederik Jaeckel
c82f37729b line: gain/loss field ... 2023-02-16 23:12:48 +01:00
Frederik Jaeckel
e0a2a0f9cb line: updated get_gainloss_data_sql + todos 2023-02-16 16:59:50 +01:00
Frederik Jaeckel
4e7d2c2ba9 add: field 'asset_gainloss' + searcher + test +todos 2023-02-15 22:34:52 +01:00
Frederik Jaeckel
a1ede23740 add: query for gain/loss 2023-02-14 23:03:12 +01:00
Frederik Jaeckel
3243ccc471 line: negate amount if splitline=spout - tests 2023-02-14 22:27:25 +01:00
Frederik Jaeckel
798da563ec field trade_fee + asset_dividend ok + searcher + test 2023-02-12 22:01:07 +01:00
Frederik Jaeckel
982f21f06e line: add fields 'Fee' + 'Dividend' - todos 2023-02-12 00:09:56 +01:00
Frederik Jaeckel
438035cca2 line: fix write() - get 'bookingtype' from line if not in values 2023-02-05 11:35:55 +01:00
Frederik Jaeckel
e38d02ff9d line/splitline: fixed selection of quantity-uom/digits 2023-02-01 14:29:48 +01:00
Frederik Jaeckel
e79c68e75b reconciliation: use 'quantity_digits' for digits of start/end-quantity 2023-01-30 09:25:44 +01:00
Frederik Jaeckel
ea7f114e94 line: add performance values to line-form 2023-01-29 23:16:22 +01:00
Frederik Jaeckel
9669a8d85b cashbook: view current_value/-ref on chasbooks with btype=None if
asset-cashbooks are below
2023-01-28 13:03:24 +01:00
Frederik Jaeckel
8156d521de book: asset-query ausgelagert 2023-01-24 21:25:29 +01:00
Frederik Jaeckel
8232f8042d line: fix transfer between cash-/asset-book with zero quantity 2023-01-23 22:29:41 +01:00
Frederik Jaeckel
ae8091bbdf line: fix rec_name 2023-01-22 10:28:09 +01:00
13 changed files with 62 additions and 101 deletions

View file

@ -9,7 +9,7 @@ pip install mds-cashbook-investment
Requires Requires
======== ========
- Tryton 6.0 - Tryton 7.0
How to How to
====== ======
@ -23,68 +23,6 @@ You can monitor trading fees, dividends and sales profits.
Changes Changes
======= =======
*6.0.14 - 19.01.2024* *7.0.0 - 06.12.2023*
- the amounts of the view cash books now include the amounts - compatibility to Tryton 7.0
of the generic cash books
*6.0.13 - 03.01.2024*
- fix: sorting/searcher of field yield-balance
*6.0.12 - 31.12.2023*
- remove caching
- add worker-based precalculation of cashbook-values
*6.0.11 - 06.12.2023*
- code optimized
*6.0.10 - 08.06.2023*
- code optimized
*6.0.9 - 19.04.2023*
- fix: line - exception if add split-lines
*6.0.8 - 17.04.2023*
- fix: line - selection of digits for quantity
*6.0.7 - 05.03.2023*
- updt: optimize queries for speed, optimize caching
- add: trytond.conf-settings
*6.0.6 - 27.02.2023*
- add: caching
- add: performance and yield info
*6.0.5 - 05.02.2023*
- fix: line rewrite values
*6.0.4 - 01.02.2023*
- fix: selection of quantity-uom/digits on line/spitline
*6.0.3 - 30.01.2023*
- add: performance-tab to line-form
- fix: digits of start/end-quantity in reconciliation
*6.0.2 - 28.01.2023*
- fix: transfer between cash-/asset-book with zero quantity
- add: view value/percent on chasbooks with btype=None
*6.0.1 - 21.01.2023*
- works
*6.0.0 - 20.12.2022*
- init

19
book.py
View file

@ -3,7 +3,7 @@
# The COPYRIGHT file at the top level of this repository contains the # The COPYRIGHT file at the top level of this repository contains the
# full copyright notices and license terms. # full copyright notices and license terms.
from trytond.model import fields, SymbolMixin from trytond.model import fields, SymbolMixin, Index
from trytond.pool import PoolMeta, Pool from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval, Or, Bool, If from trytond.pyson import Eval, Or, Bool, If
from trytond.modules.cashbook.book import STATES2, DEPENDS2 from trytond.modules.cashbook.book import STATES2, DEPENDS2
@ -25,7 +25,7 @@ class Book(SymbolMixin, metaclass=PoolMeta):
__name__ = 'cashbook.book' __name__ = 'cashbook.book'
asset = fields.Many2One( asset = fields.Many2One(
string='Asset', select=True, string='Asset',
model_name='investment.asset', ondelete='RESTRICT', model_name='investment.asset', ondelete='RESTRICT',
states={ states={
'required': Eval('feature', '') == 'asset', 'required': Eval('feature', '') == 'asset',
@ -51,7 +51,7 @@ class Book(SymbolMixin, metaclass=PoolMeta):
model_name='product.uom.category', model_name='product.uom.category',
states={'invisible': True}), 'on_change_with_asset_uomcat') states={'invisible': True}), 'on_change_with_asset_uomcat')
quantity_uom = fields.Many2One( quantity_uom = fields.Many2One(
string='UOM', select=True, string='UOM',
model_name='product.uom', ondelete='RESTRICT', model_name='product.uom', ondelete='RESTRICT',
domain=[('category.id', '=', Eval('asset_uomcat', -1))], domain=[('category.id', '=', Eval('asset_uomcat', -1))],
states={ states={
@ -181,6 +181,19 @@ class Book(SymbolMixin, metaclass=PoolMeta):
depends=['currency_digits', 'feature']), depends=['currency_digits', 'feature']),
'get_yield_balance_data', searcher='search_asset_quantity') 'get_yield_balance_data', searcher='search_asset_quantity')
@classmethod
def __setup__(cls):
super(Book, cls).__setup__()
t = cls.__table__()
cls._sql_indexes.update({
Index(
t,
(t.asset, Index.Equality())),
Index(
t,
(t.quantity_uom, Index.Equality())),
})
@classmethod @classmethod
def view_attributes(cls): def view_attributes(cls):
return super(Book, cls).view_attributes() + [ return super(Book, cls).view_attributes() + [

View file

@ -14,10 +14,9 @@ from trytond.i18n import gettext
from trytond.report import Report from trytond.report import Report
from trytond.transaction import Transaction from trytond.transaction import Transaction
from trytond.modules.cashbook.line import STATES, DEPENDS from trytond.modules.cashbook.line import STATES, DEPENDS
from trytond.modules.cashbook.const import DEF_NONE
from .mixin import SecondUomMixin from .mixin import SecondUomMixin
DEF_NONE = None
STATESQ1 = { STATESQ1 = {
'invisible': And( 'invisible': And(
Eval('feature', '') != 'asset', Eval('feature', '') != 'asset',

View file

@ -39,7 +39,7 @@ with open(path.join(here, 'versiondep.txt'), encoding='utf-8') as f:
modversion[l2[0]] = {'min': l2[1], 'max': l2[2], 'prefix': l2[3]} modversion[l2[0]] = {'min': l2[1], 'max': l2[2], 'prefix': l2[3]}
# tryton-version # tryton-version
major_version = 6 major_version = 7
minor_version = 0 minor_version = 0
requires = [] requires = []
@ -92,6 +92,7 @@ setup(
'License :: OSI Approved :: GNU General Public License (GPL)', 'License :: OSI Approved :: GNU General Public License (GPL)',
'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
], ],
keywords='tryton cashbook investment', keywords='tryton cashbook investment',

View file

@ -1,17 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of # This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms. # this repository contains the full copyright notices and license terms.
import trytond.tests.test_tryton
import unittest
from .test_module import CashbookInvestmentTestCase
__all__ = ['suite']
def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
CashbookInvestmentTestCase))
return suite

View file

@ -828,7 +828,8 @@ class CbInvTestCase(object):
self.assertRaisesRegex( self.assertRaisesRegex(
UserError, UserError,
'A value is required for field "Asset" in "Cashbook".', 'A value is required for field "Asset" in ' +
'"Book 1 | 0.00 usd | Open | 0.0000 u" of "Cashbook".',
Book.write, Book.write,
*[ *[
[book], [book],

View file

@ -1,5 +1,5 @@
[tryton] [tryton]
version=6.0.14 version=7.0.0
depends: depends:
cashbook cashbook
investment investment

View file

@ -1,2 +1,2 @@
cashbook;6.0.33;6.0.999;mds cashbook;7.0.32;7.0.999;mds
investment;6.0.26;6.0.999;mds investment;7.0.26;7.0.999;mds

View file

@ -5,9 +5,20 @@ full copyright notices and license terms. -->
<data> <data>
<xpath expr="/tree/field[@name='balance']" position="after"> <xpath expr="/tree/field[@name='balance']" position="after">
<field name="current_value" symbol="currency"/> <field name="current_value" symbol="currency" optional="0"/>
<field name="diff_percent"/> <field name="current_value_ref" symbol="company_currency" optional="1"/>
<field name="quantity" symbol="quantity_uom"/> <field name="purchase_amount" symbol="currency" optional="1"/>
<field name="diff_amount" symbol="currency" optional="0"/>
<field name="yield_balance" symbol="currency" optional="1"/>
<field name="diff_percent" optional="0"/>
<field name="quantity" symbol="quantity_uom" optional="0"/>
<field name="quantity_all" symbol="quantity_uom" optional="1"/>
<field name="yield_sales" symbol="currency" optional="1"/>
<field name="yield_sales_12m" symbol="currency" optional="1"/>
<field name="yield_dividend_total" symbol="currency" optional="1"/>
<field name="yield_dividend_12m" symbol="currency" optional="1"/>
<field name="yield_fee_total" symbol="currency" optional="1"/>
<field name="yield_fee_12m" symbol="currency" optional="1"/>
</xpath> </xpath>
</data> </data>

View file

@ -5,7 +5,20 @@ full copyright notices and license terms. -->
<data> <data>
<xpath expr="/tree/field[@name='balance']" position="after"> <xpath expr="/tree/field[@name='balance']" position="after">
<field name="diff_amount" symbol="currency"/> <field name="current_value" symbol="currency" optional="1"/>
<field name="current_value_ref" symbol="company_currency" optional="1"/>
<field name="purchase_amount" symbol="currency" optional="1"/>
<field name="diff_amount" symbol="currency" optional="0"/>
<field name="yield_balance" symbol="currency" optional="1"/>
<field name="diff_percent" optional="0"/>
<field name="quantity" symbol="quantity_uom" optional="1"/>
<field name="quantity_all" symbol="quantity_uom" optional="1"/>
<field name="yield_sales" symbol="currency" optional="1"/>
<field name="yield_sales_12m" symbol="currency" optional="1"/>
<field name="yield_dividend_total" symbol="currency" optional="1"/>
<field name="yield_dividend_12m" symbol="currency" optional="1"/>
<field name="yield_fee_total" symbol="currency" optional="1"/>
<field name="yield_fee_12m" symbol="currency" optional="1"/>
</xpath> </xpath>
</data> </data>

View file

@ -5,9 +5,9 @@ full copyright notices and license terms. -->
<data> <data>
<xpath expr="/tree/field[@name='balance']" position="after"> <xpath expr="/tree/field[@name='balance']" position="after">
<field name="quantity_credit"/> <field name="quantity_credit" optional="0"/>
<field name="quantity_debit"/> <field name="quantity_debit" optional="0"/>
<field name="quantity_balance"/> <field name="quantity_balance" optional="0"/>
</xpath> </xpath>
</data> </data>

View file

@ -5,7 +5,7 @@ full copyright notices and license terms. -->
<data> <data>
<xpath expr="/tree/field[@name='end_amount']" position="after"> <xpath expr="/tree/field[@name='end_amount']" position="after">
<field name="start_quantity"/> <field name="start_quantity" optional="0"/>
<field name="end_quantity"/> <field name="end_quantity" optional="0"/>
</xpath> </xpath>
</data> </data>

View file

@ -5,8 +5,8 @@ full copyright notices and license terms. -->
<data> <data>
<xpath expr="/tree/field[@name='amount_2nd_currency']" position="after"> <xpath expr="/tree/field[@name='amount_2nd_currency']" position="after">
<field name="quantity" symbol="quantity_uom"/> <field name="quantity" symbol="quantity_uom" optional="0"/>
<field name="quantity_2nd_uom" symbol="quantity2nd"/> <field name="quantity_2nd_uom" symbol="quantity2nd" optional="0"/>
</xpath> </xpath>
</data> </data>