Compare commits
113 commits
ver_6.0.34
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
08d8121f57 | ||
![]() |
6aca58bcc2 | ||
![]() |
400ebed692 | ||
![]() |
865a2c7fa6 | ||
![]() |
852ff6871d | ||
![]() |
65437bc52e | ||
![]() |
206cd1e0e5 | ||
![]() |
d0f5b0aa38 | ||
![]() |
52011f5166 | ||
![]() |
f9e55fab77 | ||
![]() |
0442591d52 | ||
![]() |
5ef3a52fdc | ||
![]() |
5d8f924960 | ||
![]() |
9ef465f40f | ||
![]() |
d2ad96db35 | ||
![]() |
e79bcca989 | ||
![]() |
52e788db17 | ||
![]() |
72f0325a71 | ||
![]() |
7e6d2660ad | ||
![]() |
cf92b2d7b5 | ||
![]() |
7062399319 | ||
![]() |
fbdc68c642 | ||
![]() |
7220cff5ac | ||
![]() |
77ee7d15b7 | ||
![]() |
90298d3eb8 | ||
![]() |
e605d5f0d3 | ||
![]() |
2b6731d071 | ||
![]() |
2cf42eb9f6 | ||
![]() |
3467c08895 | ||
![]() |
619a17bcd6 | ||
![]() |
78f160bf0b | ||
![]() |
03324d5944 | ||
![]() |
179543bcf0 | ||
![]() |
befa1db235 | ||
![]() |
39309783b6 | ||
![]() |
624a5bff55 | ||
![]() |
86e6c33cc1 | ||
![]() |
971dbc4520 | ||
![]() |
dbc570bdbf | ||
![]() |
610532f6a5 | ||
![]() |
2d6f034a17 | ||
![]() |
1f92b15756 | ||
![]() |
984aab168a | ||
![]() |
f5eef66f78 | ||
![]() |
cace9ea751 | ||
![]() |
8f180cfaf7 | ||
![]() |
3b289b7944 | ||
![]() |
82ae7d7bca | ||
![]() |
11d6183d65 | ||
![]() |
a9773a42df | ||
![]() |
f2ecd3e174 | ||
![]() |
0138269ea8 | ||
![]() |
2b4d69736b | ||
![]() |
b809d51fe0 | ||
![]() |
e0a6d39bdb | ||
![]() |
7a715d5ea1 | ||
![]() |
a051a249e4 | ||
![]() |
7591c7568d | ||
![]() |
8a563e2d7f | ||
![]() |
63390df9ca | ||
![]() |
3a0e8f290d | ||
![]() |
29193fc0f1 | ||
![]() |
82afd24c20 | ||
![]() |
db84bf7097 | ||
![]() |
a16618bf22 | ||
![]() |
46e82ce73f | ||
![]() |
1ab987d532 | ||
![]() |
63a3f8f020 | ||
![]() |
fc3ddba3ab | ||
![]() |
a521064ddf | ||
![]() |
ef32bd79f9 | ||
![]() |
557a8b47ba | ||
![]() |
94d51b4ee2 | ||
![]() |
5794a4ccb7 | ||
![]() |
5136189386 | ||
![]() |
8910f26c99 | ||
![]() |
3073ce6f8d | ||
![]() |
25dcdde09b | ||
![]() |
0f6180ebdb | ||
![]() |
517e2c5ad3 | ||
![]() |
59dfb94bee | ||
![]() |
4a7ee23e2c | ||
![]() |
b6799e355f | ||
![]() |
3db6822f26 | ||
![]() |
7999440de7 | ||
![]() |
1c22aac197 | ||
![]() |
99abc069d8 | ||
![]() |
2acdc55efb | ||
![]() |
a2e7f192f8 | ||
![]() |
e10616e847 | ||
![]() |
0c099b11b3 | ||
![]() |
165612a627 | ||
![]() |
86922aecef | ||
![]() |
2a44c67ccf | ||
![]() |
9732fe11e9 | ||
![]() |
e3887debe9 | ||
![]() |
953bf248a4 | ||
![]() |
326d87f758 | ||
![]() |
d6ea1b31a6 | ||
![]() |
98ed1ceb6e | ||
![]() |
d1bb86ada3 | ||
![]() |
acf3ca7ce5 | ||
![]() |
adb472dc87 | ||
![]() |
8abe8fc164 | ||
![]() |
ba3892aa03 | ||
![]() |
b78ff02500 | ||
![]() |
24c0e2678e | ||
![]() |
4615c04bce | ||
![]() |
64e9bab592 | ||
![]() |
7fd42c0b42 | ||
![]() |
937124bcaf | ||
![]() |
532d9cc7c8 | ||
![]() |
d383b8f9c1 |
71 changed files with 7845 additions and 1339 deletions
4
.hgignore → .gitignore
vendored
4
.hgignore → .gitignore
vendored
|
@ -1,6 +1,8 @@
|
||||||
syntax: glob
|
*.pyc
|
||||||
build/*
|
build/*
|
||||||
dist/*
|
dist/*
|
||||||
mds_cashbook.egg-info/*
|
mds_cashbook.egg-info/*
|
||||||
locale/convert_de2en.py
|
locale/convert_de2en.py
|
||||||
__pycache__/*
|
__pycache__/*
|
||||||
|
.pytest_cache/*
|
||||||
|
.env
|
16
COPYRIGHT
Normal file
16
COPYRIGHT
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
Copyright (C) 2015-2023 Cédric Krier.
|
||||||
|
Copyright (C) 2015-2023 B2CK SPRL.
|
||||||
|
Copyright (C) 2021-2024 martin-data services.
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
674
LICENSE
Normal file
674
LICENSE
Normal file
|
@ -0,0 +1,674 @@
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
4
MANIFEST.in
Normal file
4
MANIFEST.in
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
include LICENSE
|
||||||
|
include COPYRIGHT
|
||||||
|
include README.rst
|
||||||
|
include versiondep.txt
|
145
README.rst
145
README.rst
|
@ -9,11 +9,150 @@ pip install mds-cashbook
|
||||||
|
|
||||||
Requires
|
Requires
|
||||||
========
|
========
|
||||||
- Tryton 6.0
|
- Tryton 7.0
|
||||||
|
|
||||||
|
How to
|
||||||
|
======
|
||||||
|
|
||||||
|
This module adds a cash book to Tryton. Each Tryton user can have
|
||||||
|
any number of cash books. The cash books can be arranged hierarchically.
|
||||||
|
A cash book contains simple postings, such as expense, revenue, transfer,
|
||||||
|
split posting. Each booking has a category, an amount and possibly a description.
|
||||||
|
The cash books of the different Tryton users are separated from
|
||||||
|
each other by permissions. There is an enhancement module for the connection
|
||||||
|
to the chart of accounts and analytic.
|
||||||
|
|
||||||
|
This module adds new user groups:
|
||||||
|
|
||||||
|
Cashbook
|
||||||
|
The user can make entries in his cash books.
|
||||||
|
|
||||||
|
Cashbook - WF - Check
|
||||||
|
The user can mark his bookings as 'checked'
|
||||||
|
|
||||||
|
Cashbook - WF - Done
|
||||||
|
The user can reconcile his cash books
|
||||||
|
|
||||||
|
Cashbook - Administrator
|
||||||
|
the Cashbook-Administrator
|
||||||
|
|
||||||
|
There is a possibility to allow reading or editing for other users via
|
||||||
|
the Tryton user groups. This makes it possible to set up a administrator
|
||||||
|
for all cash books of the Tryton system.
|
||||||
|
|
||||||
|
|
||||||
|
Set up your cash book
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
Add the Tryton user to the *Cashbook* group. In the tab *Owner and Authorizeds*,
|
||||||
|
enter the user as the owner. Enter *Type*, *Currency*, *Initial Date*
|
||||||
|
and *Line Numbering*. Cash books without a type cannot receive postings
|
||||||
|
and are treated as a view. You can create several cash books per user
|
||||||
|
and arrange them hierarchically.
|
||||||
|
|
||||||
|
|
||||||
|
Creating categories
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Each booking needs a category. The categories are separated by revenue and expense.
|
||||||
|
In the menu Cash Book / Configuration / Category you create some categories.
|
||||||
|
|
||||||
|
|
||||||
|
Using the chart of accounts
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
If you want to have the postings as a posting record in Tryton Accounting
|
||||||
|
install the *cashbook_account* module. For analytic, install *cashbook_analytic*.
|
||||||
|
In each of the cash books, add one account to the
|
||||||
|
chart of accounts, in tab *Account Configuration*.
|
||||||
|
|
||||||
|
In the categories you add a chart of accounts account in the
|
||||||
|
tab 'Account and Tax'. If you want to make your transactions with taxes,
|
||||||
|
you can also add one or more taxes.
|
||||||
|
|
||||||
|
Enter bookings
|
||||||
|
--------------
|
||||||
|
|
||||||
|
There are two ways to enter bookings.
|
||||||
|
|
||||||
|
1) The *Enter Booking* wizard. The wizard is optimized for use on
|
||||||
|
small screens. You can write down expenses on the go with your smartphone.
|
||||||
|
The type of bookings is limited to expense, revenue and transfers between cash books.
|
||||||
|
When using the wizard, you should check the booking later and possibly complete it.
|
||||||
|
|
||||||
|
2) The record form of a cash book. This option offers all posting variants,
|
||||||
|
such as expense, revenue, transfer to, transfer from, expense split posting
|
||||||
|
and revenue split posting. When using chart of accounts and analytic,
|
||||||
|
you also specify the taxes and analytic accounts here.
|
||||||
|
|
||||||
|
|
||||||
|
Processing states
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Postings in cash books have several workflow states.
|
||||||
|
|
||||||
|
Edit
|
||||||
|
The entry has been created but not yet verified
|
||||||
|
|
||||||
|
Checked
|
||||||
|
The user has checked his entry and has indicated this by clicking on 'Check'
|
||||||
|
When using the chart of accounts modules, posting records are created here
|
||||||
|
in the Draft state.
|
||||||
|
|
||||||
|
Reconciled
|
||||||
|
A user (with enough permissions) has checked the entry against a
|
||||||
|
bank statement. This step is performed in the 'Reconciliations' tab of a cash book.
|
||||||
|
|
||||||
|
Done
|
||||||
|
The entry is committed. This step is performed by completing a
|
||||||
|
reconciliation in the cash book. When using the chart of accounts modules,
|
||||||
|
the posting records created in step 'Check' are committed.
|
||||||
|
|
||||||
|
|
||||||
|
Reconciliation
|
||||||
|
--------------
|
||||||
|
|
||||||
|
The bookings should be checked regularly against a bank statement. This is done
|
||||||
|
in the 'Reconciliations' tab of a cash book.
|
||||||
|
|
||||||
|
1) Click the plus button, don't change anything about the contents,
|
||||||
|
click *ok*, save the cash book. The system will change the dates of the
|
||||||
|
reconciliation so that all eligible bookings are taken into account.
|
||||||
|
|
||||||
|
2) If you want to change the end date, do so now. Save.
|
||||||
|
|
||||||
|
3) Open the reconciliation by double-clicking, click on *Check*.
|
||||||
|
This will insert all posting lines into the list. The posting lines
|
||||||
|
in the cash book are now protected against edit.
|
||||||
|
|
||||||
|
4) Now check line by line against an account statement. To remember what you
|
||||||
|
have already seen, click the 'Reconciled' button.
|
||||||
|
|
||||||
|
5) When you're done, click the *Done* button of the reconciliation. This
|
||||||
|
sets all posting lines and the reconciliation to *Done*.
|
||||||
|
|
||||||
|
|
||||||
|
Configuration
|
||||||
|
-------------
|
||||||
|
|
||||||
|
The configuration in the menu Cash Book / Configuration is a user-specific setting.
|
||||||
|
The user can choose which cash books appear in the *Enter Booking* dialog and
|
||||||
|
which default settings should apply when opening a cash book.
|
||||||
|
|
||||||
|
|
||||||
|
Foreign currencies
|
||||||
|
------------------
|
||||||
|
|
||||||
|
The cash books can be used with foreign currency. Base currency is the company currency.
|
||||||
|
For transfers between cash books with different currencies, the current conversion
|
||||||
|
rate in Tryton is used. You can adjust the exchange rate actually used in the booking dialog.
|
||||||
|
If you have hierarchical cash books, the amounts of subordinate cash books with foreign
|
||||||
|
currency are converted into the display currency of the parent cash book.
|
||||||
|
|
||||||
|
|
||||||
Changes
|
Changes
|
||||||
=======
|
=======
|
||||||
|
|
||||||
*6.0.0 - 05.08.2022*
|
*7.0.0 - 30.11.2023*
|
||||||
|
|
||||||
- init
|
- compatibility to Tryton 7.0
|
||||||
|
|
15
__init__.py
15
__init__.py
|
@ -8,17 +8,24 @@ from .book import Book
|
||||||
from .types import Type
|
from .types import Type
|
||||||
from .line import Line, LineContext
|
from .line import Line, LineContext
|
||||||
from .splitline import SplitLine
|
from .splitline import SplitLine
|
||||||
from .wizard_openline import OpenCashBook, OpenCashBookStart
|
from .wizard_openline import OpenCashBook, OpenCashBookStart, OpenCashBookTree
|
||||||
from .wizard_runreport import RunCbReport, RunCbReportStart
|
from .wizard_runreport import RunCbReport, RunCbReportStart
|
||||||
|
from .wizard_booking import EnterBookingWizard, EnterBookingStart
|
||||||
from .configuration import Configuration, UserConfiguration
|
from .configuration import Configuration, UserConfiguration
|
||||||
from .category import Category
|
from .category import Category
|
||||||
from .reconciliation import Reconciliation
|
from .reconciliation import Reconciliation
|
||||||
from .cbreport import ReconciliationReport
|
from .cbreport import ReconciliationReport
|
||||||
|
from .currency import CurrencyRate
|
||||||
|
from .valuestore import ValueStore
|
||||||
|
from .ir import Rule
|
||||||
|
from .cron import Cron
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
Configuration,
|
Configuration,
|
||||||
UserConfiguration,
|
UserConfiguration,
|
||||||
|
CurrencyRate,
|
||||||
Type,
|
Type,
|
||||||
Category,
|
Category,
|
||||||
Book,
|
Book,
|
||||||
|
@ -28,11 +35,17 @@ def register():
|
||||||
Reconciliation,
|
Reconciliation,
|
||||||
OpenCashBookStart,
|
OpenCashBookStart,
|
||||||
RunCbReportStart,
|
RunCbReportStart,
|
||||||
|
EnterBookingStart,
|
||||||
|
ValueStore,
|
||||||
|
Rule,
|
||||||
|
Cron,
|
||||||
module='cashbook', type_='model')
|
module='cashbook', type_='model')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
ReconciliationReport,
|
ReconciliationReport,
|
||||||
module='cashbook', type_='report')
|
module='cashbook', type_='report')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
OpenCashBook,
|
OpenCashBook,
|
||||||
|
OpenCashBookTree,
|
||||||
RunCbReport,
|
RunCbReport,
|
||||||
|
EnterBookingWizard,
|
||||||
module='cashbook', type_='wizard')
|
module='cashbook', type_='wizard')
|
||||||
|
|
553
book.py
553
book.py
|
@ -3,7 +3,8 @@
|
||||||
# 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 Workflow, ModelView, ModelSQL, fields, Check
|
from trytond.model import (
|
||||||
|
Workflow, ModelView, ModelSQL, fields, Check, tree, Index)
|
||||||
from trytond.pyson import Eval, Or, Bool, Id
|
from trytond.pyson import Eval, Or, Bool, Id
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
|
@ -11,8 +12,11 @@ from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
from datetime import date
|
||||||
from sql.aggregate import Sum
|
from sql.aggregate import Sum
|
||||||
from sql.conditionals import Case
|
from sql.conditionals import Case
|
||||||
|
from .model import (
|
||||||
|
order_name_hierarchical, sub_ids_hierarchical, AnyInArray)
|
||||||
|
|
||||||
|
|
||||||
STATES = {
|
STATES = {
|
||||||
|
@ -20,6 +24,19 @@ STATES = {
|
||||||
}
|
}
|
||||||
DEPENDS = ['state']
|
DEPENDS = ['state']
|
||||||
|
|
||||||
|
# states in case of 'btype'!=None
|
||||||
|
STATES2 = {
|
||||||
|
'readonly': Or(
|
||||||
|
Eval('state', '') != 'open',
|
||||||
|
~Bool(Eval('btype')),
|
||||||
|
),
|
||||||
|
'invisible': ~Bool(Eval('btype')),
|
||||||
|
}
|
||||||
|
STATES3 = {}
|
||||||
|
STATES3.update(STATES2)
|
||||||
|
STATES3['required'] = ~STATES2['invisible']
|
||||||
|
DEPENDS2 = ['state', 'btype']
|
||||||
|
|
||||||
sel_state_book = [
|
sel_state_book = [
|
||||||
('open', 'Open'),
|
('open', 'Open'),
|
||||||
('closed', 'Closed'),
|
('closed', 'Closed'),
|
||||||
|
@ -27,81 +44,175 @@ sel_state_book = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class Book(Workflow, ModelSQL, ModelView):
|
class Book(tree(separator='/'), Workflow, ModelSQL, ModelView):
|
||||||
'Cashbook'
|
'Cashbook'
|
||||||
__name__ = 'cashbook.book'
|
__name__ = 'cashbook.book'
|
||||||
|
|
||||||
company = fields.Many2One(string='Company', model_name='company.company',
|
company = fields.Many2One(
|
||||||
|
string='Company', model_name='company.company',
|
||||||
required=True, ondelete="RESTRICT")
|
required=True, ondelete="RESTRICT")
|
||||||
name = fields.Char(string='Name', required=True,
|
name = fields.Char(
|
||||||
states=STATES, depends=DEPENDS)
|
string='Name', required=True, states=STATES, depends=DEPENDS)
|
||||||
btype = fields.Many2One(string='Type', required=True,
|
description = fields.Text(
|
||||||
|
string='Description', states=STATES, depends=DEPENDS)
|
||||||
|
btype = fields.Many2One(
|
||||||
|
string='Type',
|
||||||
|
help='A cash book with type can contain postings. ' +
|
||||||
|
'Without type is a view.',
|
||||||
model_name='cashbook.type', ondelete='RESTRICT',
|
model_name='cashbook.type', ondelete='RESTRICT',
|
||||||
states=STATES, depends=DEPENDS)
|
states={
|
||||||
owner = fields.Many2One(string='Owner', required=True, select=True,
|
'readonly': Or(
|
||||||
|
STATES['readonly'],
|
||||||
|
Eval('has_lines', False))},
|
||||||
|
depends=DEPENDS+['has_lines'])
|
||||||
|
feature = fields.Function(fields.Char(
|
||||||
|
string='Feature', readonly=True,
|
||||||
|
states={'invisible': True}), 'on_change_with_feature')
|
||||||
|
owner = fields.Many2One(
|
||||||
|
string='Owner', required=True,
|
||||||
model_name='res.user', ondelete='SET NULL',
|
model_name='res.user', ondelete='SET NULL',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
reviewer = fields.Many2One(string='Reviewer', select=True,
|
reviewer = fields.Many2One(
|
||||||
|
string='Reviewer',
|
||||||
help='Group of users who have write access to the cashbook.',
|
help='Group of users who have write access to the cashbook.',
|
||||||
model_name='res.group', ondelete='SET NULL',
|
model_name='res.group', ondelete='SET NULL',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
observer = fields.Many2One(string='Observer', select=True,
|
observer = fields.Many2One(
|
||||||
|
string='Observer',
|
||||||
help='Group of users who have read-only access to the cashbook.',
|
help='Group of users who have read-only access to the cashbook.',
|
||||||
model_name='res.group', ondelete='SET NULL',
|
model_name='res.group', ondelete='SET NULL',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
lines = fields.One2Many(string='Lines', field='cashbook',
|
lines = fields.One2Many(
|
||||||
|
string='Lines', field='cashbook',
|
||||||
model_name='cashbook.line',
|
model_name='cashbook.line',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
reconciliations = fields.One2Many(string='Reconciliations',
|
has_lines = fields.Function(fields.Boolean(
|
||||||
|
string='Has Lines', readonly=True, states={'invisible': True}),
|
||||||
|
'on_change_with_has_lines')
|
||||||
|
reconciliations = fields.One2Many(
|
||||||
|
string='Reconciliations',
|
||||||
field='cashbook', model_name='cashbook.recon',
|
field='cashbook', model_name='cashbook.recon',
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES2, depends=DEPENDS2)
|
||||||
number_sequ = fields.Many2One(string='Line numbering', required=True,
|
number_sequ = fields.Many2One(
|
||||||
|
string='Line numbering',
|
||||||
help='Number sequence for numbering of the cash book lines.',
|
help='Number sequence for numbering of the cash book lines.',
|
||||||
model_name='ir.sequence',
|
model_name='ir.sequence',
|
||||||
domain=[
|
domain=[
|
||||||
('sequence_type', '=', Id('cashbook', 'sequence_type_cashbook_line')),
|
('sequence_type', '=',
|
||||||
|
Id('cashbook', 'sequence_type_cashbook_line')),
|
||||||
['OR',
|
['OR',
|
||||||
('company', '=', None),
|
('company', '=', None),
|
||||||
('company', '=', Eval('company', -1)),
|
('company', '=', Eval('company', -1))],
|
||||||
],
|
],
|
||||||
],
|
states=STATES3, depends=DEPENDS2+['company'])
|
||||||
states=STATES, depends=DEPENDS+['company'])
|
number_atcheck = fields.Boolean(
|
||||||
number_atcheck = fields.Boolean(string="number when 'Checking'",
|
string="number when 'Checking'",
|
||||||
help="The numbering of the lines is done in the step Check. If the check mark is inactive, this happens with Done.")
|
help="The numbering of the lines is done in the step Check. " +
|
||||||
start_date = fields.Date(string='Initial Date', required=True,
|
"If the check mark is inactive, this happens with Done.",
|
||||||
|
states=STATES2, depends=DEPENDS2)
|
||||||
|
start_date = fields.Date(
|
||||||
|
string='Initial Date',
|
||||||
states={
|
states={
|
||||||
'readonly': Or(
|
'readonly': Or(
|
||||||
STATES['readonly'],
|
STATES2['readonly'],
|
||||||
Bool(Eval('lines')),
|
Eval('has_lines', False)),
|
||||||
),
|
'invisible': STATES2['invisible'],
|
||||||
}, depends=DEPENDS+['lines'])
|
'required': ~STATES2['invisible'],
|
||||||
start_balance = fields.Numeric(string='Initial Amount', required=True,
|
}, depends=DEPENDS2+['has_lines'])
|
||||||
|
|
||||||
|
value_store = fields.One2Many(
|
||||||
|
string='Values', model_name='cashbook.values', field='cashbook',
|
||||||
|
readonly=True)
|
||||||
|
balance = fields.Function(fields.Numeric(
|
||||||
|
string='Balance',
|
||||||
|
readonly=True, depends=['currency_digits'],
|
||||||
|
help='Balance of bookings to date',
|
||||||
|
digits=(16, Eval('currency_digits', 2))),
|
||||||
|
'get_balance_cashbook', searcher='search_balance')
|
||||||
|
balance_all = fields.Function(fields.Numeric(
|
||||||
|
string='Total balance',
|
||||||
|
readonly=True, depends=['currency_digits'],
|
||||||
|
help='Balance of all bookings',
|
||||||
|
digits=(16, Eval('currency_digits', 2))),
|
||||||
|
'get_balance_cashbook', searcher='search_balance')
|
||||||
|
balance_ref = fields.Function(fields.Numeric(
|
||||||
|
string='Balance (Ref.)',
|
||||||
|
help='Balance in company currency',
|
||||||
|
readonly=True, digits=(16, Eval('company_currency_digits', 2)),
|
||||||
states={
|
states={
|
||||||
'readonly': Or(
|
'invisible': ~Bool(Eval('company_currency')),
|
||||||
STATES['readonly'],
|
}, depends=['company_currency_digits', 'company_currency']),
|
||||||
Bool(Eval('lines')),
|
'get_balance_cashbook', searcher='search_balance')
|
||||||
),
|
company_currency = fields.Function(fields.Many2One(
|
||||||
}, depends=DEPENDS+['lines'])
|
readonly=True,
|
||||||
balance = fields.Function(fields.Numeric(string='Balance', readonly=True),
|
string='Company Currency', states={'invisible': True},
|
||||||
'on_change_with_balance')
|
model_name='currency.currency'),
|
||||||
currency = fields.Many2One(string='Currency', required=True,
|
'on_change_with_company_currency')
|
||||||
|
company_currency_digits = fields.Function(fields.Integer(
|
||||||
|
string='Currency Digits (Ref.)', readonly=True),
|
||||||
|
'on_change_with_currency_digits')
|
||||||
|
|
||||||
|
currency = fields.Many2One(
|
||||||
|
string='Currency',
|
||||||
model_name='currency.currency',
|
model_name='currency.currency',
|
||||||
states={
|
states={
|
||||||
'readonly': Or(
|
'readonly': Or(
|
||||||
STATES['readonly'],
|
STATES2['readonly'],
|
||||||
Bool(Eval('lines', [])),
|
Eval('has_lines', False))},
|
||||||
),
|
depends=DEPENDS2+['has_lines'])
|
||||||
}, depends=DEPENDS+['lines'])
|
currency_digits = fields.Function(fields.Integer(
|
||||||
state = fields.Selection(string='State', required=True,
|
string='Currency Digits',
|
||||||
|
readonly=True), 'on_change_with_currency_digits')
|
||||||
|
state = fields.Selection(
|
||||||
|
string='State', required=True,
|
||||||
readonly=True, selection=sel_state_book)
|
readonly=True, selection=sel_state_book)
|
||||||
state_string = state.translated('state')
|
state_string = state.translated('state')
|
||||||
|
|
||||||
|
parent = fields.Many2One(
|
||||||
|
string="Parent",
|
||||||
|
model_name='cashbook.book', ondelete='RESTRICT')
|
||||||
|
childs = fields.One2Many(
|
||||||
|
string='Children', field='parent',
|
||||||
|
model_name='cashbook.book')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __register__(cls, module_name):
|
||||||
|
super(Book, cls).__register__(module_name)
|
||||||
|
|
||||||
|
table = cls.__table_handler__(module_name)
|
||||||
|
table.drop_column('start_balance')
|
||||||
|
table.drop_column('left')
|
||||||
|
table.drop_column('right')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(Book, cls).__setup__()
|
super(Book, cls).__setup__()
|
||||||
cls._order.insert(0, ('name', 'ASC'))
|
cls._order.insert(0, ('rec_name', 'ASC'))
|
||||||
cls._order.insert(0, ('state', 'ASC'))
|
cls._order.insert(0, ('state', 'ASC'))
|
||||||
t = cls.__table__()
|
t = cls.__table__()
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.btype, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.company, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.currency, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.state, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.owner, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.reviewer, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.observer, Index.Equality())),
|
||||||
|
})
|
||||||
cls._sql_constraints.extend([
|
cls._sql_constraints.extend([
|
||||||
('state_val',
|
('state_val',
|
||||||
Check(t, t.state.in_(['open', 'closed', 'archive'])),
|
Check(t, t.state.in_(['open', 'closed', 'archive'])),
|
||||||
|
@ -131,12 +242,6 @@ class Book(Workflow, ModelSQL, ModelView):
|
||||||
def default_number_atcheck(cls):
|
def default_number_atcheck(cls):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def default_start_balance(cls):
|
|
||||||
""" zero
|
|
||||||
"""
|
|
||||||
return Decimal('0.0')
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_currency(cls):
|
def default_currency(cls):
|
||||||
""" currency of company
|
""" currency of company
|
||||||
|
@ -182,42 +287,302 @@ class Book(Workflow, ModelSQL, ModelView):
|
||||||
Case(
|
Case(
|
||||||
(tab_book.state == 'open', 0),
|
(tab_book.state == 'open', 0),
|
||||||
else_=1),
|
else_=1),
|
||||||
where=tab_book.id==table.id
|
where=tab_book.id == table.id)
|
||||||
)
|
|
||||||
return [query]
|
return [query]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def order_rec_name(tables):
|
||||||
|
""" order by pos
|
||||||
|
a recursive sorting
|
||||||
|
"""
|
||||||
|
return order_name_hierarchical('cashbook.book', tables)
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
def get_rec_name(self, name):
|
||||||
""" name, balance, state
|
""" name, balance, state
|
||||||
"""
|
"""
|
||||||
|
recname = super(Book, self).get_rec_name(name)
|
||||||
|
if self.btype:
|
||||||
return '%(name)s | %(balance)s %(symbol)s | %(state)s' % {
|
return '%(name)s | %(balance)s %(symbol)s | %(state)s' % {
|
||||||
'name': self.name or '-',
|
'name': recname or '-',
|
||||||
'balance': Report.format_number(self.balance or 0.0, None),
|
'balance': Report.format_number(
|
||||||
|
self.balance or 0.0, None,
|
||||||
|
digits=getattr(self.currency, 'digits', 2)),
|
||||||
'symbol': getattr(self.currency, 'symbol', '-'),
|
'symbol': getattr(self.currency, 'symbol', '-'),
|
||||||
'state': self.state_string,
|
'state': self.state_string,
|
||||||
}
|
}
|
||||||
|
return recname
|
||||||
|
|
||||||
@fields.depends('id', 'start_balance')
|
@classmethod
|
||||||
def on_change_with_balance(self, name=None):
|
def get_balance_of_cashbook_sql(cls):
|
||||||
""" compute balance
|
""" sql for balance of a single cashbook
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Line = pool.get('cashbook.line')
|
||||||
|
Book2 = pool.get('cashbook.book')
|
||||||
|
IrDate = pool.get('ir.date')
|
||||||
|
tab_line = Line.__table__()
|
||||||
|
tab_book = Book2.__table__()
|
||||||
|
context = Transaction().context
|
||||||
|
|
||||||
|
query_date = context.get('date', IrDate.today())
|
||||||
|
|
||||||
|
# deny invalid date in context
|
||||||
|
if isinstance(query_date, str):
|
||||||
|
try:
|
||||||
|
date.fromisoformat(query_date)
|
||||||
|
except Exception:
|
||||||
|
query_date = IrDate.today()
|
||||||
|
|
||||||
|
query = tab_book.join(
|
||||||
|
tab_line,
|
||||||
|
condition=tab_book.id == tab_line.cashbook,
|
||||||
|
).select(
|
||||||
|
tab_line.cashbook,
|
||||||
|
tab_book.currency,
|
||||||
|
Sum(Case(
|
||||||
|
(tab_line.date <= query_date,
|
||||||
|
tab_line.credit - tab_line.debit),
|
||||||
|
else_=Decimal('0.0'),
|
||||||
|
)).as_('balance'),
|
||||||
|
Sum(tab_line.credit - tab_line.debit).as_('balance_all'),
|
||||||
|
group_by=[tab_line.cashbook, tab_book.currency],
|
||||||
|
)
|
||||||
|
return (query, tab_line)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def work_order_balance(cls, tables, field_name):
|
||||||
|
""" get order-query
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book2 = pool.get('cashbook.book')
|
||||||
|
ValueStore = pool.get('cashbook.values')
|
||||||
|
context = Transaction().context
|
||||||
|
|
||||||
|
query_date = context.get('date', None)
|
||||||
|
table, _ = tables[None]
|
||||||
|
if query_date is not None:
|
||||||
|
if field_name == 'balance_ref':
|
||||||
|
raise UserError(gettext(
|
||||||
|
'cashbook.msg_nosearch_with_date',
|
||||||
|
fname=field_name, model=Book2.__name__))
|
||||||
|
|
||||||
|
(tab_book, tab2) = Book2.get_balance_of_cashbook_sql()
|
||||||
|
query = tab_book.select(
|
||||||
|
getattr(tab_book, field_name),
|
||||||
|
where=tab_book.cashbook == table.id)
|
||||||
|
return [query]
|
||||||
|
else:
|
||||||
|
tab_val = ValueStore.__table__()
|
||||||
|
tab_book = Book2.__table__()
|
||||||
|
|
||||||
|
query = tab_book.join(
|
||||||
|
tab_val,
|
||||||
|
condition=(
|
||||||
|
tab_book.id == tab_val.cashbook) & (
|
||||||
|
tab_val.field_name == field_name),
|
||||||
|
).select(
|
||||||
|
tab_val.numvalue,
|
||||||
|
where=tab_book.id == table.id)
|
||||||
|
return [query]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def order_balance(tables):
|
||||||
|
""" order by balance
|
||||||
|
"""
|
||||||
|
Book2 = Pool().get('cashbook.book')
|
||||||
|
return Book2.work_order_balance(tables, 'balance')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def order_balance_all(tables):
|
||||||
|
""" order by balance-all
|
||||||
|
"""
|
||||||
|
Book2 = Pool().get('cashbook.book')
|
||||||
|
return Book2.work_order_balance(tables, 'balance_all')
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def order_balance_ref(tables):
|
||||||
|
""" order by balance-all
|
||||||
|
"""
|
||||||
|
Book2 = Pool().get('cashbook.book')
|
||||||
|
return Book2.work_order_balance(tables, 'balance_ref')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def search_balance(cls, name, clause):
|
||||||
|
""" search in 'balance'
|
||||||
|
"""
|
||||||
|
ValueStore = Pool().get('cashbook.values')
|
||||||
|
Operator = fields.SQL_OPERATORS[clause[1]]
|
||||||
|
context = Transaction().context
|
||||||
|
|
||||||
|
query_date = context.get('date', None)
|
||||||
|
if query_date is not None:
|
||||||
|
|
||||||
|
if name == 'balance_ref':
|
||||||
|
raise UserError(gettext(
|
||||||
|
'cashbook.msg_nosearch_with_date',
|
||||||
|
fname=name, model=cls.__name__))
|
||||||
|
|
||||||
|
(tab_line, tab2) = cls.get_balance_of_cashbook_sql()
|
||||||
|
query = tab_line.select(
|
||||||
|
tab_line.cashbook,
|
||||||
|
where=Operator(
|
||||||
|
getattr(tab_line, name), clause[2]))
|
||||||
|
return [('id', 'in', query)]
|
||||||
|
else:
|
||||||
|
value_query = ValueStore.search([
|
||||||
|
('field_name', '=', clause[0]),
|
||||||
|
('numvalue',) + tuple(clause[1:]),
|
||||||
|
],
|
||||||
|
query=True)
|
||||||
|
return [('value_store', 'in', value_query)]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def valuestore_delete_records(cls, records):
|
||||||
|
""" delete value-records
|
||||||
|
"""
|
||||||
|
ValStore = Pool().get('cashbook.values')
|
||||||
|
if records:
|
||||||
|
ValStore.delete_values(records)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def valuestore_fields(cls):
|
||||||
|
""" field to update
|
||||||
|
"""
|
||||||
|
return ['balance', 'balance_all', 'balance_ref']
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def valuestore_update_records(cls, records):
|
||||||
|
""" compute current values of records,
|
||||||
|
store to global storage
|
||||||
|
"""
|
||||||
|
ValStore = Pool().get('cashbook.values')
|
||||||
|
|
||||||
|
if records:
|
||||||
|
ValStore.update_values(
|
||||||
|
cls.get_balance_values(
|
||||||
|
records,
|
||||||
|
['balance', 'balance_all', 'balance_ref']))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_balance_cashbook(cls, cashbooks, names):
|
||||||
|
""" get balance of cashbooks
|
||||||
|
"""
|
||||||
|
context = Transaction().context
|
||||||
|
|
||||||
|
result = {x: {y.id: Decimal('0.0') for y in cashbooks} for x in names}
|
||||||
|
|
||||||
|
# return computed values if 'date' is in context
|
||||||
|
query_date = context.get('date', None)
|
||||||
|
if query_date is not None:
|
||||||
|
return cls.get_balance_values(cashbooks, names)
|
||||||
|
|
||||||
|
for cashbook in cashbooks:
|
||||||
|
for value in cashbook.value_store:
|
||||||
|
if value.field_name in names:
|
||||||
|
result[value.field_name][cashbook.id] = value.numvalue
|
||||||
|
return result
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_balance_values(cls, cashbooks, names):
|
||||||
|
""" get balance of cashbook
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book2 = pool.get('cashbook.book')
|
||||||
|
Currency = pool.get('currency.currency')
|
||||||
|
Company = pool.get('company.company')
|
||||||
|
IrDate = pool.get('ir.date')
|
||||||
|
tab_book = Book2.__table__()
|
||||||
|
tab_comp = Company.__table__()
|
||||||
|
cursor = Transaction().connection.cursor()
|
||||||
|
context = Transaction().context
|
||||||
|
|
||||||
|
result = {
|
||||||
|
x: {y.id: Decimal('0.0') for y in cashbooks}
|
||||||
|
for x in ['balance', 'balance_all', 'balance_ref']}
|
||||||
|
|
||||||
|
# deny invalid date in context
|
||||||
|
query_date = context.get('date', IrDate.today())
|
||||||
|
if isinstance(query_date, str):
|
||||||
|
try:
|
||||||
|
date.fromisoformat(query_date)
|
||||||
|
except Exception:
|
||||||
|
query_date = IrDate.today()
|
||||||
|
|
||||||
|
# query balances of cashbooks and sub-cashbooks
|
||||||
|
with Transaction().set_context({
|
||||||
|
'date': query_date}):
|
||||||
|
(tab_line, tab2) = cls.get_balance_of_cashbook_sql()
|
||||||
|
tab_subids = sub_ids_hierarchical('cashbook.book')
|
||||||
|
query = tab_book.join(
|
||||||
|
tab_subids,
|
||||||
|
condition=tab_book.id == tab_subids.parent,
|
||||||
|
).join(
|
||||||
|
tab_comp,
|
||||||
|
condition=tab_book.company == tab_comp.id,
|
||||||
|
).join(
|
||||||
|
tab_line,
|
||||||
|
condition=tab_line.cashbook == AnyInArray(
|
||||||
|
tab_subids.subids),
|
||||||
|
).select(
|
||||||
|
tab_book.id,
|
||||||
|
tab_book.currency.as_('to_currency'),
|
||||||
|
tab_line.currency.as_('from_currency'),
|
||||||
|
tab_comp.currency.as_('company_currency'),
|
||||||
|
Sum(tab_line.balance).as_('balance'),
|
||||||
|
Sum(tab_line.balance_all).as_('balance_all'),
|
||||||
|
group_by=[
|
||||||
|
tab_book.id, tab_line.currency, tab_comp.currency],
|
||||||
|
where=tab_book.id.in_([x.id for x in cashbooks]),
|
||||||
|
)
|
||||||
|
cursor.execute(*query)
|
||||||
|
records = cursor.fetchall()
|
||||||
|
|
||||||
|
for record in records:
|
||||||
|
result['balance'][record[0]] += Currency.compute(
|
||||||
|
record[2], record[4], record[1])
|
||||||
|
result['balance_all'][record[0]] += Currency.compute(
|
||||||
|
record[2], record[5], record[1])
|
||||||
|
result['balance_ref'][record[0]] += Currency.compute(
|
||||||
|
record[2], record[5], record[3])
|
||||||
|
return result
|
||||||
|
|
||||||
|
@fields.depends('id')
|
||||||
|
def on_change_with_has_lines(self, name=None):
|
||||||
|
""" return True if cashbook has lines
|
||||||
|
(we dont use 'if self.lines:' this would slow down the client)
|
||||||
"""
|
"""
|
||||||
Line = Pool().get('cashbook.line')
|
Line = Pool().get('cashbook.line')
|
||||||
tab_line = Line.__table__()
|
|
||||||
cursor = Transaction().connection.cursor()
|
|
||||||
|
|
||||||
query = tab_line.select(
|
if Line.search_count([('cashbook', '=', self.id)]):
|
||||||
Sum(tab_line.credit - tab_line.debit).as_('balance'),
|
return True
|
||||||
group_by=[tab_line.cashbook],
|
return False
|
||||||
where=tab_line.cashbook == self.id
|
|
||||||
)
|
|
||||||
|
|
||||||
if self.id:
|
@fields.depends('btype')
|
||||||
if self.start_balance is not None:
|
def on_change_with_feature(self, name=None):
|
||||||
balance = self.start_balance
|
""" get feature-set
|
||||||
cursor.execute(*query)
|
"""
|
||||||
result = cursor.fetchone()
|
if self.btype:
|
||||||
if result:
|
return self.btype.feature
|
||||||
balance += result[0]
|
|
||||||
return balance
|
@fields.depends('currency')
|
||||||
|
def on_change_with_currency_digits(self, name=None):
|
||||||
|
""" currency of cashbook
|
||||||
|
"""
|
||||||
|
if self.currency:
|
||||||
|
return self.currency.digits
|
||||||
|
else:
|
||||||
|
return 2
|
||||||
|
|
||||||
|
@fields.depends('company', 'currency', 'btype')
|
||||||
|
def on_change_with_company_currency(self, name=None):
|
||||||
|
""" get company-currency if its different from current
|
||||||
|
cashbook-currency, disable if book is a view
|
||||||
|
"""
|
||||||
|
if self.company:
|
||||||
|
if self.currency:
|
||||||
|
if self.btype:
|
||||||
|
if self.company.currency.id != self.currency.id:
|
||||||
|
return self.company.currency.id
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
|
@ -243,29 +608,60 @@ class Book(Workflow, ModelSQL, ModelView):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, vlist):
|
||||||
|
""" update values
|
||||||
|
"""
|
||||||
|
records = super(Book, cls).create(vlist)
|
||||||
|
cls.valuestore_update_records(records)
|
||||||
|
return records
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def write(cls, *args):
|
def write(cls, *args):
|
||||||
""" deny update if book is not 'open'
|
""" deny update if book is not 'open'
|
||||||
"""
|
"""
|
||||||
|
ConfigUser = Pool().get('cashbook.configuration_user')
|
||||||
|
|
||||||
actions = iter(args)
|
actions = iter(args)
|
||||||
|
to_write_config = []
|
||||||
|
to_update = []
|
||||||
for books, values in zip(actions, actions):
|
for books, values in zip(actions, actions):
|
||||||
|
to_update.extend(books)
|
||||||
for book in books:
|
for book in books:
|
||||||
if 'start_balance' in values.keys():
|
# deny btype-->None if lines not empty
|
||||||
if len(book.lines) > 0:
|
if 'btype' in values.keys():
|
||||||
|
if (values['btype'] is None) and (len(book.lines) > 0):
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_book_err_startamount_with_lines',
|
'cashbook.msg_book_btype_with_lines',
|
||||||
bookname = book.rec_name,
|
cbname=book.rec_name,
|
||||||
))
|
numlines=len(book.lines)))
|
||||||
|
|
||||||
if book.state != 'open':
|
if book.state != 'open':
|
||||||
# allow state-update, if its the only action
|
# allow state-update, if its the only action
|
||||||
if not (('state' in values.keys()) and (len(values.keys()) == 1)):
|
if not (('state' in values.keys()) and
|
||||||
|
(len(values.keys()) == 1)):
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_book_deny_write',
|
'cashbook.msg_book_deny_write',
|
||||||
bookname=book.rec_name,
|
bookname=book.rec_name,
|
||||||
state_txt = book.state_string,
|
state_txt=book.state_string))
|
||||||
))
|
|
||||||
|
# if owner changes, remove book from user-config
|
||||||
|
if 'owner' in values.keys():
|
||||||
|
if book.owner.id != values['owner']:
|
||||||
|
for x in [
|
||||||
|
'defbook', 'book1', 'book2', 'book3',
|
||||||
|
'book4', 'book5']:
|
||||||
|
cfg1 = ConfigUser.search([
|
||||||
|
('iduser', '=', book.owner.id),
|
||||||
|
('%s.id' % x, '=', book.id)])
|
||||||
|
if len(cfg1) > 0:
|
||||||
|
to_write_config.extend([cfg1, {x: None}])
|
||||||
super(Book, cls).write(*args)
|
super(Book, cls).write(*args)
|
||||||
|
|
||||||
|
if len(to_write_config) > 0:
|
||||||
|
ConfigUser.write(*to_write_config)
|
||||||
|
cls.valuestore_update_records(to_update)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def delete(cls, books):
|
def delete(cls, books):
|
||||||
""" deny delete if book has lines
|
""" deny delete if book has lines
|
||||||
|
@ -275,8 +671,7 @@ class Book(Workflow, ModelSQL, ModelView):
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_book_deny_delete',
|
'cashbook.msg_book_deny_delete',
|
||||||
bookname=book.rec_name,
|
bookname=book.rec_name,
|
||||||
booklines = len(book.lines),
|
booklines=len(book.lines)))
|
||||||
))
|
super(Book, cls).delete(books)
|
||||||
return super(Book, cls).delete(books)
|
|
||||||
|
|
||||||
# end Book
|
# end Book
|
||||||
|
|
81
book.xml
81
book.xml
|
@ -12,6 +12,13 @@ full copyright notices and license terms. -->
|
||||||
<field name="priority" eval="10"/>
|
<field name="priority" eval="10"/>
|
||||||
<field name="name">book_list</field>
|
<field name="name">book_list</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.ui.view" id="book_view_tree">
|
||||||
|
<field name="model">cashbook.book</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="priority" eval="10"/>
|
||||||
|
<field name="field_childs">childs</field>
|
||||||
|
<field name="name">book_tree</field>
|
||||||
|
</record>
|
||||||
<record model="ir.ui.view" id="book_view_form">
|
<record model="ir.ui.view" id="book_view_form">
|
||||||
<field name="model">cashbook.book</field>
|
<field name="model">cashbook.book</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
|
@ -19,10 +26,11 @@ full copyright notices and license terms. -->
|
||||||
<field name="name">book_form</field>
|
<field name="name">book_form</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- action view-->
|
<!-- action view - list -->
|
||||||
<record model="ir.action.act_window" id="act_book_view">
|
<record model="ir.action.act_window" id="act_book_view">
|
||||||
<field name="name">Cashbook</field>
|
<field name="name">Cashbook</field>
|
||||||
<field name="res_model">cashbook.book</field>
|
<field name="res_model">cashbook.book</field>
|
||||||
|
<field name="domain" eval="[('btype', '!=', None)]" pyson="1"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.view" id="act_book_view-1">
|
<record model="ir.action.act_window.view" id="act_book_view-1">
|
||||||
<field name="sequence" eval="10"/>
|
<field name="sequence" eval="10"/>
|
||||||
|
@ -35,6 +43,23 @@ full copyright notices and license terms. -->
|
||||||
<field name="act_window" ref="act_book_view"/>
|
<field name="act_window" ref="act_book_view"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- action view - tree -->
|
||||||
|
<record model="ir.action.act_window" id="act_book_tree">
|
||||||
|
<field name="name">Cashbook</field>
|
||||||
|
<field name="res_model">cashbook.book</field>
|
||||||
|
<field name="domain" eval="[('parent', '=', None)]" pyson="1"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.action.act_window.view" id="act_book_tree-1">
|
||||||
|
<field name="sequence" eval="10"/>
|
||||||
|
<field name="view" ref="book_view_tree"/>
|
||||||
|
<field name="act_window" ref="act_book_tree"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.action.act_window.view" id="act_book_tree-2">
|
||||||
|
<field name="sequence" eval="20"/>
|
||||||
|
<field name="view" ref="book_view_form"/>
|
||||||
|
<field name="act_window" ref="act_book_tree"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- permission -->
|
<!-- permission -->
|
||||||
<!-- anon: deny all -->
|
<!-- anon: deny all -->
|
||||||
<record model="ir.model.access" id="access_book-anon">
|
<record model="ir.model.access" id="access_book-anon">
|
||||||
|
@ -96,7 +121,7 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_book_rw_owner-1">
|
<record model="ir.rule" id="rg_book_rw_owner-1">
|
||||||
<field name="domain" eval="[
|
<field name="domain" eval="[
|
||||||
('owner.id', '=', Eval('user', {}).get('id', -1)),
|
('owner.id', '=', Eval('user_id', -1)),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_book_rw_owner"/>
|
<field name="rule_group" ref="rg_book_rw_owner"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -118,8 +143,8 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_book_read_nonowner-1">
|
<record model="ir.rule" id="rg_book_read_nonowner-1">
|
||||||
<field name="domain" eval="['OR',
|
<field name="domain" eval="['OR',
|
||||||
('observer.id', 'in', Eval('user', {}).get('groups', [])),
|
('observer.id', 'in', Eval('groups', [])),
|
||||||
('reviewer.id', 'in', Eval('user', {}).get('groups', [])),
|
('reviewer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_book_read_nonowner"/>
|
<field name="rule_group" ref="rg_book_read_nonowner"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -251,18 +276,24 @@ full copyright notices and license terms. -->
|
||||||
<field name="perm_read" eval="False"/>
|
<field name="perm_read" eval="False"/>
|
||||||
<field name="perm_write" eval="False"/>
|
<field name="perm_write" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.model.field.access" id="fa_book-start_balance-anon">
|
|
||||||
<field name="field"
|
|
||||||
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'start_balance')]"/>
|
|
||||||
<field name="perm_read" eval="False"/>
|
|
||||||
<field name="perm_write" eval="False"/>
|
|
||||||
</record>
|
|
||||||
<record model="ir.model.field.access" id="fa_book-currency-anon">
|
<record model="ir.model.field.access" id="fa_book-currency-anon">
|
||||||
<field name="field"
|
<field name="field"
|
||||||
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'currency')]"/>
|
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'currency')]"/>
|
||||||
<field name="perm_read" eval="False"/>
|
<field name="perm_read" eval="False"/>
|
||||||
<field name="perm_write" eval="False"/>
|
<field name="perm_write" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.model.field.access" id="fa_book-parent-anon">
|
||||||
|
<field name="field"
|
||||||
|
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'parent')]"/>
|
||||||
|
<field name="perm_read" eval="False"/>
|
||||||
|
<field name="perm_write" eval="False"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.model.field.access" id="fa_book-childs-anon">
|
||||||
|
<field name="field"
|
||||||
|
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'childs')]"/>
|
||||||
|
<field name="perm_read" eval="False"/>
|
||||||
|
<field name="perm_write" eval="False"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- field-access - group_cashbook_admin -->
|
<!-- field-access - group_cashbook_admin -->
|
||||||
<record model="ir.model.field.access" id="fa_book-company-group_cashbook_admin">
|
<record model="ir.model.field.access" id="fa_book-company-group_cashbook_admin">
|
||||||
|
@ -335,16 +366,23 @@ full copyright notices and license terms. -->
|
||||||
<field name="perm_read" eval="True"/>
|
<field name="perm_read" eval="True"/>
|
||||||
<field name="perm_write" eval="True"/>
|
<field name="perm_write" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.model.field.access" id="fa_book-start_balance-group_cashbook_admin">
|
<record model="ir.model.field.access" id="fa_book-currency-group_cashbook_admin">
|
||||||
<field name="field"
|
<field name="field"
|
||||||
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'start_balance')]"/>
|
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'currency')]"/>
|
||||||
<field name="group" ref="group_cashbook_admin"/>
|
<field name="group" ref="group_cashbook_admin"/>
|
||||||
<field name="perm_read" eval="True"/>
|
<field name="perm_read" eval="True"/>
|
||||||
<field name="perm_write" eval="True"/>
|
<field name="perm_write" eval="True"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.model.field.access" id="fa_book-currency-group_cashbook_admin">
|
<record model="ir.model.field.access" id="fa_book-parent-group_cashbook_admin">
|
||||||
<field name="field"
|
<field name="field"
|
||||||
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'currency')]"/>
|
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'parent')]"/>
|
||||||
|
<field name="group" ref="group_cashbook_admin"/>
|
||||||
|
<field name="perm_read" eval="True"/>
|
||||||
|
<field name="perm_write" eval="True"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.model.field.access" id="fa_book-childs-group_cashbook_admin">
|
||||||
|
<field name="field"
|
||||||
|
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'childs')]"/>
|
||||||
<field name="group" ref="group_cashbook_admin"/>
|
<field name="group" ref="group_cashbook_admin"/>
|
||||||
<field name="perm_read" eval="True"/>
|
<field name="perm_read" eval="True"/>
|
||||||
<field name="perm_write" eval="True"/>
|
<field name="perm_write" eval="True"/>
|
||||||
|
@ -421,16 +459,23 @@ full copyright notices and license terms. -->
|
||||||
<field name="perm_read" eval="True"/>
|
<field name="perm_read" eval="True"/>
|
||||||
<field name="perm_write" eval="False"/>
|
<field name="perm_write" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.model.field.access" id="fa_book-start_balance-group_cashbook">
|
<record model="ir.model.field.access" id="fa_book-currency-group_cashbook">
|
||||||
<field name="field"
|
<field name="field"
|
||||||
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'start_balance')]"/>
|
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'currency')]"/>
|
||||||
<field name="group" ref="group_cashbook"/>
|
<field name="group" ref="group_cashbook"/>
|
||||||
<field name="perm_read" eval="True"/>
|
<field name="perm_read" eval="True"/>
|
||||||
<field name="perm_write" eval="False"/>
|
<field name="perm_write" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.model.field.access" id="fa_book-currency-group_cashbook">
|
<record model="ir.model.field.access" id="fa_book-parent-group_cashbook">
|
||||||
<field name="field"
|
<field name="field"
|
||||||
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'currency')]"/>
|
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'parent')]"/>
|
||||||
|
<field name="group" ref="group_cashbook"/>
|
||||||
|
<field name="perm_read" eval="True"/>
|
||||||
|
<field name="perm_write" eval="False"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.model.field.access" id="fa_book-childs-group_cashbook">
|
||||||
|
<field name="field"
|
||||||
|
search="[('model.model', '=', 'cashbook.book'), ('name', '=', 'childs')]"/>
|
||||||
<field name="group" ref="group_cashbook"/>
|
<field name="group" ref="group_cashbook"/>
|
||||||
<field name="perm_read" eval="True"/>
|
<field name="perm_read" eval="True"/>
|
||||||
<field name="perm_write" eval="False"/>
|
<field name="perm_write" eval="False"/>
|
||||||
|
|
70
category.py
70
category.py
|
@ -3,12 +3,15 @@
|
||||||
# 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 ModelView, ModelSQL, fields, Unique, tree, sequence_ordered
|
from trytond.model import ModelView, ModelSQL, fields, Unique, Exclude, tree
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.pyson import Eval, If, Bool
|
from trytond.pyson import Eval, If, Bool
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
|
from sql.operators import Equal
|
||||||
|
from .model import order_name_hierarchical
|
||||||
|
from .const import DEF_NONE
|
||||||
|
|
||||||
|
|
||||||
sel_categorytype = [
|
sel_categorytype = [
|
||||||
|
@ -17,43 +20,68 @@ sel_categorytype = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class Category(tree(separator='/'), sequence_ordered(), ModelSQL, ModelView):
|
class Category(tree(separator='/'), ModelSQL, ModelView):
|
||||||
'Category'
|
'Category'
|
||||||
__name__ = 'cashbook.category'
|
__name__ = 'cashbook.category'
|
||||||
|
|
||||||
name = fields.Char(string='Name', required=True, translate=True)
|
name = fields.Char(string='Name', required=True, translate=True)
|
||||||
description = fields.Char(string='Description', translate=True)
|
description = fields.Char(string='Description', translate=True)
|
||||||
cattype = fields.Selection(string='Type', required=True,
|
cattype = fields.Selection(
|
||||||
|
string='Type', required=True,
|
||||||
help='Type of Category', selection=sel_categorytype,
|
help='Type of Category', selection=sel_categorytype,
|
||||||
states={'readonly': Bool(Eval('parent_cattype'))},
|
states={'readonly': Bool(Eval('parent_cattype'))},
|
||||||
domain=[If(Bool(Eval('parent_cattype')),
|
domain=[If(Bool(Eval('parent_cattype')),
|
||||||
('cattype', '=', Eval('parent_cattype', '')),
|
('cattype', '=', Eval('parent_cattype', '')),
|
||||||
())],
|
())],
|
||||||
depends=['parent_cattype'])
|
depends=['parent_cattype'])
|
||||||
parent_cattype = fields.Function(fields.Char(string='Parent Category Type',
|
parent_cattype = fields.Function(fields.Char(
|
||||||
|
string='Parent Category Type',
|
||||||
readonly=True, states={'invisible': True}),
|
readonly=True, states={'invisible': True}),
|
||||||
'on_change_with_parent_cattype')
|
'on_change_with_parent_cattype')
|
||||||
|
|
||||||
company = fields.Many2One(string='Company', model_name='company.company',
|
company = fields.Many2One(
|
||||||
|
string='Company', model_name='company.company',
|
||||||
required=True, ondelete="RESTRICT")
|
required=True, ondelete="RESTRICT")
|
||||||
sequence = fields.Integer(string='Sequence', select=True)
|
parent = fields.Many2One(
|
||||||
parent = fields.Many2One(string="Parent",
|
string="Parent",
|
||||||
model_name='cashbook.category', ondelete='RESTRICT',
|
model_name='cashbook.category', ondelete='RESTRICT')
|
||||||
left='left', right='right')
|
childs = fields.One2Many(
|
||||||
childs = fields.One2Many(string='Children', field='parent',
|
string='Children', field='parent',
|
||||||
model_name='cashbook.category')
|
model_name='cashbook.category')
|
||||||
left = fields.Integer(string='Left', required=True, select=True)
|
|
||||||
right = fields.Integer(string='Right', required=True, select=True)
|
@classmethod
|
||||||
|
def __register__(cls, module_name):
|
||||||
|
super(Category, cls).__register__(module_name)
|
||||||
|
table = cls.__table_handler__(module_name)
|
||||||
|
table.drop_column('left')
|
||||||
|
table.drop_column('right')
|
||||||
|
cls.migrate_sequence(module_name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(Category, cls).__setup__()
|
super(Category, cls).__setup__()
|
||||||
cls._order.insert(0, ('name', 'ASC'))
|
cls._order.insert(0, ('rec_name', 'ASC'))
|
||||||
t = cls.__table__()
|
t = cls.__table__()
|
||||||
cls._sql_constraints.extend([
|
cls._sql_constraints.extend([
|
||||||
('name_uniq', Unique(t, t.name, t.company, t.parent), 'cashbook.msg_category_name_unique'),
|
('name_uniq',
|
||||||
|
Unique(t, t.name, t.company, t.parent),
|
||||||
|
'cashbook.msg_category_name_unique'),
|
||||||
|
('name2_uniq',
|
||||||
|
Exclude(
|
||||||
|
t,
|
||||||
|
(t.name, Equal),
|
||||||
|
(t.cattype, Equal),
|
||||||
|
where=(t.parent == DEF_NONE)),
|
||||||
|
'cashbook.msg_category_name_unique'),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def migrate_sequence(cls, module_name):
|
||||||
|
""" remove colum 'sequence'
|
||||||
|
"""
|
||||||
|
table = cls.__table_handler__(module_name)
|
||||||
|
table.drop_column('sequence')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_cattype(cls):
|
def default_cattype(cls):
|
||||||
return 'out'
|
return 'out'
|
||||||
|
@ -63,12 +91,11 @@ class Category(tree(separator='/'), sequence_ordered(), ModelSQL, ModelView):
|
||||||
return Transaction().context.get('company') or None
|
return Transaction().context.get('company') or None
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_left():
|
def order_rec_name(tables):
|
||||||
return 0
|
""" order by pos
|
||||||
|
a recursive sorting
|
||||||
@staticmethod
|
"""
|
||||||
def default_right():
|
return order_name_hierarchical('cashbook.category', tables)
|
||||||
return 0
|
|
||||||
|
|
||||||
@fields.depends('parent', '_parent_parent.cattype')
|
@fields.depends('parent', '_parent_parent.cattype')
|
||||||
def on_change_with_parent_cattype(self, name=None):
|
def on_change_with_parent_cattype(self, name=None):
|
||||||
|
@ -87,8 +114,7 @@ class Category(tree(separator='/'), sequence_ordered(), ModelSQL, ModelView):
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_category_type_not_like_parent',
|
'cashbook.msg_category_type_not_like_parent',
|
||||||
parentname=category.parent.rec_name,
|
parentname=category.parent.rec_name,
|
||||||
catname = category.rec_name,
|
catname=category.rec_name,))
|
||||||
))
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, vlist):
|
def create(cls, vlist):
|
||||||
|
|
29
category.xml
29
category.xml
|
@ -42,6 +42,20 @@ full copyright notices and license terms. -->
|
||||||
<field name="act_window" ref="act_category_list"/>
|
<field name="act_window" ref="act_category_list"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- domain view - list -->
|
||||||
|
<record model="ir.action.act_window.domain" id="act_category_list_domain_in">
|
||||||
|
<field name="name">Revenue</field>
|
||||||
|
<field name="sequence" eval="10"/>
|
||||||
|
<field name="domain" eval="[('cattype', '=', 'in')]" pyson="1"/>
|
||||||
|
<field name="act_window" ref="act_category_list"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.action.act_window.domain" id="act_category_list_domain_out">
|
||||||
|
<field name="name">Expense</field>
|
||||||
|
<field name="sequence" eval="20"/>
|
||||||
|
<field name="domain" eval="[('cattype', '=', 'out')]" pyson="1"/>
|
||||||
|
<field name="act_window" ref="act_category_list"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- action view - tree -->
|
<!-- action view - tree -->
|
||||||
<record model="ir.action.act_window" id="act_category_tree">
|
<record model="ir.action.act_window" id="act_category_tree">
|
||||||
<field name="name">Category</field>
|
<field name="name">Category</field>
|
||||||
|
@ -59,6 +73,21 @@ full copyright notices and license terms. -->
|
||||||
<field name="act_window" ref="act_category_tree"/>
|
<field name="act_window" ref="act_category_tree"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- domain view - tree -->
|
||||||
|
<record model="ir.action.act_window.domain" id="act_category_tree_domain_in">
|
||||||
|
<field name="name">Revenue</field>
|
||||||
|
<field name="sequence" eval="10"/>
|
||||||
|
<field name="domain" eval="[('cattype', '=', 'in')]" pyson="1"/>
|
||||||
|
<field name="act_window" ref="act_category_tree"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.action.act_window.domain" id="act_category_tree_domain_out">
|
||||||
|
<field name="name">Expense</field>
|
||||||
|
<field name="sequence" eval="20"/>
|
||||||
|
<field name="domain" eval="[('cattype', '=', 'out')]" pyson="1"/>
|
||||||
|
<field name="act_window" ref="act_category_tree"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<!-- permission -->
|
<!-- permission -->
|
||||||
<!-- anon: deny all -->
|
<!-- anon: deny all -->
|
||||||
<record model="ir.model.access" id="access_category-anon">
|
<record model="ir.model.access" id="access_category-anon">
|
||||||
|
|
11
cbreport.py
11
cbreport.py
|
@ -20,7 +20,8 @@ class ReconciliationReport(Report):
|
||||||
Company = Pool().get('company.company')
|
Company = Pool().get('company.company')
|
||||||
context2 = Transaction().context
|
context2 = Transaction().context
|
||||||
|
|
||||||
context = super(ReconciliationReport, cls).get_context(records, header, data)
|
context = super(
|
||||||
|
ReconciliationReport, cls).get_context(records, header, data)
|
||||||
context['company'] = Company(context2['company'])
|
context['company'] = Company(context2['company'])
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
@ -43,12 +44,12 @@ class ReconciliationReport(Report):
|
||||||
'cashbook.msg_rep_reconciliation_fname',
|
'cashbook.msg_rep_reconciliation_fname',
|
||||||
recname=recon_obj.cashbook.rec_name[:50],
|
recname=recon_obj.cashbook.rec_name[:50],
|
||||||
date_from=recon_obj.date_from.isoformat(),
|
date_from=recon_obj.date_from.isoformat(),
|
||||||
date_to = recon_obj.date_to.isoformat(),
|
date_to=recon_obj.date_to.isoformat())
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
raise ValueError('invalid model')
|
raise ValueError('invalid model')
|
||||||
|
|
||||||
(ext1, cont1, dirprint, title) = super(ReconciliationReport, cls).execute(ids, data)
|
(ext1, cont1, dirprint, title) = super(
|
||||||
|
ReconciliationReport, cls).execute(ids, data)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
ext1,
|
ext1,
|
||||||
|
@ -63,5 +64,3 @@ class ReconciliationReport(Report):
|
||||||
)
|
)
|
||||||
|
|
||||||
# end ReconciliationReport
|
# end ReconciliationReport
|
||||||
|
|
||||||
|
|
||||||
|
|
141
configuration.py
141
configuration.py
|
@ -9,33 +9,70 @@ from trytond.pyson import Eval, If
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
|
|
||||||
|
|
||||||
field_checked = fields.Boolean(string='Checked',
|
field_checked = fields.Boolean(
|
||||||
|
string='Checked',
|
||||||
help='Show cashbook lines in Checked-state.')
|
help='Show cashbook lines in Checked-state.')
|
||||||
field_done = fields.Boolean(string='Done',
|
field_done = fields.Boolean(
|
||||||
|
string='Done',
|
||||||
help='Show cashbook lines in Done-state.')
|
help='Show cashbook lines in Done-state.')
|
||||||
field_catnamelong = fields.Boolean(string='Category: Show long name',
|
field_catnamelong = fields.Boolean(
|
||||||
help='Shows the long name of the category in the Category field of a cash book line.')
|
string='Category: Show long name',
|
||||||
|
help='Shows the long name of the category in the Category ' +
|
||||||
|
'field of a cash book line.')
|
||||||
|
|
||||||
|
|
||||||
class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
||||||
'Configuration'
|
'Configuration'
|
||||||
__name__ = 'cashbook.configuration'
|
__name__ = 'cashbook.configuration'
|
||||||
|
|
||||||
date_from = fields.MultiValue(fields.Date(string='Start Date', depends=['date_to'],
|
date_from = fields.MultiValue(fields.Date(
|
||||||
|
string='Start Date', depends=['date_to'],
|
||||||
domain=[
|
domain=[
|
||||||
If(Eval('date_to') & Eval('date_from'),
|
If(Eval('date_to') & Eval('date_from'),
|
||||||
('date_from', '<=', Eval('date_to')),
|
('date_from', '<=', Eval('date_to')),
|
||||||
()),
|
())]))
|
||||||
]))
|
date_to = fields.MultiValue(fields.Date(
|
||||||
date_to = fields.MultiValue(fields.Date(string='End Date', depends=['date_from'],
|
string='End Date', depends=['date_from'],
|
||||||
domain=[
|
domain=[
|
||||||
If(Eval('date_to') & Eval('date_from'),
|
If(Eval('date_to') & Eval('date_from'),
|
||||||
('date_from', '<=', Eval('date_to')),
|
('date_from', '<=', Eval('date_to')),
|
||||||
()),
|
())]))
|
||||||
]))
|
|
||||||
checked = fields.MultiValue(field_checked)
|
checked = fields.MultiValue(field_checked)
|
||||||
done = fields.MultiValue(field_done)
|
done = fields.MultiValue(field_done)
|
||||||
catnamelong = fields.MultiValue(field_catnamelong)
|
catnamelong = fields.MultiValue(field_catnamelong)
|
||||||
|
defbook = fields.MultiValue(fields.Many2One(
|
||||||
|
string='Default Cashbook',
|
||||||
|
help='The default cashbook is selected when you open ' +
|
||||||
|
'the booking wizard.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[('btype', '!=', None), ('state', '=', 'open')]))
|
||||||
|
book1 = fields.MultiValue(fields.Many2One(
|
||||||
|
string='Cashbook 1',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[('btype', '!=', None), ('state', '=', 'open')]))
|
||||||
|
book2 = fields.MultiValue(fields.Many2One(
|
||||||
|
string='Cashbook 2',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[('btype', '!=', None), ('state', '=', 'open')]))
|
||||||
|
book3 = fields.MultiValue(fields.Many2One(
|
||||||
|
string='Cashbook 3',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[('btype', '!=', None), ('state', '=', 'open')]))
|
||||||
|
book4 = fields.MultiValue(fields.Many2One(
|
||||||
|
string='Cashbook 4',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[('btype', '!=', None), ('state', '=', 'open')]))
|
||||||
|
book5 = fields.MultiValue(fields.Many2One(
|
||||||
|
string='Cashbook 5',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[('btype', '!=', None), ('state', '=', 'open')]))
|
||||||
|
fixate = fields.MultiValue(fields.Boolean(
|
||||||
|
string='Fixate', help='Fixating of the booking is activated.'))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def multivalue_model(cls, field):
|
def multivalue_model(cls, field):
|
||||||
|
@ -43,8 +80,10 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
||||||
"""
|
"""
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
|
|
||||||
if field in ['date_from', 'date_to', 'checked', 'done',
|
if field in [
|
||||||
'catnamelong']:
|
'date_from', 'date_to', 'checked', 'done',
|
||||||
|
'catnamelong', 'defbook', 'book1', 'book2',
|
||||||
|
'book3', 'book4', 'book5', 'fixate']:
|
||||||
return pool.get('cashbook.configuration_user')
|
return pool.get('cashbook.configuration_user')
|
||||||
return super(Configuration, cls).multivalue_model(field)
|
return super(Configuration, cls).multivalue_model(field)
|
||||||
|
|
||||||
|
@ -60,6 +99,10 @@ class Configuration(ModelSingleton, ModelSQL, ModelView, UserMultiValueMixin):
|
||||||
def default_catnamelong(cls, **pattern):
|
def default_catnamelong(cls, **pattern):
|
||||||
return cls.multivalue_model('catnamelong').default_catnamelong()
|
return cls.multivalue_model('catnamelong').default_catnamelong()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_fixate(cls, **pattern):
|
||||||
|
return cls.multivalue_model('fixate').default_fixate()
|
||||||
|
|
||||||
# end Configuration
|
# end Configuration
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,21 +110,79 @@ class UserConfiguration(ModelSQL, UserValueMixin):
|
||||||
'User Configuration'
|
'User Configuration'
|
||||||
__name__ = 'cashbook.configuration_user'
|
__name__ = 'cashbook.configuration_user'
|
||||||
|
|
||||||
date_from = fields.Date(string='Start Date', depends=['date_to'],
|
date_from = fields.Date(
|
||||||
|
string='Start Date', depends=['date_to'],
|
||||||
domain=[
|
domain=[
|
||||||
If(Eval('date_to') & Eval('date_from'),
|
If(Eval('date_to') & Eval('date_from'),
|
||||||
('date_from', '<=', Eval('date_to')),
|
('date_from', '<=', Eval('date_to')),
|
||||||
()),
|
())])
|
||||||
])
|
date_to = fields.Date(
|
||||||
date_to = fields.Date(string='End Date', depends=['date_from'],
|
string='End Date', depends=['date_from'],
|
||||||
domain=[
|
domain=[
|
||||||
If(Eval('date_to') & Eval('date_from'),
|
If(Eval('date_to') & Eval('date_from'),
|
||||||
('date_from', '<=', Eval('date_to')),
|
('date_from', '<=', Eval('date_to')),
|
||||||
()),
|
())])
|
||||||
])
|
|
||||||
checked = field_checked
|
checked = field_checked
|
||||||
done = field_done
|
done = field_done
|
||||||
catnamelong = field_catnamelong
|
catnamelong = field_catnamelong
|
||||||
|
defbook = fields.Many2One(
|
||||||
|
string='Default Cashbook',
|
||||||
|
help='The default cashbook is selected when you open ' +
|
||||||
|
'the booking wizard.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[
|
||||||
|
('btype', '!=', None),
|
||||||
|
('state', '=', 'open'),
|
||||||
|
('owner.id', '=', Eval('iduser', -1))
|
||||||
|
], depends=['iduser'])
|
||||||
|
book1 = fields.Many2One(
|
||||||
|
string='Cashbook 1',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[
|
||||||
|
('btype', '!=', None),
|
||||||
|
('state', '=', 'open'),
|
||||||
|
('owner.id', '=', Eval('iduser', -1))
|
||||||
|
], depends=['iduser'])
|
||||||
|
book2 = fields.Many2One(
|
||||||
|
string='Cashbook 2',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[
|
||||||
|
('btype', '!=', None),
|
||||||
|
('state', '=', 'open'),
|
||||||
|
('owner.id', '=', Eval('iduser', -1))
|
||||||
|
], depends=['iduser'])
|
||||||
|
book3 = fields.Many2One(
|
||||||
|
string='Cashbook 3',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[
|
||||||
|
('btype', '!=', None),
|
||||||
|
('state', '=', 'open'),
|
||||||
|
('owner.id', '=', Eval('iduser', -1))
|
||||||
|
], depends=['iduser'])
|
||||||
|
book4 = fields.Many2One(
|
||||||
|
string='Cashbook 4',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[
|
||||||
|
('btype', '!=', None),
|
||||||
|
('state', '=', 'open'),
|
||||||
|
('owner.id', '=', Eval('iduser', -1))
|
||||||
|
], depends=['iduser'])
|
||||||
|
book5 = fields.Many2One(
|
||||||
|
string='Cashbook 5',
|
||||||
|
help='Cash book available in selection dialog.',
|
||||||
|
model_name='cashbook.book', ondelete='SET NULL',
|
||||||
|
domain=[
|
||||||
|
('btype', '!=', None),
|
||||||
|
('state', '=', 'open'),
|
||||||
|
('owner.id', '=', Eval('iduser', -1))
|
||||||
|
], depends=['iduser'])
|
||||||
|
|
||||||
|
fixate = fields.Boolean(
|
||||||
|
string='Fixate', help='Fixating of the booking is activated.')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_checked(cls):
|
def default_checked(cls):
|
||||||
|
@ -95,4 +196,8 @@ class UserConfiguration(ModelSQL, UserValueMixin):
|
||||||
def default_done(cls):
|
def default_done(cls):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_fixate(cls):
|
||||||
|
return False
|
||||||
|
|
||||||
# end UserConfiguration
|
# end UserConfiguration
|
||||||
|
|
8
const.py
Normal file
8
const.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
|
||||||
|
DEF_NONE = None
|
||||||
|
|
18
cron.py
Normal file
18
cron.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
from trytond.pool import PoolMeta
|
||||||
|
|
||||||
|
|
||||||
|
class Cron(metaclass=PoolMeta):
|
||||||
|
__name__ = 'ir.cron'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __setup__(cls):
|
||||||
|
super(Cron, cls).__setup__()
|
||||||
|
cls.method.selection.append(
|
||||||
|
('cashbook.values|maintenance_values', "Update Cashbooks"))
|
||||||
|
|
||||||
|
# end Cron
|
15
cron.xml
Normal file
15
cron.xml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
full copyright notices and license terms. -->
|
||||||
|
<tryton>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record model="ir.cron" id="asset_cron">
|
||||||
|
<field name="method">cashbook.values|maintenance_values</field>
|
||||||
|
<field name="interval_number" eval="1"/>
|
||||||
|
<field name="interval_type">hours</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</tryton>
|
63
currency.py
Normal file
63
currency.py
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
from trytond.pool import PoolMeta, Pool
|
||||||
|
|
||||||
|
|
||||||
|
class CurrencyRate(metaclass=PoolMeta):
|
||||||
|
__name__ = 'currency.currency.rate'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def create(cls, vlist):
|
||||||
|
""" update cache-value
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Cashbook = pool.get('cashbook.book')
|
||||||
|
ValueStore = pool.get('cashbook.values')
|
||||||
|
|
||||||
|
records = super(CurrencyRate, cls).create(vlist)
|
||||||
|
|
||||||
|
ValueStore.update_books(
|
||||||
|
ValueStore.get_book_by_books(
|
||||||
|
Cashbook.search([
|
||||||
|
('currency', 'in', [
|
||||||
|
x.currency.id for x in records])])))
|
||||||
|
return records
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def write(cls, *args):
|
||||||
|
""" update cache-value
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Cashbook = pool.get('cashbook.book')
|
||||||
|
ValueStore = pool.get('cashbook.values')
|
||||||
|
|
||||||
|
actions = iter(args)
|
||||||
|
all_rates = []
|
||||||
|
for rates, values in zip(actions, actions):
|
||||||
|
all_rates.extend(rates)
|
||||||
|
|
||||||
|
super(CurrencyRate, cls).write(*args)
|
||||||
|
|
||||||
|
ValueStore.update_books(
|
||||||
|
ValueStore.get_book_by_books(
|
||||||
|
Cashbook.search([
|
||||||
|
('currency', 'in', [
|
||||||
|
x.currency.id for x in all_rates])])))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def delete(cls, records):
|
||||||
|
""" set cache to None
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Cashbook = pool.get('cashbook.book')
|
||||||
|
ValueStore = pool.get('cashbook.values')
|
||||||
|
|
||||||
|
books = ValueStore.get_book_by_books(Cashbook.search([
|
||||||
|
('currency', 'in', [x.currency.id for x in records])]))
|
||||||
|
super(CurrencyRate, cls).delete(records)
|
||||||
|
ValueStore.update_books(books)
|
||||||
|
|
||||||
|
# end
|
21
docs/settings.txt
Normal file
21
docs/settings.txt
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
settings in tytond.conf
|
||||||
|
|
||||||
|
[cashbook]
|
||||||
|
# enable caching of values, stores values between
|
||||||
|
# browser requests, speeds up the retrieval of data.
|
||||||
|
# default: yes
|
||||||
|
memcache = yes
|
||||||
|
|
||||||
|
# Enables synchronization of the cache between multiple
|
||||||
|
# server instances.
|
||||||
|
# default: yes
|
||||||
|
# Requires the setting :
|
||||||
|
# [cache]
|
||||||
|
# clean_timeout=0
|
||||||
|
sync = yes
|
||||||
|
|
||||||
|
# Enables caching of the cache key for currency rates.
|
||||||
|
# Reduces the time required to determine the cache
|
||||||
|
# key for currency values.
|
||||||
|
# default: yes
|
||||||
|
cache_currency = yes
|
24
ir.py
Normal file
24
ir.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
from trytond.pool import PoolMeta
|
||||||
|
|
||||||
|
|
||||||
|
class Rule(metaclass=PoolMeta):
|
||||||
|
__name__ = 'ir.rule'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _context_modelnames(cls):
|
||||||
|
""" list of models to add 'user_id' to context
|
||||||
|
"""
|
||||||
|
result = super(Rule, cls)._context_modelnames()
|
||||||
|
return result | {
|
||||||
|
'cashbook.book',
|
||||||
|
'cashbook.line',
|
||||||
|
'cashbook.recon',
|
||||||
|
'cashbook.split'
|
||||||
|
}
|
||||||
|
|
||||||
|
# end Rule
|
56
line.xml
56
line.xml
|
@ -18,6 +18,12 @@ full copyright notices and license terms. -->
|
||||||
<field name="priority" eval="10"/>
|
<field name="priority" eval="10"/>
|
||||||
<field name="name">line_list</field>
|
<field name="name">line_list</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.ui.view" id="line_recon_view_list">
|
||||||
|
<field name="model">cashbook.line</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="priority" eval="15"/>
|
||||||
|
<field name="name">line_recon_list</field>
|
||||||
|
</record>
|
||||||
<record model="ir.ui.view" id="line_view_form">
|
<record model="ir.ui.view" id="line_view_form">
|
||||||
<field name="model">cashbook.line</field>
|
<field name="model">cashbook.line</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
|
@ -26,32 +32,34 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- action view -->
|
<!-- action view -->
|
||||||
<record model="ir.action.act_window" id="act_line_view">
|
<record model="ir.action.act_window" id="act_line_view2">
|
||||||
<field name="name">Cashbook Line</field>
|
<field name="name">Cashbook Line</field>
|
||||||
<field name="res_model">cashbook.line</field>
|
<field name="res_model">cashbook.line</field>
|
||||||
<field name="context_model">cashbook.line.context</field>
|
<field name="context_model">cashbook.line.context</field>
|
||||||
<field name="context_domain"
|
<field name="context_domain"
|
||||||
eval="[
|
eval="[
|
||||||
('cashbook', '=', Eval('cashbook', -1)),
|
|
||||||
If(Bool(Eval('date_from')), ('date', '>=', Eval('date_from')), ()),
|
If(Bool(Eval('date_from')), ('date', '>=', Eval('date_from')), ()),
|
||||||
If(Bool(Eval('date_to')), ('date', '<=', Eval('date_to')), ()),
|
If(Bool(Eval('date_to')), ('date', '<=', Eval('date_to')), ()),
|
||||||
['OR',
|
['OR',
|
||||||
('state', '=', 'edit'),
|
('state', '=', 'edit'),
|
||||||
If(Bool(Eval('done')), ('state', '=', 'done'), ('state', '=', 'edit')),
|
If(Bool(Eval('done')), ('state', '=', 'done'), ('state', '=', 'edit')),
|
||||||
If(Bool(Eval('checked')), ('state', '=', 'check'), ('state', '=', 'edit')),
|
If(Bool(Eval('checked')), ('state', 'in', ['check', 'recon']), ('state', '=', 'edit')),
|
||||||
],
|
],
|
||||||
]"
|
]"
|
||||||
pyson="1"/>
|
pyson="1"/>
|
||||||
|
<field name="domain"
|
||||||
|
eval="[('cashbook', '=', Eval('cashbook', -1))]"
|
||||||
|
pyson="1"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.view" id="act_line_view-1">
|
<record model="ir.action.act_window.view" id="act_line_view2-1">
|
||||||
<field name="sequence" eval="10"/>
|
<field name="sequence" eval="10"/>
|
||||||
<field name="view" ref="line_view_list"/>
|
<field name="view" ref="line_view_list"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.view" id="act_line_view-2">
|
<record model="ir.action.act_window.view" id="act_line_view2-2">
|
||||||
<field name="sequence" eval="20"/>
|
<field name="sequence" eval="20"/>
|
||||||
<field name="view" ref="line_view_form"/>
|
<field name="view" ref="line_view_form"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- domain view -->
|
<!-- domain view -->
|
||||||
|
@ -60,20 +68,20 @@ full copyright notices and license terms. -->
|
||||||
<field name="sequence" eval="10"/>
|
<field name="sequence" eval="10"/>
|
||||||
<field name="domain" eval="[('month', '=', 0)]" pyson="1"/>
|
<field name="domain" eval="[('month', '=', 0)]" pyson="1"/>
|
||||||
<field name="count" eval="True"/>
|
<field name="count" eval="True"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.domain" id="act_line_domain_last">
|
<record model="ir.action.act_window.domain" id="act_line_domain_last">
|
||||||
<field name="name">Last Month</field>
|
<field name="name">Last Month</field>
|
||||||
<field name="sequence" eval="20"/>
|
<field name="sequence" eval="20"/>
|
||||||
<field name="domain" eval="[('month', '=', 1)]" pyson="1"/>
|
<field name="domain" eval="[('month', '=', 1)]" pyson="1"/>
|
||||||
<field name="count" eval="True"/>
|
<field name="count" eval="True"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.action.act_window.domain" id="act_line_domain_all">
|
<record model="ir.action.act_window.domain" id="act_line_domain_all">
|
||||||
<field name="name">All</field>
|
<field name="name">All</field>
|
||||||
<field name="sequence" eval="999"/>
|
<field name="sequence" eval="999"/>
|
||||||
<field name="domain"/>
|
<field name="domain"/>
|
||||||
<field name="act_window" ref="act_line_view"/>
|
<field name="act_window" ref="act_line_view2"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- permission -->
|
<!-- permission -->
|
||||||
|
@ -137,8 +145,8 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_line_write-1">
|
<record model="ir.rule" id="rg_line_write-1">
|
||||||
<field name="domain" eval="['OR',
|
<field name="domain" eval="['OR',
|
||||||
('cashbook.owner.id', '=', Eval('user', {}).get('id', -1)),
|
('cashbook.owner.id', '=', Eval('user_id', -1)),
|
||||||
('cashbook.reviewer.id', 'in', Eval('user', {}).get('groups', [])),
|
('cashbook.reviewer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_line_write"/>
|
<field name="rule_group" ref="rg_line_write"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -160,7 +168,7 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_line_read-1">
|
<record model="ir.rule" id="rg_line_read-1">
|
||||||
<field name="domain" eval="[
|
<field name="domain" eval="[
|
||||||
('cashbook.observer.id', 'in', Eval('user', {}).get('groups', [])),
|
('cashbook.observer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_line_read"/>
|
<field name="rule_group" ref="rg_line_read"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -227,6 +235,28 @@ full copyright notices and license terms. -->
|
||||||
<field name="group" ref="group_cashbook_doneline"/>
|
<field name="group" ref="group_cashbook_doneline"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- button - recon -->
|
||||||
|
<record model="ir.model.button" id="line_wfrecon_button">
|
||||||
|
<field name="name">wfrecon</field>
|
||||||
|
<field name="string">Reconciled</field>
|
||||||
|
<field name="model" search="[('model', '=', 'cashbook.line')]"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.model.button-res.group"
|
||||||
|
id="line_wfrecon_button-group_cashbook_admin">
|
||||||
|
<field name="button" ref="line_wfrecon_button"/>
|
||||||
|
<field name="group" ref="group_cashbook_admin"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.model.button-res.group"
|
||||||
|
id="line_wfrecon_button-group_cashbook_checkline">
|
||||||
|
<field name="button" ref="line_wfrecon_button"/>
|
||||||
|
<field name="group" ref="group_cashbook_checkline"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.model.button-res.group"
|
||||||
|
id="line_wfrecon_button-group_cashbook_doneline">
|
||||||
|
<field name="button" ref="line_wfrecon_button"/>
|
||||||
|
<field name="group" ref="group_cashbook_doneline"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- button - done -->
|
<!-- button - done -->
|
||||||
<record model="ir.model.button" id="line_wfdone_button">
|
<record model="ir.model.button" id="line_wfdone_button">
|
||||||
<field name="name">wfdone</field>
|
<field name="name">wfdone</field>
|
||||||
|
|
556
locale/de.po
556
locale/de.po
|
@ -3,6 +3,14 @@ msgid ""
|
||||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||||
|
|
||||||
|
|
||||||
|
###########
|
||||||
|
# ir.cron #
|
||||||
|
###########
|
||||||
|
msgctxt "selection:ir.cron,method:"
|
||||||
|
msgid "Update Cashbooks"
|
||||||
|
msgstr "Kassenbücher Aktualisieren"
|
||||||
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
# ir.message #
|
# ir.message #
|
||||||
##############
|
##############
|
||||||
|
@ -70,10 +78,6 @@ msgctxt "model:ir.message,text:msg_category_type_not_like_parent"
|
||||||
msgid "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
msgid "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
||||||
msgstr "Der Typ der aktuellen Kategorie '%(catname)s' muß gleich dem Typ der übergeordneten Kategorie '%(parentname)s' sein."
|
msgstr "Der Typ der aktuellen Kategorie '%(catname)s' muß gleich dem Typ der übergeordneten Kategorie '%(parentname)s' sein."
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_book_err_startamount_with_lines"
|
|
||||||
msgid "The initial amount of the cash book '%(bookname)s' cannot be changed because it already contains bookings."
|
|
||||||
msgstr "Der Anfangsbetrag des Kassenbuchs '%(bookname)s' kann nicht geändert werden, da es bereits Buchungen enthält."
|
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_line_deny_recon_by_state"
|
msgctxt "model:ir.message,text:msg_line_deny_recon_by_state"
|
||||||
msgid "For reconciliation, the line '%(recname)s' must be in the status 'Check' or 'Done'."
|
msgid "For reconciliation, the line '%(recname)s' must be in the status 'Check' or 'Done'."
|
||||||
msgstr "Für die Abstimmung muss die Zeile '%(recname)s' im Status 'Prüfen' oder 'Fertig' sein."
|
msgstr "Für die Abstimmung muss die Zeile '%(recname)s' im Status 'Prüfen' oder 'Fertig' sein."
|
||||||
|
@ -150,6 +154,26 @@ msgctxt "model:ir.message,text:msg_line_invalid_category"
|
||||||
msgid "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'."
|
msgid "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'."
|
||||||
msgstr "Die Kategorie der Buchungszeile '%(recname)s' paßt nicht zum Buchungstyp '%(booktype)s'."
|
msgstr "Die Kategorie der Buchungszeile '%(recname)s' paßt nicht zum Buchungstyp '%(booktype)s'."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_book_btype_with_lines"
|
||||||
|
msgid "The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines."
|
||||||
|
msgstr "Der Typ kann am Kassenbuch '%(cbname)s' nicht gelöscht werden, da es noch %(numlines)s Zeilen enthält."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_book_no_type_noopen"
|
||||||
|
msgid "The cash book '%(bookname)s' has no type and therefore cannot be opened."
|
||||||
|
msgstr "Das Kassenbuch '%(bookname)s' hat keinen Typ und kann daher nicht geöffnet werden."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_btype_general"
|
||||||
|
msgid "General"
|
||||||
|
msgstr "Allgemein"
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_value_exists_in_store"
|
||||||
|
msgid "The value already exists for the record."
|
||||||
|
msgstr "Der Wert existiert für den Datensatz bereits."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_nosearch_with_date"
|
||||||
|
msgid "Search with 'date' no allowed for field '%(fname)s' on model '%(model)s'."
|
||||||
|
msgstr "Suche mit 'date' nicht erlaubt für Feld '%(fname)s' auf Modell '%(model)s'."
|
||||||
|
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# res.group #
|
# res.group #
|
||||||
|
@ -258,6 +282,10 @@ msgctxt "model:ir.ui.menu,name:menu_booklist"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Kassenbuch"
|
msgstr "Kassenbuch"
|
||||||
|
|
||||||
|
msgctxt "model:ir.ui.menu,name:menu_booktree"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Kassenbuch"
|
||||||
|
|
||||||
msgctxt "model:ir.ui.menu,name:menu_open_lines"
|
msgctxt "model:ir.ui.menu,name:menu_open_lines"
|
||||||
msgid "Open Cashbook"
|
msgid "Open Cashbook"
|
||||||
msgstr "Kassenbuch öffnen"
|
msgstr "Kassenbuch öffnen"
|
||||||
|
@ -274,6 +302,10 @@ msgctxt "model:ir.ui.menu,name:act_category_view"
|
||||||
msgid "Category"
|
msgid "Category"
|
||||||
msgstr "Kategorie"
|
msgstr "Kategorie"
|
||||||
|
|
||||||
|
msgctxt "model:ir.ui.menu,name:menu_enter_booking"
|
||||||
|
msgid "Enter Booking"
|
||||||
|
msgstr "Buchung eingeben"
|
||||||
|
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# ir.action #
|
# ir.action #
|
||||||
|
@ -282,11 +314,15 @@ msgctxt "model:ir.action,name:act_book_view"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Kassenbuch"
|
msgstr "Kassenbuch"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action,name:act_book_tree"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Kassenbuch"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:act_type_view"
|
msgctxt "model:ir.action,name:act_type_view"
|
||||||
msgid "Cashbook Type"
|
msgid "Cashbook Type"
|
||||||
msgstr "Kassenbuchtyp"
|
msgstr "Kassenbuchtyp"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:act_line_view"
|
msgctxt "model:ir.action,name:act_line_view2"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Kassenbuchzeile"
|
msgstr "Kassenbuchzeile"
|
||||||
|
|
||||||
|
@ -294,6 +330,10 @@ msgctxt "model:ir.action,name:act_open_lines"
|
||||||
msgid "Open Cashbook"
|
msgid "Open Cashbook"
|
||||||
msgstr "Kassenbuch öffnen"
|
msgstr "Kassenbuch öffnen"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action,name:act_open_tree_lines"
|
||||||
|
msgid "Open Cashbook"
|
||||||
|
msgstr "Kassenbuch öffnen"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:report_cashbook"
|
msgctxt "model:ir.action,name:report_cashbook"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Kassenbuch"
|
msgstr "Kassenbuch"
|
||||||
|
@ -302,6 +342,10 @@ msgctxt "model:ir.action,name:act_wizard_report"
|
||||||
msgid "Cashbook Report"
|
msgid "Cashbook Report"
|
||||||
msgstr "Kassenbuch Bericht"
|
msgstr "Kassenbuch Bericht"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action,name:act_enterbooking_wiz"
|
||||||
|
msgid "Enter Booking"
|
||||||
|
msgstr "Buchung eingeben"
|
||||||
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
# ir.action.act_window.domain #
|
# ir.action.act_window.domain #
|
||||||
|
@ -318,6 +362,22 @@ msgctxt "model:ir.action.act_window.domain,name:act_line_domain_all"
|
||||||
msgid "All"
|
msgid "All"
|
||||||
msgstr "Alle"
|
msgstr "Alle"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action.act_window.domain,name:act_category_tree_domain_in"
|
||||||
|
msgid "Revenue"
|
||||||
|
msgstr "Einnahmen"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action.act_window.domain,name:act_category_tree_domain_out"
|
||||||
|
msgid "Expense"
|
||||||
|
msgstr "Ausgaben"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action.act_window.domain,name:act_category_list_domain_in"
|
||||||
|
msgid "Revenue"
|
||||||
|
msgstr "Einnahmen"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action.act_window.domain,name:act_category_list_domain_out"
|
||||||
|
msgid "Expense"
|
||||||
|
msgstr "Ausgaben"
|
||||||
|
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# ir.model.button #
|
# ir.model.button #
|
||||||
|
@ -330,6 +390,10 @@ msgctxt "model:ir.model.button,string:line_wfcheck_button"
|
||||||
msgid "Check"
|
msgid "Check"
|
||||||
msgstr "Prüfen"
|
msgstr "Prüfen"
|
||||||
|
|
||||||
|
msgctxt "model:ir.model.button,string:line_wfrecon_button"
|
||||||
|
msgid "Reconciled"
|
||||||
|
msgstr "Abgeglichen"
|
||||||
|
|
||||||
msgctxt "model:ir.model.button,string:line_wfdone_button"
|
msgctxt "model:ir.model.button,string:line_wfdone_button"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Fertig"
|
msgstr "Fertig"
|
||||||
|
@ -386,22 +450,46 @@ msgctxt "model:cashbook.book,name:"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Kassenbuch"
|
msgstr "Kassenbuch"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.book:"
|
||||||
|
msgid "Balance"
|
||||||
|
msgstr "Saldo"
|
||||||
|
|
||||||
msgctxt "view:cashbook.book:"
|
msgctxt "view:cashbook.book:"
|
||||||
msgid "Owner and Authorizeds"
|
msgid "Owner and Authorizeds"
|
||||||
msgstr "Eigentümer und Autorisierte"
|
msgstr "Eigentümer und Autorisierte"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.book:"
|
||||||
|
msgid "General Information"
|
||||||
|
msgstr "Allgemein"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.book:"
|
||||||
|
msgid "Amount and Numbering"
|
||||||
|
msgstr "Betrag und Nummerierung"
|
||||||
|
|
||||||
msgctxt "view:cashbook.book:"
|
msgctxt "view:cashbook.book:"
|
||||||
msgid "Reconciliations"
|
msgid "Reconciliations"
|
||||||
msgstr "Abstimmungen"
|
msgstr "Abstimmungen"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.book:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Beschreibung"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,name:"
|
msgctxt "field:cashbook.book,name:"
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Name"
|
msgstr "Name"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,description:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Beschreibung"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,btype:"
|
msgctxt "field:cashbook.book,btype:"
|
||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Typ"
|
msgstr "Typ"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.book,btype:"
|
||||||
|
msgid "A cash book with type can contain postings. Without type is a view."
|
||||||
|
msgstr "Ein Kassenbuch mit Typ kann Buchungen enthalten. Ohne Typ ist eine Sicht."
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,state:"
|
msgctxt "field:cashbook.book,state:"
|
||||||
msgid "State"
|
msgid "State"
|
||||||
msgstr "Status"
|
msgstr "Status"
|
||||||
|
@ -446,9 +534,9 @@ msgctxt "field:cashbook.book,currency:"
|
||||||
msgid "Currency"
|
msgid "Currency"
|
||||||
msgstr "Währung"
|
msgstr "Währung"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,start_balance:"
|
msgctxt "field:cashbook.book,currency_digits:"
|
||||||
msgid "Initial Amount"
|
msgid "Currency Digits"
|
||||||
msgstr "Anfangsbetrag"
|
msgstr "Nachkommastellen Währung"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,start_date:"
|
msgctxt "field:cashbook.book,start_date:"
|
||||||
msgid "Initial Date"
|
msgid "Initial Date"
|
||||||
|
@ -458,6 +546,18 @@ msgctxt "field:cashbook.book,balance:"
|
||||||
msgid "Balance"
|
msgid "Balance"
|
||||||
msgstr "Saldo"
|
msgstr "Saldo"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.book,balance:"
|
||||||
|
msgid "Balance of bookings to date"
|
||||||
|
msgstr "Saldo der Buchungen bis zum heutigen Tag"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,balance_all:"
|
||||||
|
msgid "Total balance"
|
||||||
|
msgstr "Gesamtsaldo"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.book,balance_all:"
|
||||||
|
msgid "Balance of all bookings"
|
||||||
|
msgstr "Saldo aller Buchungen"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,reconciliations:"
|
msgctxt "field:cashbook.book,reconciliations:"
|
||||||
msgid "Reconciliations"
|
msgid "Reconciliations"
|
||||||
msgstr "Abstimmungen"
|
msgstr "Abstimmungen"
|
||||||
|
@ -482,6 +582,42 @@ msgctxt "help:cashbook.book,number_atcheck:"
|
||||||
msgid "The numbering of the lines is done in the step Check. If the check mark is inactive, this happens with Done."
|
msgid "The numbering of the lines is done in the step Check. If the check mark is inactive, this happens with Done."
|
||||||
msgstr "Die Nummerierung der Zeilen wird beim Schritt 'Prüfen' erledigt. Bei inaktivem Häkchen passiert dies erst bei 'Fertig'."
|
msgstr "Die Nummerierung der Zeilen wird beim Schritt 'Prüfen' erledigt. Bei inaktivem Häkchen passiert dies erst bei 'Fertig'."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,parent:"
|
||||||
|
msgid "Parent"
|
||||||
|
msgstr "Übergeordnet"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,childs:"
|
||||||
|
msgid "Children"
|
||||||
|
msgstr "Untergeordnet"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,balance_ref:"
|
||||||
|
msgid "Balance (Ref.)"
|
||||||
|
msgstr "Saldo (Ref.)"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.book,balance_ref:"
|
||||||
|
msgid "Balance in company currency"
|
||||||
|
msgstr "Saldo in der Unternehmenswährung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,company_currency:"
|
||||||
|
msgid "Company Currency"
|
||||||
|
msgstr "Unternehmenswährung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,company_currency_digits:"
|
||||||
|
msgid "Currency Digits (Ref.)"
|
||||||
|
msgstr "Nachkommastellen Währung (Ref.)"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,booktransf_feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,value_store:"
|
||||||
|
msgid "Values"
|
||||||
|
msgstr "Werte"
|
||||||
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# cashbook.split #
|
# cashbook.split #
|
||||||
|
@ -494,6 +630,10 @@ msgctxt "view:cashbook.split:"
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Beschreibung"
|
msgstr "Beschreibung"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.split:"
|
||||||
|
msgid "Amount"
|
||||||
|
msgstr "Betrag"
|
||||||
|
|
||||||
msgctxt "field:cashbook.split,line:"
|
msgctxt "field:cashbook.split,line:"
|
||||||
msgid "Line"
|
msgid "Line"
|
||||||
msgstr "Zeile"
|
msgstr "Zeile"
|
||||||
|
@ -562,6 +702,10 @@ msgctxt "selection:cashbook.split,state:"
|
||||||
msgid "Checked"
|
msgid "Checked"
|
||||||
msgstr "Geprüft"
|
msgstr "Geprüft"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,state:"
|
||||||
|
msgid "Reconciled"
|
||||||
|
msgstr "Abgeglichen"
|
||||||
|
|
||||||
msgctxt "selection:cashbook.split,state:"
|
msgctxt "selection:cashbook.split,state:"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Fertig"
|
msgstr "Fertig"
|
||||||
|
@ -570,6 +714,74 @@ msgctxt "field:cashbook.split,state_cashbook:"
|
||||||
msgid "State of Cashbook"
|
msgid "State of Cashbook"
|
||||||
msgstr "Kassenbuchstatus"
|
msgstr "Kassenbuchstatus"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,splittype:"
|
||||||
|
msgid "Type"
|
||||||
|
msgstr "Typ"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.split,splittype:"
|
||||||
|
msgid "Type of split booking line"
|
||||||
|
msgstr "Typ der Splitbuchungszeile"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,splittype:"
|
||||||
|
msgid "Category"
|
||||||
|
msgstr "Kategorie"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,splittype:"
|
||||||
|
msgid "Transfer"
|
||||||
|
msgstr "Umbuchung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,target:"
|
||||||
|
msgid "Target"
|
||||||
|
msgstr "Ziel"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,target:"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Kassenbuch"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,target:"
|
||||||
|
msgid "Category"
|
||||||
|
msgstr "Kategorie"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,cashbook:"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Kassenbuch"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,owner_cashbook:"
|
||||||
|
msgid "Owner"
|
||||||
|
msgstr "Eigentümer"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,booktransf:"
|
||||||
|
msgid "Source/Dest"
|
||||||
|
msgstr "Quelle/Ziel"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,currency2nd:"
|
||||||
|
msgid "2nd Currency"
|
||||||
|
msgstr "Fremdwährung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,currency2nd_digits:"
|
||||||
|
msgid "2nd Currency Digits"
|
||||||
|
msgstr "Nachkommastellen Fremdwährung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,amount_2nd_currency:"
|
||||||
|
msgid "Amount Second Currency"
|
||||||
|
msgstr "Fremdwährungsbetrag"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,rate_2nd_currency:"
|
||||||
|
msgid "Rate"
|
||||||
|
msgstr "Kurs"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.split,rate_2nd_currency:"
|
||||||
|
msgid "Exchange rate between the currencies of the participating cashbooks."
|
||||||
|
msgstr "Wechselkurs zwischen der Währungen der beteiligten Kassenbücher."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,booktransf_feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# cashbook.line #
|
# cashbook.line #
|
||||||
|
@ -578,14 +790,6 @@ msgctxt "model:cashbook.line,name:"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Kassenbuchzeile"
|
msgstr "Kassenbuchzeile"
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
|
||||||
msgid "Credit"
|
|
||||||
msgstr "Einnahme"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
|
||||||
msgid "Debit"
|
|
||||||
msgstr "Ausgabe"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
msgctxt "view:cashbook.line:"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Kassenbuchzeile"
|
msgstr "Kassenbuchzeile"
|
||||||
|
@ -618,6 +822,10 @@ msgctxt "field:cashbook.line,description:"
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Beschreibung"
|
msgstr "Beschreibung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,descr_short:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Beschreibung"
|
||||||
|
|
||||||
msgctxt "field:cashbook.line,state:"
|
msgctxt "field:cashbook.line,state:"
|
||||||
msgid "State"
|
msgid "State"
|
||||||
msgstr "Status"
|
msgstr "Status"
|
||||||
|
@ -630,6 +838,10 @@ msgctxt "selection:cashbook.line,state:"
|
||||||
msgid "Checked"
|
msgid "Checked"
|
||||||
msgstr "Geprüft"
|
msgstr "Geprüft"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.line,state:"
|
||||||
|
msgid "Reconciled"
|
||||||
|
msgstr "Abgeglichen"
|
||||||
|
|
||||||
msgctxt "selection:cashbook.line,state:"
|
msgctxt "selection:cashbook.line,state:"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Fertig"
|
msgstr "Fertig"
|
||||||
|
@ -766,6 +978,34 @@ msgctxt "help:cashbook.line,splitlines:"
|
||||||
msgid "Rows with different categories form the total sum of the booking"
|
msgid "Rows with different categories form the total sum of the booking"
|
||||||
msgstr "Zeilen mit unterschiedlichen Kategorien bilden die Gesamtsumme der Buchung"
|
msgstr "Zeilen mit unterschiedlichen Kategorien bilden die Gesamtsumme der Buchung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,currency2nd:"
|
||||||
|
msgid "2nd Currency"
|
||||||
|
msgstr "Fremdwährung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,currency2nd_digits:"
|
||||||
|
msgid "2nd Currency Digits"
|
||||||
|
msgstr "Nachkommastellen Fremdwährung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,amount_2nd_currency:"
|
||||||
|
msgid "Amount Second Currency"
|
||||||
|
msgstr "Fremdwährungsbetrag"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,rate_2nd_currency:"
|
||||||
|
msgid "Rate"
|
||||||
|
msgstr "Kurs"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.line,rate_2nd_currency:"
|
||||||
|
msgid "Exchange rate between the currencies of the participating cashbooks."
|
||||||
|
msgstr "Wechselkurs zwischen der Währungen der beteiligten Kassenbücher."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,booktransf_feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# cashbook.type #
|
# cashbook.type #
|
||||||
|
@ -786,6 +1026,14 @@ msgctxt "field:cashbook.type,company:"
|
||||||
msgid "Company"
|
msgid "Company"
|
||||||
msgstr "Unternehmen"
|
msgstr "Unternehmen"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.type,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.type,feature:"
|
||||||
|
msgid "Select feature set of the Cashbook."
|
||||||
|
msgstr "Wählen Sie den Funktionsumfang des Kassenbuchs aus."
|
||||||
|
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# cashbook.category #
|
# cashbook.category #
|
||||||
|
@ -822,14 +1070,6 @@ msgctxt "field:cashbook.category,childs:"
|
||||||
msgid "Children"
|
msgid "Children"
|
||||||
msgstr "Untergeordnet"
|
msgstr "Untergeordnet"
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,left:"
|
|
||||||
msgid "Left"
|
|
||||||
msgstr "Links"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,right:"
|
|
||||||
msgid "Right"
|
|
||||||
msgstr "Rechts"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,cattype:"
|
msgctxt "field:cashbook.category,cattype:"
|
||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Typ"
|
msgstr "Typ"
|
||||||
|
@ -894,6 +1134,10 @@ msgctxt "model:cashbook.open_lines,name:"
|
||||||
msgid "Open Cashbook"
|
msgid "Open Cashbook"
|
||||||
msgstr "Kassenbuch öffnen"
|
msgstr "Kassenbuch öffnen"
|
||||||
|
|
||||||
|
msgctxt "model:cashbook.open_lines_tree,name:"
|
||||||
|
msgid "Open Cashbook"
|
||||||
|
msgstr "Kassenbuch öffnen"
|
||||||
|
|
||||||
msgctxt "wizard_button:cashbook.open_lines,askuser,end:"
|
msgctxt "wizard_button:cashbook.open_lines,askuser,end:"
|
||||||
msgid "Cancel"
|
msgid "Cancel"
|
||||||
msgstr "Abbruch"
|
msgstr "Abbruch"
|
||||||
|
@ -934,10 +1178,18 @@ msgctxt "field:cashbook.line.context,date_from:"
|
||||||
msgid "Start Date"
|
msgid "Start Date"
|
||||||
msgstr "Beginndatum"
|
msgstr "Beginndatum"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.line.context,date_from:"
|
||||||
|
msgid "Limits the date range for the displayed entries."
|
||||||
|
msgstr "Begrenzt den Datumsbereich für die angezeigten Einträge."
|
||||||
|
|
||||||
msgctxt "field:cashbook.line.context,date_to:"
|
msgctxt "field:cashbook.line.context,date_to:"
|
||||||
msgid "End Date"
|
msgid "End Date"
|
||||||
msgstr "Endedatum"
|
msgstr "Endedatum"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.line.context,date_to:"
|
||||||
|
msgid "Limits the date range for the displayed entries."
|
||||||
|
msgstr "Begrenzt den Datumsbereich für die angezeigten Einträge."
|
||||||
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# cashbook.configuration #
|
# cashbook.configuration #
|
||||||
|
@ -946,6 +1198,10 @@ msgctxt "model:cashbook.configuration,name:"
|
||||||
msgid "Configuration"
|
msgid "Configuration"
|
||||||
msgstr "Konfiguration"
|
msgstr "Konfiguration"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.configuration:"
|
||||||
|
msgid "Enter Booking Wizard"
|
||||||
|
msgstr "Dialog: Buchung eingeben"
|
||||||
|
|
||||||
msgctxt "view:cashbook.configuration:"
|
msgctxt "view:cashbook.configuration:"
|
||||||
msgid "Open Cashbook Wizard"
|
msgid "Open Cashbook Wizard"
|
||||||
msgstr "Dialog: Kassenbuch öffnen"
|
msgstr "Dialog: Kassenbuch öffnen"
|
||||||
|
@ -954,6 +1210,62 @@ msgctxt "view:cashbook.configuration:"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Kassenbuch"
|
msgstr "Kassenbuch"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,defbook:"
|
||||||
|
msgid "Default Cashbook"
|
||||||
|
msgstr "Standardkassenbuch"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,defbook:"
|
||||||
|
msgid "The default cashbook is selected when you open the booking wizard."
|
||||||
|
msgstr "Das Standardkassenbuch wird beim Öffnen des Buchungswizards ausgewählt."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book1:"
|
||||||
|
msgid "Cashbook 1"
|
||||||
|
msgstr "Kassenbuch 1"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book1:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book2:"
|
||||||
|
msgid "Cashbook 2"
|
||||||
|
msgstr "Kassenbuch 2"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book2:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book3:"
|
||||||
|
msgid "Cashbook 3"
|
||||||
|
msgstr "Kassenbuch 3"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book3:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book4:"
|
||||||
|
msgid "Cashbook 4"
|
||||||
|
msgstr "Kassenbuch 4"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book4:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book5:"
|
||||||
|
msgid "Cashbook 5"
|
||||||
|
msgstr "Kassenbuch 5"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book5:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,fixate:"
|
||||||
|
msgid "Fixate"
|
||||||
|
msgstr "Festschreiben"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,fixate:"
|
||||||
|
msgid "Fixating of the booking is activated."
|
||||||
|
msgstr "Die Festschreiben der Buchung ist aktiviert."
|
||||||
|
|
||||||
msgctxt "field:cashbook.configuration,date_from:"
|
msgctxt "field:cashbook.configuration,date_from:"
|
||||||
msgid "Start Date"
|
msgid "Start Date"
|
||||||
msgstr "Beginndatum"
|
msgstr "Beginndatum"
|
||||||
|
@ -1026,6 +1338,62 @@ msgctxt "help:cashbook.configuration_user,catnamelong:"
|
||||||
msgid "Shows the long name of the category in the Category field of a cash book line."
|
msgid "Shows the long name of the category in the Category field of a cash book line."
|
||||||
msgstr "Zeigt im Feld 'Kategorie' einer Kassenbuchzeile den langen Namen der Kategorie."
|
msgstr "Zeigt im Feld 'Kategorie' einer Kassenbuchzeile den langen Namen der Kategorie."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,defbook:"
|
||||||
|
msgid "Default Cashbook"
|
||||||
|
msgstr "Standardkassenbuch"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,defbook:"
|
||||||
|
msgid "The default cashbook is selected when you open the booking wizard."
|
||||||
|
msgstr "Das Standardkassenbuch wird beim Öffnen des Buchungswizards ausgewählt."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book1:"
|
||||||
|
msgid "Cashbook 1"
|
||||||
|
msgstr "Kassenbuch 1"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book1:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book2:"
|
||||||
|
msgid "Cashbook 2"
|
||||||
|
msgstr "Kassenbuch 2"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book2:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book3:"
|
||||||
|
msgid "Cashbook 3"
|
||||||
|
msgstr "Kassenbuch 3"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book3:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book4:"
|
||||||
|
msgid "Cashbook 4"
|
||||||
|
msgstr "Kassenbuch 4"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book4:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book5:"
|
||||||
|
msgid "Cashbook 5"
|
||||||
|
msgstr "Kassenbuch 5"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book5:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "in Auswahldialog verfügbares Kassenbuch."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,fixate:"
|
||||||
|
msgid "Fixate"
|
||||||
|
msgstr "Festschreiben"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,fixate:"
|
||||||
|
msgid "Fixating of the booking is activated."
|
||||||
|
msgstr "Die Festschreiben der Buchung ist aktiviert."
|
||||||
|
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# cashbook.recon #
|
# cashbook.recon #
|
||||||
|
@ -1106,6 +1474,10 @@ msgctxt "field:cashbook.recon,predecessor:"
|
||||||
msgid "Predecessor"
|
msgid "Predecessor"
|
||||||
msgstr "Vorgänger"
|
msgstr "Vorgänger"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.recon,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Merkmal"
|
||||||
|
|
||||||
|
|
||||||
#############################
|
#############################
|
||||||
# cashbook.runrepbook.start #
|
# cashbook.runrepbook.start #
|
||||||
|
@ -1209,3 +1581,139 @@ msgstr "Gesamt"
|
||||||
msgctxt "report:cashbook.reprecon:"
|
msgctxt "report:cashbook.reprecon:"
|
||||||
msgid "Payee"
|
msgid "Payee"
|
||||||
msgstr "Empfänger"
|
msgstr "Empfänger"
|
||||||
|
|
||||||
|
|
||||||
|
###############################
|
||||||
|
# cashbook.enterbooking.start #
|
||||||
|
###############################
|
||||||
|
msgctxt "model:cashbook.enterbooking.start,name:"
|
||||||
|
msgid "Enter Booking"
|
||||||
|
msgstr "Buchung eingeben"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.enterbooking.start:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Beschreibung"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.enterbooking.start:"
|
||||||
|
msgid "Booking"
|
||||||
|
msgstr "Buchung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,cashbook:"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Kassenbuch"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,cashbooks:"
|
||||||
|
msgid "Cashbooks"
|
||||||
|
msgstr "Kassenbücher"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,currency_digits:"
|
||||||
|
msgid "Currency Digits"
|
||||||
|
msgstr "Nachkommastellen Währung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,currency:"
|
||||||
|
msgid "Currency"
|
||||||
|
msgstr "Währung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Type"
|
||||||
|
msgstr "Typ"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Revenue"
|
||||||
|
msgstr "Einnahme"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Revenue Splitbooking"
|
||||||
|
msgstr "Einnahme Splitbuchung"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Expense"
|
||||||
|
msgstr "Ausgabe"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Expense Splitbooking"
|
||||||
|
msgstr "Ausgabe Splitbuchung"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Transfer from"
|
||||||
|
msgstr "Umbuchung von"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Transfer to"
|
||||||
|
msgstr "Umbuchung nach"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,amount:"
|
||||||
|
msgid "Amount"
|
||||||
|
msgstr "Betrag"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,owner_cashbook:"
|
||||||
|
msgid "Owner"
|
||||||
|
msgstr "Eigentümer"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,category:"
|
||||||
|
msgid "Category"
|
||||||
|
msgstr "Kategorie"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,booktransf:"
|
||||||
|
msgid "Source/Dest"
|
||||||
|
msgstr "Quelle/Ziel"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,party:"
|
||||||
|
msgid "Party"
|
||||||
|
msgstr "Partei"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,description:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Beschreibung"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,fixate:"
|
||||||
|
msgid "Fixate"
|
||||||
|
msgstr "Festschreiben"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.enterbooking.start,fixate:"
|
||||||
|
msgid "The booking is fixed immediately."
|
||||||
|
msgstr "Die Buchung wird sofort festgeschrieben."
|
||||||
|
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# cashbook.enterbooking #
|
||||||
|
#########################
|
||||||
|
msgctxt "model:cashbook.enterbooking,name:"
|
||||||
|
msgid "Enter Booking"
|
||||||
|
msgstr "Buchung eingeben"
|
||||||
|
|
||||||
|
msgctxt "wizard_button:cashbook.enterbooking,start,end:"
|
||||||
|
msgid "Cancel"
|
||||||
|
msgstr "Abbruch"
|
||||||
|
|
||||||
|
msgctxt "wizard_button:cashbook.enterbooking,start,save_:"
|
||||||
|
msgid "Save"
|
||||||
|
msgstr "Speichern"
|
||||||
|
|
||||||
|
msgctxt "wizard_button:cashbook.enterbooking,start,savenext_:"
|
||||||
|
msgid "Save & Next"
|
||||||
|
msgstr "Speichern & Weiter"
|
||||||
|
|
||||||
|
|
||||||
|
###################
|
||||||
|
# cashbook.values #
|
||||||
|
###################
|
||||||
|
msgctxt "model:cashbook.values,name:"
|
||||||
|
msgid "Value Store"
|
||||||
|
msgstr "Wertespeicher"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.values,resource:"
|
||||||
|
msgid "Resource"
|
||||||
|
msgstr "Ressource"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.values,field_name:"
|
||||||
|
msgid "Field Name"
|
||||||
|
msgstr "Feldname"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.values,numvalue:"
|
||||||
|
msgid "Value"
|
||||||
|
msgstr "Wert"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.values,valuedigits:"
|
||||||
|
msgid "Digits"
|
||||||
|
msgstr "Dezimalstellen"
|
||||||
|
|
540
locale/en.po
540
locale/en.po
|
@ -2,6 +2,10 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||||
|
|
||||||
|
msgctxt "selection:ir.cron,method:"
|
||||||
|
msgid "Update Cashbooks"
|
||||||
|
msgstr "Update Cashbooks"
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_type_short_unique"
|
msgctxt "model:ir.message,text:msg_type_short_unique"
|
||||||
msgid "The Abbreviation must be unique."
|
msgid "The Abbreviation must be unique."
|
||||||
msgstr "The Abbreviation must be unique."
|
msgstr "The Abbreviation must be unique."
|
||||||
|
@ -66,10 +70,6 @@ msgctxt "model:ir.message,text:msg_category_type_not_like_parent"
|
||||||
msgid "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
msgid "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
||||||
msgstr "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
msgstr "The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'."
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_book_err_startamount_with_lines"
|
|
||||||
msgid "The initial amount of the cash book '%(bookname)s' cannot be changed because it already contains bookings."
|
|
||||||
msgstr "The initial amount of the cash book '%(bookname)s' cannot be changed because it already contains bookings."
|
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_line_deny_recon_by_state"
|
msgctxt "model:ir.message,text:msg_line_deny_recon_by_state"
|
||||||
msgid "For reconciliation, the line '%(recname)s' must be in the status 'Check' or 'Done'."
|
msgid "For reconciliation, the line '%(recname)s' must be in the status 'Check' or 'Done'."
|
||||||
msgstr "For reconciliation, the line '%(recname)s' must be in the status 'Check' or 'Done'."
|
msgstr "For reconciliation, the line '%(recname)s' must be in the status 'Check' or 'Done'."
|
||||||
|
@ -146,6 +146,26 @@ msgctxt "model:ir.message,text:msg_line_invalid_category"
|
||||||
msgid "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'."
|
msgid "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'."
|
||||||
msgstr "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'."
|
msgstr "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_book_btype_with_lines"
|
||||||
|
msgid "The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines."
|
||||||
|
msgstr "The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_book_no_type_noopen"
|
||||||
|
msgid "The cash book '%(bookname)s' has no type and therefore cannot be opened."
|
||||||
|
msgstr "The cash book '%(bookname)s' has no type and therefore cannot be opened."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_btype_general"
|
||||||
|
msgid "General"
|
||||||
|
msgstr "General"
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_value_exists_in_store"
|
||||||
|
msgid "The value already exists for the record."
|
||||||
|
msgstr "The value already exists for the record."
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_nosearch_with_date"
|
||||||
|
msgid "Search with 'date' no allowed for field '%(fname)s' on model '%(model)s'."
|
||||||
|
msgstr "Search with 'date' no allowed for field '%(fname)s' on model '%(model)s'."
|
||||||
|
|
||||||
msgctxt "model:res.group,name:group_cashbook"
|
msgctxt "model:res.group,name:group_cashbook"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Cashbook"
|
msgstr "Cashbook"
|
||||||
|
@ -242,6 +262,10 @@ msgctxt "model:ir.ui.menu,name:menu_booklist"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Cashbook"
|
msgstr "Cashbook"
|
||||||
|
|
||||||
|
msgctxt "model:ir.ui.menu,name:menu_booktree"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Cashbook"
|
||||||
|
|
||||||
msgctxt "model:ir.ui.menu,name:menu_open_lines"
|
msgctxt "model:ir.ui.menu,name:menu_open_lines"
|
||||||
msgid "Open Cashbook"
|
msgid "Open Cashbook"
|
||||||
msgstr "Open Cashbook"
|
msgstr "Open Cashbook"
|
||||||
|
@ -258,15 +282,23 @@ msgctxt "model:ir.ui.menu,name:act_category_view"
|
||||||
msgid "Category"
|
msgid "Category"
|
||||||
msgstr "Category"
|
msgstr "Category"
|
||||||
|
|
||||||
|
msgctxt "model:ir.ui.menu,name:menu_enter_booking"
|
||||||
|
msgid "Enter Booking"
|
||||||
|
msgstr "Enter Booking"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:act_book_view"
|
msgctxt "model:ir.action,name:act_book_view"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Cashbook"
|
msgstr "Cashbook"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action,name:act_book_tree"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Cashbook"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:act_type_view"
|
msgctxt "model:ir.action,name:act_type_view"
|
||||||
msgid "Cashbook Type"
|
msgid "Cashbook Type"
|
||||||
msgstr "Cashbook Type"
|
msgstr "Cashbook Type"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:act_line_view"
|
msgctxt "model:ir.action,name:act_line_view2"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Cashbook Line"
|
msgstr "Cashbook Line"
|
||||||
|
|
||||||
|
@ -274,6 +306,10 @@ msgctxt "model:ir.action,name:act_open_lines"
|
||||||
msgid "Open Cashbook"
|
msgid "Open Cashbook"
|
||||||
msgstr "Open Cashbook"
|
msgstr "Open Cashbook"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action,name:act_open_tree_lines"
|
||||||
|
msgid "Open Cashbook"
|
||||||
|
msgstr "Open Cashbook"
|
||||||
|
|
||||||
msgctxt "model:ir.action,name:report_cashbook"
|
msgctxt "model:ir.action,name:report_cashbook"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Cashbook"
|
msgstr "Cashbook"
|
||||||
|
@ -282,6 +318,10 @@ msgctxt "model:ir.action,name:act_wizard_report"
|
||||||
msgid "Cashbook Report"
|
msgid "Cashbook Report"
|
||||||
msgstr "Cashbook Report"
|
msgstr "Cashbook Report"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action,name:act_enterbooking_wiz"
|
||||||
|
msgid "Enter Booking"
|
||||||
|
msgstr "Enter Booking"
|
||||||
|
|
||||||
msgctxt "model:ir.action.act_window.domain,name:act_line_domain_current"
|
msgctxt "model:ir.action.act_window.domain,name:act_line_domain_current"
|
||||||
msgid "Current Month"
|
msgid "Current Month"
|
||||||
msgstr "Current Month"
|
msgstr "Current Month"
|
||||||
|
@ -294,6 +334,22 @@ msgctxt "model:ir.action.act_window.domain,name:act_line_domain_all"
|
||||||
msgid "All"
|
msgid "All"
|
||||||
msgstr "All"
|
msgstr "All"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action.act_window.domain,name:act_category_tree_domain_in"
|
||||||
|
msgid "Revenue"
|
||||||
|
msgstr "Revenue"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action.act_window.domain,name:act_category_tree_domain_out"
|
||||||
|
msgid "Expense"
|
||||||
|
msgstr "Expense"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action.act_window.domain,name:act_category_list_domain_in"
|
||||||
|
msgid "Revenue"
|
||||||
|
msgstr "Revenue"
|
||||||
|
|
||||||
|
msgctxt "model:ir.action.act_window.domain,name:act_category_list_domain_out"
|
||||||
|
msgid "Expense"
|
||||||
|
msgstr "Expense"
|
||||||
|
|
||||||
msgctxt "model:ir.model.button,string:line_wfedit_button"
|
msgctxt "model:ir.model.button,string:line_wfedit_button"
|
||||||
msgid "Edit"
|
msgid "Edit"
|
||||||
msgstr "Edit"
|
msgstr "Edit"
|
||||||
|
@ -302,6 +358,10 @@ msgctxt "model:ir.model.button,string:line_wfcheck_button"
|
||||||
msgid "Check"
|
msgid "Check"
|
||||||
msgstr "Check"
|
msgstr "Check"
|
||||||
|
|
||||||
|
msgctxt "model:ir.model.button,string:line_wfrecon_button"
|
||||||
|
msgid "Reconciled"
|
||||||
|
msgstr "Reconciled"
|
||||||
|
|
||||||
msgctxt "model:ir.model.button,string:line_wfdone_button"
|
msgctxt "model:ir.model.button,string:line_wfdone_button"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Done"
|
msgstr "Done"
|
||||||
|
@ -350,22 +410,46 @@ msgctxt "model:cashbook.book,name:"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Cashbook"
|
msgstr "Cashbook"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.book:"
|
||||||
|
msgid "Balance"
|
||||||
|
msgstr "Balance"
|
||||||
|
|
||||||
msgctxt "view:cashbook.book:"
|
msgctxt "view:cashbook.book:"
|
||||||
msgid "Owner and Authorizeds"
|
msgid "Owner and Authorizeds"
|
||||||
msgstr "Owner and Authorizeds"
|
msgstr "Owner and Authorizeds"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.book:"
|
||||||
|
msgid "General Information"
|
||||||
|
msgstr "General Information"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.book:"
|
||||||
|
msgid "Amount and Numbering"
|
||||||
|
msgstr "Amount and Numbering"
|
||||||
|
|
||||||
msgctxt "view:cashbook.book:"
|
msgctxt "view:cashbook.book:"
|
||||||
msgid "Reconciliations"
|
msgid "Reconciliations"
|
||||||
msgstr "Reconciliations"
|
msgstr "Reconciliations"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.book:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Description"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,name:"
|
msgctxt "field:cashbook.book,name:"
|
||||||
msgid "Name"
|
msgid "Name"
|
||||||
msgstr "Name"
|
msgstr "Name"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,description:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Description"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,btype:"
|
msgctxt "field:cashbook.book,btype:"
|
||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Type"
|
msgstr "Type"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.book,btype:"
|
||||||
|
msgid "A cash book with type can contain postings. Without type is a view."
|
||||||
|
msgstr "A cash book with type can contain postings. Without type is a view."
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,state:"
|
msgctxt "field:cashbook.book,state:"
|
||||||
msgid "State"
|
msgid "State"
|
||||||
msgstr "State"
|
msgstr "State"
|
||||||
|
@ -410,9 +494,9 @@ msgctxt "field:cashbook.book,currency:"
|
||||||
msgid "Currency"
|
msgid "Currency"
|
||||||
msgstr "Currency"
|
msgstr "Currency"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,start_balance:"
|
msgctxt "field:cashbook.book,currency_digits:"
|
||||||
msgid "Initial Amount"
|
msgid "Currency Digits"
|
||||||
msgstr "Initial Amount"
|
msgstr "Currency Digits"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,start_date:"
|
msgctxt "field:cashbook.book,start_date:"
|
||||||
msgid "Initial Date"
|
msgid "Initial Date"
|
||||||
|
@ -422,6 +506,18 @@ msgctxt "field:cashbook.book,balance:"
|
||||||
msgid "Balance"
|
msgid "Balance"
|
||||||
msgstr "Balance"
|
msgstr "Balance"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.book,balance:"
|
||||||
|
msgid "Balance of bookings to date"
|
||||||
|
msgstr "Balance of bookings to date"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,balance_all:"
|
||||||
|
msgid "Total balance"
|
||||||
|
msgstr "Total balance"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.book,balance_all:"
|
||||||
|
msgid "Balance of all bookings"
|
||||||
|
msgstr "Balance of all bookings"
|
||||||
|
|
||||||
msgctxt "field:cashbook.book,reconciliations:"
|
msgctxt "field:cashbook.book,reconciliations:"
|
||||||
msgid "Reconciliations"
|
msgid "Reconciliations"
|
||||||
msgstr "Reconciliations"
|
msgstr "Reconciliations"
|
||||||
|
@ -446,6 +542,42 @@ msgctxt "help:cashbook.book,number_atcheck:"
|
||||||
msgid "The numbering of the lines is done in the step Check. If the check mark is inactive, this happens with Done."
|
msgid "The numbering of the lines is done in the step Check. If the check mark is inactive, this happens with Done."
|
||||||
msgstr "The numbering of the lines is done in the step Check. If the check mark is inactive, this happens with Done."
|
msgstr "The numbering of the lines is done in the step Check. If the check mark is inactive, this happens with Done."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,parent:"
|
||||||
|
msgid "Parent"
|
||||||
|
msgstr "Parent"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,childs:"
|
||||||
|
msgid "Children"
|
||||||
|
msgstr "Children"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,balance_ref:"
|
||||||
|
msgid "Balance (Ref.)"
|
||||||
|
msgstr "Balance (Ref.)"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.book,balance_ref:"
|
||||||
|
msgid "Balance in company currency"
|
||||||
|
msgstr "Balance in company currency"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,company_currency:"
|
||||||
|
msgid "Company Currency"
|
||||||
|
msgstr "Company Currency"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,company_currency_digits:"
|
||||||
|
msgid "Currency Digits (Ref.)"
|
||||||
|
msgstr "Currency Digits (Ref.)"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Feature"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,booktransf_feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Feature"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.book,value_store:"
|
||||||
|
msgid "Values"
|
||||||
|
msgstr "Values"
|
||||||
|
|
||||||
msgctxt "model:cashbook.split,name:"
|
msgctxt "model:cashbook.split,name:"
|
||||||
msgid "Split booking line"
|
msgid "Split booking line"
|
||||||
msgstr "Split booking line"
|
msgstr "Split booking line"
|
||||||
|
@ -454,6 +586,10 @@ msgctxt "view:cashbook.split:"
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Description"
|
msgstr "Description"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.split:"
|
||||||
|
msgid "Amount"
|
||||||
|
msgstr "Amount"
|
||||||
|
|
||||||
msgctxt "field:cashbook.split,line:"
|
msgctxt "field:cashbook.split,line:"
|
||||||
msgid "Line"
|
msgid "Line"
|
||||||
msgstr "Line"
|
msgstr "Line"
|
||||||
|
@ -522,6 +658,10 @@ msgctxt "selection:cashbook.split,state:"
|
||||||
msgid "Checked"
|
msgid "Checked"
|
||||||
msgstr "Checked"
|
msgstr "Checked"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,state:"
|
||||||
|
msgid "Reconciled"
|
||||||
|
msgstr "Reconciled"
|
||||||
|
|
||||||
msgctxt "selection:cashbook.split,state:"
|
msgctxt "selection:cashbook.split,state:"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Done"
|
msgstr "Done"
|
||||||
|
@ -530,18 +670,78 @@ msgctxt "field:cashbook.split,state_cashbook:"
|
||||||
msgid "State of Cashbook"
|
msgid "State of Cashbook"
|
||||||
msgstr "State of Cashbook"
|
msgstr "State of Cashbook"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,splittype:"
|
||||||
|
msgid "Type"
|
||||||
|
msgstr "Type"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.split,splittype:"
|
||||||
|
msgid "Type of split booking line"
|
||||||
|
msgstr "Type of split booking line"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,splittype:"
|
||||||
|
msgid "Category"
|
||||||
|
msgstr "Category"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,splittype:"
|
||||||
|
msgid "Transfer"
|
||||||
|
msgstr "Transfer"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,target:"
|
||||||
|
msgid "Target"
|
||||||
|
msgstr "Target"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,target:"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Cashbook"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.split,target:"
|
||||||
|
msgid "Category"
|
||||||
|
msgstr "Category"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,cashbook:"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Cashbook"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,owner_cashbook:"
|
||||||
|
msgid "Owner"
|
||||||
|
msgstr "Owner"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,booktransf:"
|
||||||
|
msgid "Source/Dest"
|
||||||
|
msgstr "Source/Dest"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,currency2nd:"
|
||||||
|
msgid "2nd Currency"
|
||||||
|
msgstr "2nd Currency"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,currency2nd_digits:"
|
||||||
|
msgid "2nd Currency Digits"
|
||||||
|
msgstr "2nd Currency Digits"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,amount_2nd_currency:"
|
||||||
|
msgid "Amount Second Currency"
|
||||||
|
msgstr "Amount Second Currency"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,rate_2nd_currency:"
|
||||||
|
msgid "Rate"
|
||||||
|
msgstr "Rate"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.split,rate_2nd_currency:"
|
||||||
|
msgid "Exchange rate between the currencies of the participating cashbooks."
|
||||||
|
msgstr "Exchange rate between the currencies of the participating cashbooks."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Feature"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.split,booktransf_feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Feature"
|
||||||
|
|
||||||
msgctxt "model:cashbook.line,name:"
|
msgctxt "model:cashbook.line,name:"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Cashbook Line"
|
msgstr "Cashbook Line"
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
|
||||||
msgid "Credit"
|
|
||||||
msgstr "Credit"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
|
||||||
msgid "Debit"
|
|
||||||
msgstr "Debit"
|
|
||||||
|
|
||||||
msgctxt "view:cashbook.line:"
|
msgctxt "view:cashbook.line:"
|
||||||
msgid "Cashbook Line"
|
msgid "Cashbook Line"
|
||||||
msgstr "Cashbook Line"
|
msgstr "Cashbook Line"
|
||||||
|
@ -574,6 +774,10 @@ msgctxt "field:cashbook.line,description:"
|
||||||
msgid "Description"
|
msgid "Description"
|
||||||
msgstr "Description"
|
msgstr "Description"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,descr_short:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Description"
|
||||||
|
|
||||||
msgctxt "field:cashbook.line,state:"
|
msgctxt "field:cashbook.line,state:"
|
||||||
msgid "State"
|
msgid "State"
|
||||||
msgstr "State"
|
msgstr "State"
|
||||||
|
@ -586,6 +790,10 @@ msgctxt "selection:cashbook.line,state:"
|
||||||
msgid "Checked"
|
msgid "Checked"
|
||||||
msgstr "Checked"
|
msgstr "Checked"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.line,state:"
|
||||||
|
msgid "Reconciled"
|
||||||
|
msgstr "Reconciled"
|
||||||
|
|
||||||
msgctxt "selection:cashbook.line,state:"
|
msgctxt "selection:cashbook.line,state:"
|
||||||
msgid "Done"
|
msgid "Done"
|
||||||
msgstr "Done"
|
msgstr "Done"
|
||||||
|
@ -722,6 +930,34 @@ msgctxt "help:cashbook.line,splitlines:"
|
||||||
msgid "Rows with different categories form the total sum of the booking"
|
msgid "Rows with different categories form the total sum of the booking"
|
||||||
msgstr "Rows with different categories form the total sum of the booking"
|
msgstr "Rows with different categories form the total sum of the booking"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,currency2nd:"
|
||||||
|
msgid "2nd Currency"
|
||||||
|
msgstr "2nd Currency"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,currency2nd_digits:"
|
||||||
|
msgid "2nd Currency Digits"
|
||||||
|
msgstr "2nd Currency Digits"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,amount_2nd_currency:"
|
||||||
|
msgid "Amount Second Currency"
|
||||||
|
msgstr "Amount Second Currency"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,rate_2nd_currency:"
|
||||||
|
msgid "Rate"
|
||||||
|
msgstr "Rate"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.line,rate_2nd_currency:"
|
||||||
|
msgid "Exchange rate between the currencies of the participating cashbooks."
|
||||||
|
msgstr "Exchange rate between the currencies of the participating cashbooks."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Feature"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.line,booktransf_feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Feature"
|
||||||
|
|
||||||
msgctxt "model:cashbook.type,name:"
|
msgctxt "model:cashbook.type,name:"
|
||||||
msgid "Cashbook Type"
|
msgid "Cashbook Type"
|
||||||
msgstr "Cashbook Type"
|
msgstr "Cashbook Type"
|
||||||
|
@ -738,6 +974,14 @@ msgctxt "field:cashbook.type,company:"
|
||||||
msgid "Company"
|
msgid "Company"
|
||||||
msgstr "Company"
|
msgstr "Company"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.type,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Feature"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.type,feature:"
|
||||||
|
msgid "Select feature set of the Cashbook."
|
||||||
|
msgstr "Select feature set of the Cashbook."
|
||||||
|
|
||||||
msgctxt "model:cashbook.category,name:"
|
msgctxt "model:cashbook.category,name:"
|
||||||
msgid "Category"
|
msgid "Category"
|
||||||
msgstr "Category"
|
msgstr "Category"
|
||||||
|
@ -770,14 +1014,6 @@ msgctxt "field:cashbook.category,childs:"
|
||||||
msgid "Children"
|
msgid "Children"
|
||||||
msgstr "Children"
|
msgstr "Children"
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,left:"
|
|
||||||
msgid "Left"
|
|
||||||
msgstr "Left"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,right:"
|
|
||||||
msgid "Right"
|
|
||||||
msgstr "Right"
|
|
||||||
|
|
||||||
msgctxt "field:cashbook.category,cattype:"
|
msgctxt "field:cashbook.category,cattype:"
|
||||||
msgid "Type"
|
msgid "Type"
|
||||||
msgstr "Type"
|
msgstr "Type"
|
||||||
|
@ -834,6 +1070,10 @@ msgctxt "model:cashbook.open_lines,name:"
|
||||||
msgid "Open Cashbook"
|
msgid "Open Cashbook"
|
||||||
msgstr "Open Cashbook"
|
msgstr "Open Cashbook"
|
||||||
|
|
||||||
|
msgctxt "model:cashbook.open_lines_tree,name:"
|
||||||
|
msgid "Open Cashbook"
|
||||||
|
msgstr "Open Cashbook"
|
||||||
|
|
||||||
msgctxt "wizard_button:cashbook.open_lines,askuser,end:"
|
msgctxt "wizard_button:cashbook.open_lines,askuser,end:"
|
||||||
msgid "Cancel"
|
msgid "Cancel"
|
||||||
msgstr "Cancel"
|
msgstr "Cancel"
|
||||||
|
@ -870,14 +1110,26 @@ msgctxt "field:cashbook.line.context,date_from:"
|
||||||
msgid "Start Date"
|
msgid "Start Date"
|
||||||
msgstr "Start Date"
|
msgstr "Start Date"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.line.context,date_from:"
|
||||||
|
msgid "Limits the date range for the displayed entries."
|
||||||
|
msgstr "Limits the date range for the displayed entries."
|
||||||
|
|
||||||
msgctxt "field:cashbook.line.context,date_to:"
|
msgctxt "field:cashbook.line.context,date_to:"
|
||||||
msgid "End Date"
|
msgid "End Date"
|
||||||
msgstr "End Date"
|
msgstr "End Date"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.line.context,date_to:"
|
||||||
|
msgid "Limits the date range for the displayed entries."
|
||||||
|
msgstr "Limits the date range for the displayed entries."
|
||||||
|
|
||||||
msgctxt "model:cashbook.configuration,name:"
|
msgctxt "model:cashbook.configuration,name:"
|
||||||
msgid "Configuration"
|
msgid "Configuration"
|
||||||
msgstr "Configuration"
|
msgstr "Configuration"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.configuration:"
|
||||||
|
msgid "Enter Booking Wizard"
|
||||||
|
msgstr "Enter Booking Wizard"
|
||||||
|
|
||||||
msgctxt "view:cashbook.configuration:"
|
msgctxt "view:cashbook.configuration:"
|
||||||
msgid "Open Cashbook Wizard"
|
msgid "Open Cashbook Wizard"
|
||||||
msgstr "Open Cashbook Wizard"
|
msgstr "Open Cashbook Wizard"
|
||||||
|
@ -886,6 +1138,62 @@ msgctxt "view:cashbook.configuration:"
|
||||||
msgid "Cashbook"
|
msgid "Cashbook"
|
||||||
msgstr "Cashbook"
|
msgstr "Cashbook"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,defbook:"
|
||||||
|
msgid "Default Cashbook"
|
||||||
|
msgstr "Default Cashbook"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,defbook:"
|
||||||
|
msgid "The default cashbook is selected when you open the booking wizard."
|
||||||
|
msgstr "The default cashbook is selected when you open the booking wizard."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book1:"
|
||||||
|
msgid "Cashbook 1"
|
||||||
|
msgstr "Cashbook 1"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book1:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book2:"
|
||||||
|
msgid "Cashbook 2"
|
||||||
|
msgstr "Cashbook 2"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book2:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book3:"
|
||||||
|
msgid "Cashbook 3"
|
||||||
|
msgstr "Cashbook 3"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book3:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book4:"
|
||||||
|
msgid "Cashbook 4"
|
||||||
|
msgstr "Cashbook 4"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book4:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,book5:"
|
||||||
|
msgid "Cashbook 5"
|
||||||
|
msgstr "Cashbook 5"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,book5:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration,fixate:"
|
||||||
|
msgid "Fixate"
|
||||||
|
msgstr "Fixate"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration,fixate:"
|
||||||
|
msgid "Fixating of the booking is activated."
|
||||||
|
msgstr "Fixating of the booking is activated."
|
||||||
|
|
||||||
msgctxt "field:cashbook.configuration,date_from:"
|
msgctxt "field:cashbook.configuration,date_from:"
|
||||||
msgid "Start Date"
|
msgid "Start Date"
|
||||||
msgstr "Start Date"
|
msgstr "Start Date"
|
||||||
|
@ -954,6 +1262,62 @@ msgctxt "help:cashbook.configuration_user,catnamelong:"
|
||||||
msgid "Shows the long name of the category in the Category field of a cash book line."
|
msgid "Shows the long name of the category in the Category field of a cash book line."
|
||||||
msgstr "Shows the long name of the category in the Category field of a cash book line."
|
msgstr "Shows the long name of the category in the Category field of a cash book line."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,defbook:"
|
||||||
|
msgid "Default Cashbook"
|
||||||
|
msgstr "Default Cashbook"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,defbook:"
|
||||||
|
msgid "The default cashbook is selected when you open the booking wizard."
|
||||||
|
msgstr "The default cashbook is selected when you open the booking wizard."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book1:"
|
||||||
|
msgid "Cashbook 1"
|
||||||
|
msgstr "Cashbook 1"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book1:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book2:"
|
||||||
|
msgid "Cashbook 2"
|
||||||
|
msgstr "Cashbook 2"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book2:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book3:"
|
||||||
|
msgid "Cashbook 3"
|
||||||
|
msgstr "Cashbook 3"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book3:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book4:"
|
||||||
|
msgid "Cashbook 4"
|
||||||
|
msgstr "Cashbook 4"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book4:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,book5:"
|
||||||
|
msgid "Cashbook 5"
|
||||||
|
msgstr "Cashbook 5"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,book5:"
|
||||||
|
msgid "Cash book available in selection dialog."
|
||||||
|
msgstr "Cash book available in selection dialog."
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.configuration_user,fixate:"
|
||||||
|
msgid "Fixate"
|
||||||
|
msgstr "Fixate"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.configuration_user,fixate:"
|
||||||
|
msgid "Fixating of the booking is activated."
|
||||||
|
msgstr "Fixating of the booking is activated."
|
||||||
|
|
||||||
msgctxt "model:cashbook.recon,name:"
|
msgctxt "model:cashbook.recon,name:"
|
||||||
msgid "Cashbook Reconciliation"
|
msgid "Cashbook Reconciliation"
|
||||||
msgstr "Cashbook Reconciliation"
|
msgstr "Cashbook Reconciliation"
|
||||||
|
@ -1030,6 +1394,10 @@ msgctxt "field:cashbook.recon,predecessor:"
|
||||||
msgid "Predecessor"
|
msgid "Predecessor"
|
||||||
msgstr "Predecessor"
|
msgstr "Predecessor"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.recon,feature:"
|
||||||
|
msgid "Feature"
|
||||||
|
msgstr "Feature"
|
||||||
|
|
||||||
msgctxt "model:cashbook.runrepbook.start,name:"
|
msgctxt "model:cashbook.runrepbook.start,name:"
|
||||||
msgid "Cashbook Report"
|
msgid "Cashbook Report"
|
||||||
msgstr "Cashbook Report"
|
msgstr "Cashbook Report"
|
||||||
|
@ -1122,3 +1490,127 @@ msgctxt "report:cashbook.reprecon:"
|
||||||
msgid "Total"
|
msgid "Total"
|
||||||
msgstr "Total"
|
msgstr "Total"
|
||||||
|
|
||||||
|
msgctxt "report:cashbook.reprecon:"
|
||||||
|
msgid "Payee"
|
||||||
|
msgstr "Payee"
|
||||||
|
|
||||||
|
msgctxt "model:cashbook.enterbooking.start,name:"
|
||||||
|
msgid "Enter Booking"
|
||||||
|
msgstr "Enter Booking"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.enterbooking.start:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Description"
|
||||||
|
|
||||||
|
msgctxt "view:cashbook.enterbooking.start:"
|
||||||
|
msgid "Booking"
|
||||||
|
msgstr "Booking"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,cashbook:"
|
||||||
|
msgid "Cashbook"
|
||||||
|
msgstr "Cashbook"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,cashbooks:"
|
||||||
|
msgid "Cashbooks"
|
||||||
|
msgstr "Cashbooks"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,currency_digits:"
|
||||||
|
msgid "Currency Digits"
|
||||||
|
msgstr "Currency Digits"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,currency:"
|
||||||
|
msgid "Currency"
|
||||||
|
msgstr "Currency"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Type"
|
||||||
|
msgstr "Type"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Revenue"
|
||||||
|
msgstr "Revenue"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Revenue Splitbooking"
|
||||||
|
msgstr "Revenue Splitbooking"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Expense"
|
||||||
|
msgstr "Expense"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Expense Splitbooking"
|
||||||
|
msgstr "Expense Splitbooking"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Transfer from"
|
||||||
|
msgstr "Transfer from"
|
||||||
|
|
||||||
|
msgctxt "selection:cashbook.enterbooking.start,bookingtype:"
|
||||||
|
msgid "Transfer to"
|
||||||
|
msgstr "Transfer to"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,amount:"
|
||||||
|
msgid "Amount"
|
||||||
|
msgstr "Amount"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,owner_cashbook:"
|
||||||
|
msgid "Owner"
|
||||||
|
msgstr "Owner"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,category:"
|
||||||
|
msgid "Category"
|
||||||
|
msgstr "Category"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,booktransf:"
|
||||||
|
msgid "Source/Dest"
|
||||||
|
msgstr "Source/Dest"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,party:"
|
||||||
|
msgid "Party"
|
||||||
|
msgstr "Party"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,description:"
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Description"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.enterbooking.start,fixate:"
|
||||||
|
msgid "Fixate"
|
||||||
|
msgstr "Fixate"
|
||||||
|
|
||||||
|
msgctxt "help:cashbook.enterbooking.start,fixate:"
|
||||||
|
msgid "The booking is fixed immediately."
|
||||||
|
msgstr "The booking is fixed immediately."
|
||||||
|
|
||||||
|
msgctxt "model:cashbook.enterbooking,name:"
|
||||||
|
msgid "Enter Booking"
|
||||||
|
msgstr "Enter Booking"
|
||||||
|
|
||||||
|
msgctxt "wizard_button:cashbook.enterbooking,start,end:"
|
||||||
|
msgid "Cancel"
|
||||||
|
msgstr "Cancel"
|
||||||
|
|
||||||
|
msgctxt "wizard_button:cashbook.enterbooking,start,save_:"
|
||||||
|
msgid "Save"
|
||||||
|
msgstr "Save"
|
||||||
|
|
||||||
|
msgctxt "wizard_button:cashbook.enterbooking,start,savenext_:"
|
||||||
|
msgid "Save & Next"
|
||||||
|
msgstr "Save & Next"
|
||||||
|
|
||||||
|
msgctxt "model:cashbook.values,name:"
|
||||||
|
msgid "Value Store"
|
||||||
|
msgstr "Value Store"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.values,resource:"
|
||||||
|
msgid "Resource"
|
||||||
|
msgstr "Resource"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.values,field_name:"
|
||||||
|
msgid "Field Name"
|
||||||
|
msgstr "Field Name"
|
||||||
|
|
||||||
|
msgctxt "field:cashbook.values,numvalue:"
|
||||||
|
msgid "Value"
|
||||||
|
msgstr "Value"
|
||||||
|
|
||||||
|
|
31
menu.xml
31
menu.xml
|
@ -19,7 +19,7 @@ full copyright notices and license terms. -->
|
||||||
|
|
||||||
<!-- menu: /Cashbook/Configuration name="Configuration" -->
|
<!-- menu: /Cashbook/Configuration name="Configuration" -->
|
||||||
<menuitem id="menu_config" action="act_configuration_form"
|
<menuitem id="menu_config" action="act_configuration_form"
|
||||||
icon="tryton-list"
|
icon="tryton-settings"
|
||||||
parent="menu_cashbook" sequence="10"/>
|
parent="menu_cashbook" sequence="10"/>
|
||||||
<record model="ir.ui.menu-res.group" id="menu_config-group_cashbook">
|
<record model="ir.ui.menu-res.group" id="menu_config-group_cashbook">
|
||||||
<field name="menu" ref="menu_config"/>
|
<field name="menu" ref="menu_config"/>
|
||||||
|
@ -56,10 +56,23 @@ full copyright notices and license terms. -->
|
||||||
<field name="group" ref="group_cashbook_admin"/>
|
<field name="group" ref="group_cashbook_admin"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- menu: /Cashbook/Enter Booking -->
|
||||||
|
<menuitem id="menu_enter_booking" action="act_enterbooking_wiz"
|
||||||
|
icon="tryton-add"
|
||||||
|
parent="menu_cashbook" sequence="20"/>
|
||||||
|
<record model="ir.ui.menu-res.group" id="menu_enter_booking-group_cashbook">
|
||||||
|
<field name="menu" ref="menu_enter_booking"/>
|
||||||
|
<field name="group" ref="group_cashbook"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.menu-res.group" id="menu_enter_booking-group_cashbook_admin">
|
||||||
|
<field name="menu" ref="menu_enter_booking"/>
|
||||||
|
<field name="group" ref="group_cashbook_admin"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- menu: /Cashbook/Open Cashbook -->
|
<!-- menu: /Cashbook/Open Cashbook -->
|
||||||
<menuitem id="menu_open_lines" action="act_open_lines"
|
<menuitem id="menu_open_lines" action="act_open_lines"
|
||||||
icon="tryton-list"
|
icon="tryton-list"
|
||||||
parent="menu_cashbook" sequence="20"/>
|
parent="menu_cashbook" sequence="30"/>
|
||||||
<record model="ir.ui.menu-res.group" id="menu_open_lines-group_cashbook">
|
<record model="ir.ui.menu-res.group" id="menu_open_lines-group_cashbook">
|
||||||
<field name="menu" ref="menu_open_lines"/>
|
<field name="menu" ref="menu_open_lines"/>
|
||||||
<field name="group" ref="group_cashbook"/>
|
<field name="group" ref="group_cashbook"/>
|
||||||
|
@ -70,9 +83,21 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- menu: /Cashbook/Cashbook -->
|
<!-- menu: /Cashbook/Cashbook -->
|
||||||
|
<menuitem id="menu_booktree" action="act_book_tree"
|
||||||
|
icon="tryton-tree"
|
||||||
|
parent="menu_cashbook" sequence="40"/>
|
||||||
|
<record model="ir.ui.menu-res.group" id="menu_booktree-group_cashbook">
|
||||||
|
<field name="menu" ref="menu_booktree"/>
|
||||||
|
<field name="group" ref="group_cashbook"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.menu-res.group" id="menu_booktree-group_cashbook_admin">
|
||||||
|
<field name="menu" ref="menu_booktree"/>
|
||||||
|
<field name="group" ref="group_cashbook_admin"/>
|
||||||
|
</record>
|
||||||
|
<!-- menu: /Cashbook/Cashbook/Cashbook -->
|
||||||
<menuitem id="menu_booklist" action="act_book_view"
|
<menuitem id="menu_booklist" action="act_book_view"
|
||||||
icon="tryton-list"
|
icon="tryton-list"
|
||||||
parent="menu_cashbook" sequence="30"/>
|
parent="menu_booktree" sequence="10"/>
|
||||||
<record model="ir.ui.menu-res.group" id="menu_booklist-group_cashbook">
|
<record model="ir.ui.menu-res.group" id="menu_booklist-group_cashbook">
|
||||||
<field name="menu" ref="menu_booklist"/>
|
<field name="menu" ref="menu_booklist"/>
|
||||||
<field name="group" ref="group_cashbook"/>
|
<field name="group" ref="group_cashbook"/>
|
||||||
|
|
18
message.xml
18
message.xml
|
@ -53,9 +53,6 @@ full copyright notices and license terms. -->
|
||||||
<record model="ir.message" id="msg_category_type_not_like_parent">
|
<record model="ir.message" id="msg_category_type_not_like_parent">
|
||||||
<field name="text">The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'.</field>
|
<field name="text">The type of the current category '%(catname)s' must be equal to the type of the parent category '%(parentname)s'.</field>
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.message" id="msg_book_err_startamount_with_lines">
|
|
||||||
<field name="text">The initial amount of the cash book '%(bookname)s' cannot be changed because it already contains bookings.</field>
|
|
||||||
</record>
|
|
||||||
<record model="ir.message" id="msg_line_deny_recon_by_state">
|
<record model="ir.message" id="msg_line_deny_recon_by_state">
|
||||||
<field name="text">For reconciliation, the line '%(recname)s' must be in the status 'Check' or 'Done'.</field>
|
<field name="text">For reconciliation, the line '%(recname)s' must be in the status 'Check' or 'Done'.</field>
|
||||||
</record>
|
</record>
|
||||||
|
@ -113,6 +110,21 @@ full copyright notices and license terms. -->
|
||||||
<record model="ir.message" id="msg_line_invalid_category">
|
<record model="ir.message" id="msg_line_invalid_category">
|
||||||
<field name="text">The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'.</field>
|
<field name="text">The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'.</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.message" id="msg_book_btype_with_lines">
|
||||||
|
<field name="text">The type cannot be deleted on the cash book '%(cbname)s' because it still contains %(numlines)s lines.</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.message" id="msg_book_no_type_noopen">
|
||||||
|
<field name="text">The cash book '%(bookname)s' has no type and therefore cannot be opened.</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.message" id="msg_btype_general">
|
||||||
|
<field name="text">General</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.message" id="msg_value_exists_in_store">
|
||||||
|
<field name="text">The value already exists for the record.</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.message" id="msg_nosearch_with_date">
|
||||||
|
<field name="text">Search with 'date' no allowed for field '%(fname)s' on model '%(model)s'.</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
||||||
|
|
198
mixin.py
Normal file
198
mixin.py
Normal file
|
@ -0,0 +1,198 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
from trytond.model import fields
|
||||||
|
from trytond.pyson import Eval, Bool, Or
|
||||||
|
from trytond.pool import Pool
|
||||||
|
from trytond.modules.currency.ir import rate_decimal
|
||||||
|
from trytond.transaction import Transaction
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
|
STATES = {
|
||||||
|
'readonly': Or(
|
||||||
|
Eval('state', '') != 'edit',
|
||||||
|
Eval('state_cashbook', '') != 'open',
|
||||||
|
),
|
||||||
|
}
|
||||||
|
DEPENDS = ['state', 'state_cashbook']
|
||||||
|
|
||||||
|
|
||||||
|
class SecondCurrencyMixin:
|
||||||
|
""" two fields for 2nd currency: amount + rate
|
||||||
|
"""
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
|
amount_2nd_currency = fields.Numeric(
|
||||||
|
string='Amount Second Currency',
|
||||||
|
digits=(16, Eval('currency2nd_digits', 2)),
|
||||||
|
states={
|
||||||
|
'readonly': Or(
|
||||||
|
STATES['readonly'],
|
||||||
|
~Bool(Eval('currency2nd'))),
|
||||||
|
'required': Bool(Eval('currency2nd')),
|
||||||
|
'invisible': ~Bool(Eval('currency2nd')),
|
||||||
|
}, depends=DEPENDS+['currency2nd_digits', 'currency2nd'])
|
||||||
|
rate_2nd_currency = fields.Function(fields.Numeric(
|
||||||
|
string='Rate',
|
||||||
|
help='Exchange rate between the currencies of the ' +
|
||||||
|
'participating cashbooks.',
|
||||||
|
digits=(rate_decimal * 2, rate_decimal),
|
||||||
|
states={
|
||||||
|
'readonly': Or(
|
||||||
|
STATES['readonly'],
|
||||||
|
~Bool(Eval('currency2nd'))),
|
||||||
|
'required': Bool(Eval('currency2nd')),
|
||||||
|
'invisible': ~Bool(Eval('currency2nd')),
|
||||||
|
}, depends=DEPENDS+['currency2nd_digits', 'currency2nd']),
|
||||||
|
'on_change_with_rate_2nd_currency', setter='set_rate_2nd_currency')
|
||||||
|
|
||||||
|
currency2nd = fields.Function(fields.Many2One(
|
||||||
|
model_name='currency.currency',
|
||||||
|
string="2nd Currency", readonly=True), 'on_change_with_currency2nd')
|
||||||
|
currency2nd_digits = fields.Function(fields.Integer(
|
||||||
|
string='2nd Currency Digits',
|
||||||
|
readonly=True), 'on_change_with_currency2nd_digits')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def add_2nd_currency(cls, values, from_currency):
|
||||||
|
""" add second currency amount if missing
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Currency = pool.get('currency.currency')
|
||||||
|
Cashbook = pool.get('cashbook.book')
|
||||||
|
IrDate = pool.get('ir.date')
|
||||||
|
|
||||||
|
booktransf = values.get('booktransf', None)
|
||||||
|
amount = values.get('amount', None)
|
||||||
|
amount_2nd_currency = values.get('amount_2nd_currency', None)
|
||||||
|
|
||||||
|
if (amount is not None) and (booktransf is not None):
|
||||||
|
if amount_2nd_currency is None:
|
||||||
|
booktransf = Cashbook(booktransf)
|
||||||
|
if from_currency.id != booktransf.currency.id:
|
||||||
|
with Transaction().set_context({
|
||||||
|
'date': values.get('date', IrDate.today())}):
|
||||||
|
values['amount_2nd_currency'] = Currency.compute(
|
||||||
|
from_currency,
|
||||||
|
amount,
|
||||||
|
booktransf.currency,
|
||||||
|
)
|
||||||
|
return values
|
||||||
|
|
||||||
|
@fields.depends(
|
||||||
|
'booktransf', '_parent_booktransf.currency',
|
||||||
|
'currency', 'amount', 'date', 'amount_2nd_currency',
|
||||||
|
'rate_2nd_currency')
|
||||||
|
def on_change_booktransf(self):
|
||||||
|
""" update amount_2nd_currency
|
||||||
|
"""
|
||||||
|
self.on_change_rate_2nd_currency()
|
||||||
|
|
||||||
|
@fields.depends(
|
||||||
|
'booktransf', '_parent_booktransf.currency',
|
||||||
|
'currency', 'amount', 'date', 'amount_2nd_currency',
|
||||||
|
'rate_2nd_currency')
|
||||||
|
def on_change_amount(self):
|
||||||
|
""" update amount_2nd_currency
|
||||||
|
"""
|
||||||
|
self.on_change_rate_2nd_currency()
|
||||||
|
|
||||||
|
@fields.depends(
|
||||||
|
'booktransf', '_parent_booktransf.currency',
|
||||||
|
'currency', 'amount', 'date', 'amount_2nd_currency',
|
||||||
|
'rate_2nd_currency')
|
||||||
|
def on_change_rate_2nd_currency(self):
|
||||||
|
""" update amount_2nd_currency + rate_2nd_currency
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
IrDate = pool.get('ir.date')
|
||||||
|
Currency = pool.get('currency.currency')
|
||||||
|
|
||||||
|
if (self.amount is None) or (self.booktransf is None):
|
||||||
|
self.amount_2nd_currency = None
|
||||||
|
self.rate_2nd_currency = None
|
||||||
|
return
|
||||||
|
|
||||||
|
if self.rate_2nd_currency is None:
|
||||||
|
# no rate set, use current rate of target-currency
|
||||||
|
with Transaction().set_context({
|
||||||
|
'date': self.date or IrDate.today()}):
|
||||||
|
self.amount_2nd_currency = Currency.compute(
|
||||||
|
self.currency,
|
||||||
|
self.amount,
|
||||||
|
self.booktransf.currency)
|
||||||
|
if self.amount != Decimal('0.0'):
|
||||||
|
self.rate_2nd_currency = \
|
||||||
|
self.amount_2nd_currency / self.amount
|
||||||
|
else:
|
||||||
|
self.amount_2nd_currency = self.booktransf.currency.round(
|
||||||
|
self.amount * self.rate_2nd_currency)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def set_rate_2nd_currency(cls, lines, name, value):
|
||||||
|
""" compute amount_2nd_currency, write to db
|
||||||
|
"""
|
||||||
|
Line2 = Pool().get(cls.__name__)
|
||||||
|
|
||||||
|
to_write = []
|
||||||
|
|
||||||
|
if not name == 'rate_2nd_currency':
|
||||||
|
return
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
if line.booktransf is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if line.cashbook.currency.id == line.booktransf.currency.id:
|
||||||
|
continue
|
||||||
|
|
||||||
|
to_write.extend([
|
||||||
|
[line],
|
||||||
|
{
|
||||||
|
'amount_2nd_currency': line.booktransf.currency.round(
|
||||||
|
line.amount * value),
|
||||||
|
}])
|
||||||
|
|
||||||
|
if len(to_write) > 0:
|
||||||
|
Line2.write(*to_write)
|
||||||
|
|
||||||
|
@fields.depends('amount', 'amount_2nd_currency', 'rate_2nd_currency')
|
||||||
|
def on_change_amount_2nd_currency(self):
|
||||||
|
""" update rate_2nd_currency by rate
|
||||||
|
"""
|
||||||
|
self.rate_2nd_currency = self.on_change_with_rate_2nd_currency()
|
||||||
|
|
||||||
|
@fields.depends('amount', 'amount_2nd_currency')
|
||||||
|
def on_change_with_rate_2nd_currency(self, name=None):
|
||||||
|
""" get current rate from amount
|
||||||
|
"""
|
||||||
|
Rate = Pool().get('currency.currency.rate')
|
||||||
|
|
||||||
|
if (self.amount is not None) and \
|
||||||
|
(self.amount_2nd_currency is not None):
|
||||||
|
if self.amount != Decimal('0.0'):
|
||||||
|
exp = Decimal(Decimal(1) / 10 ** Rate.rate.digits[1])
|
||||||
|
return (self.amount_2nd_currency / self.amount).quantize(exp)
|
||||||
|
|
||||||
|
@fields.depends('currency', 'booktransf', '_parent_booktransf.currency')
|
||||||
|
def on_change_with_currency2nd(self, name=None):
|
||||||
|
""" currency of transfer-target
|
||||||
|
"""
|
||||||
|
if self.booktransf:
|
||||||
|
if self.currency:
|
||||||
|
if self.currency.id != self.booktransf.currency.id:
|
||||||
|
return self.booktransf.currency.id
|
||||||
|
|
||||||
|
@fields.depends('booktransf', '_parent_booktransf.currency')
|
||||||
|
def on_change_with_currency2nd_digits(self, name=None):
|
||||||
|
""" currency of transfer-target
|
||||||
|
"""
|
||||||
|
if self.booktransf:
|
||||||
|
return self.booktransf.currency.digits
|
||||||
|
else:
|
||||||
|
return 2
|
||||||
|
|
||||||
|
# end SecondCurrencyMixin
|
128
model.py
128
model.py
|
@ -3,18 +3,137 @@
|
||||||
# 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 MultiValueMixin, ValueMixin, fields, Unique
|
from trytond.model import (
|
||||||
|
MultiValueMixin, ValueMixin, fields, Unique, Index)
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
|
from trytond.pool import Pool
|
||||||
|
from sql import With
|
||||||
|
from sql.functions import Function
|
||||||
|
from .const import DEF_NONE
|
||||||
|
|
||||||
|
|
||||||
|
class ArrayAgg(Function):
|
||||||
|
"""input values, including nulls, concatenated into an array.
|
||||||
|
"""
|
||||||
|
__slots__ = ()
|
||||||
|
_function = 'ARRAY_AGG'
|
||||||
|
|
||||||
|
# end ArrayAgg
|
||||||
|
|
||||||
|
|
||||||
|
class ArrayAppend(Function):
|
||||||
|
""" sql: array_append
|
||||||
|
"""
|
||||||
|
__slots__ = ()
|
||||||
|
_function = 'ARRAY_APPEND'
|
||||||
|
|
||||||
|
# end ArrayApppend
|
||||||
|
|
||||||
|
|
||||||
|
class ArrayToString(Function):
|
||||||
|
""" sql: array_to_string
|
||||||
|
"""
|
||||||
|
__slots__ = ()
|
||||||
|
_function = 'ARRAY_TO_STRING'
|
||||||
|
|
||||||
|
# end ArrayToString
|
||||||
|
|
||||||
|
|
||||||
|
class AnyInArray(Function):
|
||||||
|
""" sql: array_to_string
|
||||||
|
"""
|
||||||
|
__slots__ = ()
|
||||||
|
_function = 'ANY'
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self._function + '(' + ', '.join(
|
||||||
|
map(self._format, self.args)) + '::int[])'
|
||||||
|
|
||||||
|
# end AnyInArray
|
||||||
|
|
||||||
|
|
||||||
|
class Array(Function):
|
||||||
|
""" sql: array-type
|
||||||
|
"""
|
||||||
|
__slots__ = ()
|
||||||
|
_function = 'ARRAY'
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self._function + '[' + ', '.join(
|
||||||
|
map(self._format, self.args)) + ']'
|
||||||
|
|
||||||
|
# end Array
|
||||||
|
|
||||||
|
|
||||||
|
def sub_ids_hierarchical(model_name):
|
||||||
|
""" get table with id and sub-ids
|
||||||
|
"""
|
||||||
|
Model2 = Pool().get(model_name)
|
||||||
|
tab_mod = Model2.__table__()
|
||||||
|
tab_mod2 = Model2.__table__()
|
||||||
|
|
||||||
|
lines = With('parent', 'id', recursive=True)
|
||||||
|
lines.query = tab_mod.select(
|
||||||
|
tab_mod.id, tab_mod.id,
|
||||||
|
) | tab_mod2.join(
|
||||||
|
lines,
|
||||||
|
condition=lines.id == tab_mod2.parent,
|
||||||
|
).select(lines.parent, tab_mod2.id)
|
||||||
|
lines.query.all_ = True
|
||||||
|
|
||||||
|
query = lines.select(
|
||||||
|
lines.parent,
|
||||||
|
ArrayAgg(lines.id).as_('subids'),
|
||||||
|
group_by=[lines.parent],
|
||||||
|
with_=[lines])
|
||||||
|
return query
|
||||||
|
|
||||||
|
|
||||||
|
def order_name_hierarchical(model_name, tables):
|
||||||
|
""" order by pos
|
||||||
|
a recursive sorting
|
||||||
|
"""
|
||||||
|
Model2 = Pool().get(model_name)
|
||||||
|
tab_mod = Model2.__table__()
|
||||||
|
tab_mod2 = Model2.__table__()
|
||||||
|
table, _ = tables[None]
|
||||||
|
|
||||||
|
lines = With('id', 'name', 'name_path', recursive=True)
|
||||||
|
lines.query = tab_mod.select(
|
||||||
|
tab_mod.id, tab_mod.name, Array(tab_mod.name),
|
||||||
|
where=tab_mod.parent == DEF_NONE,
|
||||||
|
)
|
||||||
|
lines.query |= tab_mod2.join(
|
||||||
|
lines,
|
||||||
|
condition=lines.id == tab_mod2.parent,
|
||||||
|
).select(
|
||||||
|
tab_mod2.id,
|
||||||
|
tab_mod2.name,
|
||||||
|
ArrayAppend(lines.name_path, tab_mod2.name),
|
||||||
|
)
|
||||||
|
lines.query.all_ = True
|
||||||
|
|
||||||
|
query = lines.select(
|
||||||
|
ArrayToString(lines.name_path, '/').as_('rec_name'),
|
||||||
|
where=table.id == lines.id,
|
||||||
|
with_=[lines])
|
||||||
|
return [query]
|
||||||
|
|
||||||
|
|
||||||
class UserValueMixin(ValueMixin):
|
class UserValueMixin(ValueMixin):
|
||||||
iduser = fields.Many2One(model_name='res.user', string="User",
|
iduser = fields.Many2One(
|
||||||
select=True, ondelete='CASCADE', required=True)
|
model_name='res.user', string="User",
|
||||||
|
ondelete='CASCADE', required=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(UserValueMixin, cls).__setup__()
|
super(UserValueMixin, cls).__setup__()
|
||||||
tab_val = cls.__table__()
|
tab_val = cls.__table__()
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
tab_val,
|
||||||
|
(tab_val.iduser, Index.Equality())),
|
||||||
|
})
|
||||||
cls._sql_constraints.extend([
|
cls._sql_constraints.extend([
|
||||||
('val_uniq',
|
('val_uniq',
|
||||||
Unique(tab_val, tab_val.iduser),
|
Unique(tab_val, tab_val.iduser),
|
||||||
|
@ -42,6 +161,7 @@ class UserMultiValueMixin(MultiValueMixin):
|
||||||
Value = self.multivalue_model(name)
|
Value = self.multivalue_model(name)
|
||||||
if issubclass(Value, UserValueMixin):
|
if issubclass(Value, UserValueMixin):
|
||||||
pattern = self.updt_multivalue_pattern(pattern)
|
pattern = self.updt_multivalue_pattern(pattern)
|
||||||
return super(UserMultiValueMixin, self).set_multivalue(name, value, **pattern)
|
return super(
|
||||||
|
UserMultiValueMixin, self).set_multivalue(name, value, **pattern)
|
||||||
|
|
||||||
# end UserMultiValueMixin
|
# end UserMultiValueMixin
|
||||||
|
|
|
@ -3,16 +3,13 @@
|
||||||
# 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 Workflow, ModelView, ModelSQL, fields
|
from trytond.model import Workflow, ModelView, ModelSQL, fields, Index
|
||||||
from trytond.transaction import Transaction
|
from trytond.pyson import Eval, If, Or
|
||||||
from trytond.pyson import Eval, If, Or, Bool
|
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
from sql.operators import Equal, Between
|
|
||||||
from sql import Literal, Null
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from .book import sel_state_book
|
from .book import sel_state_book
|
||||||
|
|
||||||
|
@ -36,12 +33,18 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
'Cashbook Reconciliation'
|
'Cashbook Reconciliation'
|
||||||
__name__ = 'cashbook.recon'
|
__name__ = 'cashbook.recon'
|
||||||
|
|
||||||
cashbook = fields.Many2One(string='Cashbook', required=True, select=True,
|
cashbook = fields.Many2One(
|
||||||
|
string='Cashbook', required=True,
|
||||||
model_name='cashbook.book', ondelete='CASCADE', readonly=True)
|
model_name='cashbook.book', ondelete='CASCADE', readonly=True)
|
||||||
date = fields.Date(string='Date', required=True, select=True,
|
date = fields.Date(
|
||||||
|
string='Date', required=True,
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
|
feature = fields.Function(fields.Char(
|
||||||
|
string='Feature', readonly=True,
|
||||||
|
states={'invisible': True}), 'on_change_with_feature')
|
||||||
|
|
||||||
date_from = fields.Date(string='Start Date',
|
date_from = fields.Date(
|
||||||
|
string='Start Date',
|
||||||
required=True,
|
required=True,
|
||||||
domain=[
|
domain=[
|
||||||
If(Eval('date_to') & Eval('date_from'),
|
If(Eval('date_to') & Eval('date_from'),
|
||||||
|
@ -49,7 +52,8 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
()),
|
()),
|
||||||
],
|
],
|
||||||
states=STATES, depends=DEPENDS+['date_to'])
|
states=STATES, depends=DEPENDS+['date_to'])
|
||||||
date_to = fields.Date(string='End Date',
|
date_to = fields.Date(
|
||||||
|
string='End Date',
|
||||||
required=True,
|
required=True,
|
||||||
domain=[
|
domain=[
|
||||||
If(Eval('date_to') & Eval('date_from'),
|
If(Eval('date_to') & Eval('date_from'),
|
||||||
|
@ -57,46 +61,55 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
()),
|
()),
|
||||||
],
|
],
|
||||||
states=STATES, depends=DEPENDS+['date_from'])
|
states=STATES, depends=DEPENDS+['date_from'])
|
||||||
start_amount = fields.Numeric(string='Start Amount', required=True,
|
start_amount = fields.Numeric(
|
||||||
|
string='Start Amount', required=True,
|
||||||
readonly=True, digits=(16, Eval('currency_digits', 2)),
|
readonly=True, digits=(16, Eval('currency_digits', 2)),
|
||||||
depends=['currency_digits'])
|
depends=['currency_digits'])
|
||||||
end_amount = fields.Numeric(string='End Amount', required=True,
|
end_amount = fields.Numeric(
|
||||||
|
string='End Amount', required=True,
|
||||||
readonly=True, digits=(16, Eval('currency_digits', 2)),
|
readonly=True, digits=(16, Eval('currency_digits', 2)),
|
||||||
depends=['currency_digits'])
|
depends=['currency_digits'])
|
||||||
|
|
||||||
lines = fields.One2Many(string='Lines', field='reconciliation',
|
lines = fields.One2Many(
|
||||||
|
string='Lines', field='reconciliation',
|
||||||
model_name='cashbook.line', states=STATES,
|
model_name='cashbook.line', states=STATES,
|
||||||
depends=DEPENDS+['date_from', 'date_to', 'cashbook'],
|
depends=DEPENDS+['date_from', 'date_to', 'cashbook'],
|
||||||
add_remove=[
|
add_remove=[
|
||||||
('cashbook', '=', Eval('cashbook')),
|
('cashbook', '=', Eval('cashbook')),
|
||||||
('state', 'in', ['check', 'done']),
|
('state', 'in', ['check', 'recon', 'done']),
|
||||||
('date', '>=', Eval('date_from')),
|
('date', '>=', Eval('date_from')),
|
||||||
('date', '<=', Eval('date_to')),
|
('date', '<=', Eval('date_to')),
|
||||||
],
|
],
|
||||||
domain=[
|
domain=[
|
||||||
('date', '>=', Eval('date_from')),
|
('date', '>=', Eval('date_from', None)),
|
||||||
('date', '<=', Eval('date_to')),
|
('date', '<=', Eval('date_to', None)),
|
||||||
])
|
])
|
||||||
|
|
||||||
currency = fields.Function(fields.Many2One(model_name='currency.currency',
|
currency = fields.Function(fields.Many2One(
|
||||||
|
model_name='currency.currency',
|
||||||
string="Currency"), 'on_change_with_currency')
|
string="Currency"), 'on_change_with_currency')
|
||||||
currency_digits = fields.Function(fields.Integer(string='Currency Digits'),
|
currency_digits = fields.Function(fields.Integer(
|
||||||
|
string='Currency Digits'),
|
||||||
'on_change_with_currency_digits')
|
'on_change_with_currency_digits')
|
||||||
predecessor = fields.Function(fields.Many2One(string='Predecessor', readonly=True,
|
predecessor = fields.Function(fields.Many2One(
|
||||||
|
string='Predecessor', readonly=True,
|
||||||
model_name='cashbook.recon'),
|
model_name='cashbook.recon'),
|
||||||
'on_change_with_predecessor')
|
'on_change_with_predecessor')
|
||||||
|
|
||||||
state = fields.Selection(string='State', required=True, readonly=True,
|
state = fields.Selection(
|
||||||
select=True, selection=sel_reconstate)
|
string='State', required=True, readonly=True,
|
||||||
|
selection=sel_reconstate)
|
||||||
state_string = state.translated('state')
|
state_string = state.translated('state')
|
||||||
state_cashbook = fields.Function(fields.Selection(string='State of Cashbook',
|
state_cashbook = fields.Function(fields.Selection(
|
||||||
|
string='State of Cashbook',
|
||||||
readonly=True, states={'invisible': True}, selection=sel_state_book),
|
readonly=True, states={'invisible': True}, selection=sel_state_book),
|
||||||
'on_change_with_state_cashbook')
|
'on_change_with_state_cashbook')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(Reconciliation, cls).__setup__()
|
super(Reconciliation, cls).__setup__()
|
||||||
cls._order.insert(0, ('date_from', 'ASC'))
|
cls._order.insert(0, ('date_from', 'DESC'))
|
||||||
|
t = cls.__table__()
|
||||||
cls._transitions |= set((
|
cls._transitions |= set((
|
||||||
('edit', 'check'),
|
('edit', 'check'),
|
||||||
('check', 'done'),
|
('check', 'done'),
|
||||||
|
@ -116,6 +129,23 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
'depends': ['state'],
|
'depends': ['state'],
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.cashbook, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.date, Index.Range())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.date_to, Index.Range())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.date_from, Index.Range(order='DESC'))),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.state, Index.Equality())),
|
||||||
|
})
|
||||||
|
|
||||||
def check_overlap_dates(self):
|
def check_overlap_dates(self):
|
||||||
""" deny overlap of date_from/date_to between records of same cashbook
|
""" deny overlap of date_from/date_to between records of same cashbook
|
||||||
|
@ -138,9 +168,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
[ # enclose other record
|
[ # enclose other record
|
||||||
('date_from', '>=', self.date_from),
|
('date_from', '>=', self.date_from),
|
||||||
('date_to', '<=', self.date_to),
|
('date_to', '<=', self.date_to),
|
||||||
],
|
]]]
|
||||||
],
|
|
||||||
]
|
|
||||||
|
|
||||||
if Recon.search_count(query) > 0:
|
if Recon.search_count(query) > 0:
|
||||||
raise UserError(gettext('cashbook.msg_recon_err_overlap'))
|
raise UserError(gettext('cashbook.msg_recon_err_overlap'))
|
||||||
|
@ -155,16 +183,61 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
if Line.search_count([
|
if Line.search_count([
|
||||||
('date', '>', reconciliation.date_from),
|
('date', '>', reconciliation.date_from),
|
||||||
('date', '<', reconciliation.date_to),
|
('date', '<', reconciliation.date_to),
|
||||||
('cashbook.id', '=', reconciliation.cashbook.id),
|
('cashbook', '=', reconciliation.cashbook.id),
|
||||||
('state', '!=', 'check'),
|
('state', 'not in', ['check', 'recon']),
|
||||||
]) > 0:
|
]) > 0:
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.mds_recon_deny_line_not_check',
|
'cashbook.mds_recon_deny_line_not_check',
|
||||||
bookname=reconciliation.cashbook.rec_name,
|
bookname=reconciliation.cashbook.rec_name,
|
||||||
reconame=reconciliation.rec_name,
|
reconame=reconciliation.rec_name,
|
||||||
datefrom=Report.format_date(reconciliation.date_from),
|
datefrom=Report.format_date(reconciliation.date_from),
|
||||||
dateto = Report.format_date(reconciliation.date_to),
|
dateto=Report.format_date(reconciliation.date_to)))
|
||||||
))
|
|
||||||
|
@classmethod
|
||||||
|
def get_values_wfedit(cls, reconciliation):
|
||||||
|
""" get values for 'to_write' in wf-edit
|
||||||
|
"""
|
||||||
|
values = {
|
||||||
|
'start_amount': Decimal('0.0'),
|
||||||
|
'end_amount': Decimal('0.0'),
|
||||||
|
}
|
||||||
|
|
||||||
|
# unlink lines from reconciliation
|
||||||
|
if len(reconciliation.lines) > 0:
|
||||||
|
values['lines'] = [
|
||||||
|
('remove', [x.id for x in reconciliation.lines])]
|
||||||
|
return values
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_values_wfcheck(cls, reconciliation):
|
||||||
|
""" get values for 'to_write' in wf-check
|
||||||
|
"""
|
||||||
|
Line = Pool().get('cashbook.line')
|
||||||
|
|
||||||
|
values = {}
|
||||||
|
if reconciliation.predecessor:
|
||||||
|
values['start_amount'] = reconciliation.predecessor.end_amount
|
||||||
|
else:
|
||||||
|
values['start_amount'] = Decimal('0.0')
|
||||||
|
values['end_amount'] = values['start_amount']
|
||||||
|
|
||||||
|
# add 'checked'-lines to reconciliation
|
||||||
|
lines = Line.search([
|
||||||
|
('date', '>=', reconciliation.date_from),
|
||||||
|
('date', '<=', reconciliation.date_to),
|
||||||
|
('cashbook', '=', reconciliation.cashbook.id),
|
||||||
|
('reconciliation', '=', None),
|
||||||
|
('state', 'in', ['check', 'recon']),
|
||||||
|
])
|
||||||
|
if len(lines) > 0:
|
||||||
|
values['lines'] = [('add', [x.id for x in lines])]
|
||||||
|
|
||||||
|
# add amounts of new lines
|
||||||
|
values['end_amount'] += sum([x.credit - x.debit for x in lines])
|
||||||
|
# add amounts of already linked lines
|
||||||
|
values['end_amount'] += sum([
|
||||||
|
x.credit - x.debit for x in reconciliation.lines])
|
||||||
|
return values
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
|
@ -176,16 +249,10 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
to_write = []
|
to_write = []
|
||||||
for reconciliation in reconciliations:
|
for reconciliation in reconciliations:
|
||||||
values = {
|
to_write.extend([
|
||||||
'start_amount': Decimal('0.0'),
|
[reconciliation],
|
||||||
'end_amount': Decimal('0.0'),
|
cls.get_values_wfedit(reconciliation),
|
||||||
}
|
])
|
||||||
|
|
||||||
# unlink lines from reconciliation
|
|
||||||
if len(reconciliation.lines) > 0:
|
|
||||||
values['lines'] = [('remove', [x.id for x in reconciliation.lines])]
|
|
||||||
|
|
||||||
to_write.extend([[reconciliation], values])
|
|
||||||
|
|
||||||
if len(to_write) > 0:
|
if len(to_write) > 0:
|
||||||
Recon.write(*to_write)
|
Recon.write(*to_write)
|
||||||
|
@ -197,55 +264,34 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
""" checked: add lines of book in date-range to reconciliation,
|
""" checked: add lines of book in date-range to reconciliation,
|
||||||
state of lines must be 'checked'
|
state of lines must be 'checked'
|
||||||
"""
|
"""
|
||||||
pool = Pool()
|
Recon = Pool().get('cashbook.recon')
|
||||||
Line = pool.get('cashbook.line')
|
|
||||||
Recon = pool.get('cashbook.recon')
|
|
||||||
|
|
||||||
cls.check_lines_not_checked(reconciliations)
|
cls.check_lines_not_checked(reconciliations)
|
||||||
|
|
||||||
to_write = []
|
to_write = []
|
||||||
for reconciliation in reconciliations:
|
for reconciliation in reconciliations:
|
||||||
values = {}
|
|
||||||
|
|
||||||
if reconciliation.predecessor:
|
if reconciliation.predecessor:
|
||||||
# predecessor must be 'done'
|
# predecessor must be 'done'
|
||||||
if reconciliation.predecessor.state != 'done':
|
if reconciliation.predecessor.state != 'done':
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_recon_predecessor_not_done',
|
'cashbook.msg_recon_predecessor_not_done',
|
||||||
recname_p=reconciliation.predecessor.rec_name,
|
recname_p=reconciliation.predecessor.rec_name,
|
||||||
recname_c = reconciliation.rec_name,
|
recname_c=reconciliation.rec_name))
|
||||||
))
|
|
||||||
|
|
||||||
# check if current.date_from == predecessor.date_to
|
# check if current.date_from == predecessor.date_to
|
||||||
if reconciliation.predecessor.date_to != reconciliation.date_from:
|
if reconciliation.predecessor.date_to != \
|
||||||
|
reconciliation.date_from:
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_recon_date_from_to_mismatch',
|
'cashbook.msg_recon_date_from_to_mismatch',
|
||||||
datefrom=Report.format_date(reconciliation.date_from),
|
datefrom=Report.format_date(reconciliation.date_from),
|
||||||
dateto = Report.format_date(reconciliation.predecessor.date_to),
|
dateto=Report.format_date(
|
||||||
recname = reconciliation.rec_name,
|
reconciliation.predecessor.date_to),
|
||||||
))
|
recname=reconciliation.rec_name))
|
||||||
values['start_amount'] = reconciliation.predecessor.end_amount
|
|
||||||
else :
|
|
||||||
values['start_amount'] = reconciliation.cashbook.start_balance
|
|
||||||
values['end_amount'] = values['start_amount']
|
|
||||||
|
|
||||||
# add 'checked'-lines to reconciliation
|
to_write.extend([
|
||||||
lines = Line.search([
|
[reconciliation],
|
||||||
('date', '>=', reconciliation.date_from),
|
cls.get_values_wfcheck(reconciliation),
|
||||||
('date', '<=', reconciliation.date_to),
|
|
||||||
('cashbook.id', '=', reconciliation.cashbook.id),
|
|
||||||
('reconciliation', '=', None),
|
|
||||||
('state', '=', 'check'),
|
|
||||||
])
|
])
|
||||||
if len(lines) > 0:
|
|
||||||
values['lines'] = [('add', [x.id for x in lines])]
|
|
||||||
|
|
||||||
# add amounts of new lines
|
|
||||||
values['end_amount'] += sum([x.credit - x.debit for x in lines])
|
|
||||||
# add amounts of already linked lines
|
|
||||||
values['end_amount'] += sum([x.credit - x.debit for x in reconciliation.lines])
|
|
||||||
|
|
||||||
to_write.extend([[reconciliation], values])
|
|
||||||
|
|
||||||
if len(to_write) > 0:
|
if len(to_write) > 0:
|
||||||
Recon.write(*to_write)
|
Recon.write(*to_write)
|
||||||
|
@ -259,12 +305,18 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
Line = Pool().get('cashbook.line')
|
Line = Pool().get('cashbook.line')
|
||||||
|
|
||||||
to_wfdone_line = []
|
to_wfdone_line = []
|
||||||
|
to_wfrecon_line = []
|
||||||
for reconciliation in reconciliations:
|
for reconciliation in reconciliations:
|
||||||
to_wfdone_line.extend(list(reconciliation.lines))
|
to_wfrecon_line.extend([
|
||||||
|
x for x in reconciliation.lines
|
||||||
|
if x.state == 'check'])
|
||||||
|
to_wfdone_line.extend([
|
||||||
|
x for x in reconciliation.lines
|
||||||
|
if x.state == 'recon'])
|
||||||
|
|
||||||
# deny if there are lines not linked to reconciliation
|
# deny if there are lines not linked to reconciliation
|
||||||
if Line.search_count([
|
if Line.search_count([
|
||||||
('cashbook.id', '=', reconciliation.cashbook.id),
|
('cashbook', '=', reconciliation.cashbook.id),
|
||||||
('reconciliation', '=', None),
|
('reconciliation', '=', None),
|
||||||
['OR',
|
['OR',
|
||||||
[ # lines inside of date-range
|
[ # lines inside of date-range
|
||||||
|
@ -272,29 +324,40 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
('date', '<', reconciliation.date_to),
|
('date', '<', reconciliation.date_to),
|
||||||
],
|
],
|
||||||
# lines at from-date must relate to a reconciliation
|
# lines at from-date must relate to a reconciliation
|
||||||
('date', '=', reconciliation.date_from),
|
('date', '=', reconciliation.date_from)],
|
||||||
],
|
|
||||||
]) > 0:
|
]) > 0:
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_recon_lines_no_linked',
|
'cashbook.msg_recon_lines_no_linked',
|
||||||
date_from=Report.format_date(reconciliation.date_from),
|
date_from=Report.format_date(reconciliation.date_from),
|
||||||
date_to = Report.format_date(reconciliation.date_to),
|
date_to=Report.format_date(reconciliation.date_to),))
|
||||||
))
|
|
||||||
|
|
||||||
|
if len(to_wfrecon_line) > 0:
|
||||||
|
Line.wfrecon(to_wfrecon_line)
|
||||||
|
to_wfdone_line.extend(to_wfrecon_line)
|
||||||
if len(to_wfdone_line) > 0:
|
if len(to_wfdone_line) > 0:
|
||||||
Line.wfdone(to_wfdone_line)
|
Line.wfdone(to_wfdone_line)
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
def get_rec_name(self, name):
|
||||||
""" short + name
|
""" short + name
|
||||||
"""
|
"""
|
||||||
return '%(from)s - %(to)s | %(start_amount)s %(symbol)s - %(end_amount)s %(symbol)s [%(num)s]' % {
|
return ' '.join([
|
||||||
'from': Report.format_date(self.date_from, None) if self.date_from is not None else '-',
|
Report.format_date(self.date_from, None)
|
||||||
'to': Report.format_date(self.date_to, None) if self.date_to is not None else '-',
|
if self.date_from is not None else '-',
|
||||||
'start_amount': Report.format_number(self.start_amount or 0.0, None),
|
'-',
|
||||||
'end_amount': Report.format_number(self.end_amount or 0.0, None),
|
Report.format_date(self.date_to, None)
|
||||||
'symbol': getattr(self.currency, 'symbol', '-'),
|
if self.date_to is not None else '-',
|
||||||
'num': len(self.lines),
|
'|',
|
||||||
}
|
Report.format_number(
|
||||||
|
self.start_amount or 0.0, None,
|
||||||
|
digits=getattr(self.currency, 'digits', 2)),
|
||||||
|
getattr(self.currency, 'symbol', '-'),
|
||||||
|
'-',
|
||||||
|
Report.format_number(
|
||||||
|
self.end_amount or 0.0, None,
|
||||||
|
digits=getattr(self.currency, 'digits', 2)),
|
||||||
|
getattr(self.currency, 'symbol', '-'),
|
||||||
|
'[%(num)s]' % {'num': len(self.lines)},
|
||||||
|
])
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_date_from(cls):
|
def default_date_from(cls):
|
||||||
|
@ -331,6 +394,13 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
IrDate = Pool().get('ir.date')
|
IrDate = Pool().get('ir.date')
|
||||||
return IrDate.today()
|
return IrDate.today()
|
||||||
|
|
||||||
|
@fields.depends('cashbook', '_parent_cashbook.btype')
|
||||||
|
def on_change_with_feature(self, name=None):
|
||||||
|
""" get feature-set
|
||||||
|
"""
|
||||||
|
if self.cashbook:
|
||||||
|
return self.cashbook.btype.feature
|
||||||
|
|
||||||
@fields.depends('cashbook', '_parent_cashbook.id', 'date_from')
|
@fields.depends('cashbook', '_parent_cashbook.id', 'date_from')
|
||||||
def on_change_with_predecessor(self, name=None):
|
def on_change_with_predecessor(self, name=None):
|
||||||
""" get predecessor
|
""" get predecessor
|
||||||
|
@ -340,7 +410,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
if self.cashbook:
|
if self.cashbook:
|
||||||
if self.date_from is not None:
|
if self.date_from is not None:
|
||||||
reconciliations = Recon.search([
|
reconciliations = Recon.search([
|
||||||
('cashbook.id', '=', self.cashbook.id),
|
('cashbook', '=', self.cashbook.id),
|
||||||
('date_from', '<', self.date_from),
|
('date_from', '<', self.date_from),
|
||||||
], order=[('date_from', 'DESC')], limit=1)
|
], order=[('date_from', 'DESC')], limit=1)
|
||||||
if len(reconciliations) > 0:
|
if len(reconciliations) > 0:
|
||||||
|
@ -355,7 +425,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
@fields.depends('cashbook', '_parent_cashbook.currency')
|
@fields.depends('cashbook', '_parent_cashbook.currency')
|
||||||
def on_change_with_currency_digits(self, name=None):
|
def on_change_with_currency_digits(self, name=None):
|
||||||
""" currency of cashbook
|
""" currency-digits of cashbook
|
||||||
"""
|
"""
|
||||||
if self.cashbook:
|
if self.cashbook:
|
||||||
return self.cashbook.currency.digits
|
return self.cashbook.currency.digits
|
||||||
|
@ -392,7 +462,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
# set date_from to date_to of predecessor
|
# set date_from to date_to of predecessor
|
||||||
recons = Recon.search([
|
recons = Recon.search([
|
||||||
('cashbook.id', '=', id_cashbook),
|
('cashbook', '=', id_cashbook),
|
||||||
], order=[('date_to', 'DESC')], limit=1)
|
], order=[('date_to', 'DESC')], limit=1)
|
||||||
if len(recons) > 0:
|
if len(recons) > 0:
|
||||||
values['date_from'] = recons[0].date_to
|
values['date_from'] = recons[0].date_to
|
||||||
|
@ -401,7 +471,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
|
|
||||||
# set date_to to day of last 'checked'-booking in selected cashbook
|
# set date_to to day of last 'checked'-booking in selected cashbook
|
||||||
lines = Line.search([
|
lines = Line.search([
|
||||||
('cashbook.id', '=', id_cashbook),
|
('cashbook', '=', id_cashbook),
|
||||||
('state', '=', 'check'),
|
('state', '=', 'check'),
|
||||||
('reconciliation', '=', None),
|
('reconciliation', '=', None),
|
||||||
], order=[('date', 'DESC')], limit=1)
|
], order=[('date', 'DESC')], limit=1)
|
||||||
|
@ -423,8 +493,7 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_book_deny_write',
|
'cashbook.msg_book_deny_write',
|
||||||
bookname=reconciliation.cashbook.rec_name,
|
bookname=reconciliation.cashbook.rec_name,
|
||||||
state_txt = reconciliation.cashbook.state_string,
|
state_txt=reconciliation.cashbook.state_string))
|
||||||
))
|
|
||||||
super(Reconciliation, cls).write(*args)
|
super(Reconciliation, cls).write(*args)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -437,15 +506,13 @@ class Reconciliation(Workflow, ModelSQL, ModelView):
|
||||||
'cashbook.msg_line_deny_delete1',
|
'cashbook.msg_line_deny_delete1',
|
||||||
linetxt=reconciliation.rec_name,
|
linetxt=reconciliation.rec_name,
|
||||||
bookname=reconciliation.cashbook.rec_name,
|
bookname=reconciliation.cashbook.rec_name,
|
||||||
bookstate = reconciliation.cashbook.state_string,
|
bookstate=reconciliation.cashbook.state_string))
|
||||||
))
|
|
||||||
if reconciliation.state != 'edit':
|
if reconciliation.state != 'edit':
|
||||||
raise UserError(gettext(
|
raise UserError(gettext(
|
||||||
'cashbook.msg_recon_deny_delete2',
|
'cashbook.msg_recon_deny_delete2',
|
||||||
recontxt=reconciliation.rec_name,
|
recontxt=reconciliation.rec_name,
|
||||||
reconstate = reconciliation.state_string,
|
reconstate=reconciliation.state_string))
|
||||||
))
|
|
||||||
|
|
||||||
return super(Reconciliation, cls).delete(reconciliations)
|
super(Reconciliation, cls).delete(reconciliations)
|
||||||
|
|
||||||
# end Type
|
# end Type
|
||||||
|
|
|
@ -96,8 +96,8 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_recon_write-1">
|
<record model="ir.rule" id="rg_recon_write-1">
|
||||||
<field name="domain" eval="['OR',
|
<field name="domain" eval="['OR',
|
||||||
('cashbook.owner.id', '=', Eval('user', {}).get('id', -1)),
|
('cashbook.owner.id', '=', Eval('user_id', -1)),
|
||||||
('cashbook.reviewer.id', 'in', Eval('user', {}).get('groups', [])),
|
('cashbook.reviewer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_recon_write"/>
|
<field name="rule_group" ref="rg_recon_write"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -119,7 +119,7 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_recon_read-1">
|
<record model="ir.rule" id="rg_recon_read-1">
|
||||||
<field name="domain" eval="[
|
<field name="domain" eval="[
|
||||||
('cashbook.observer.id', 'in', Eval('user', {}).get('groups', [])),
|
('cashbook.observer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_recon_read"/>
|
<field name="rule_group" ref="rg_recon_read"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
35
setup.py
35
setup.py
|
@ -2,7 +2,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Always prefer setuptools over distutils
|
# Always prefer setuptools over distutils
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup
|
||||||
# To use a consistent encoding
|
# To use a consistent encoding
|
||||||
from codecs import open
|
from codecs import open
|
||||||
from os import path
|
from os import path
|
||||||
|
@ -22,7 +22,7 @@ with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
|
||||||
|
|
||||||
# tryton.cfg einlesen
|
# tryton.cfg einlesen
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
config.readfp(open('tryton.cfg'))
|
config.read_file(open('tryton.cfg'))
|
||||||
info = dict(config.items('tryton'))
|
info = dict(config.items('tryton'))
|
||||||
for key in ('depends', 'extras_depend', 'xml'):
|
for key in ('depends', 'extras_depend', 'xml'):
|
||||||
if key in info:
|
if key in info:
|
||||||
|
@ -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 = ['python-slugify']
|
requires = ['python-slugify']
|
||||||
|
@ -51,23 +51,27 @@ for dep in info.get('depends', []):
|
||||||
prefix = modversion[dep]['prefix']
|
prefix = modversion[dep]['prefix']
|
||||||
|
|
||||||
if len(modversion[dep]['max']) > 0:
|
if len(modversion[dep]['max']) > 0:
|
||||||
requires.append('%s_%s >= %s, <= %s' %
|
requires.append('%s_%s >= %s, <= %s' % (
|
||||||
(prefix, dep, modversion[dep]['min'], modversion[dep]['max']))
|
prefix, dep, modversion[dep]['min'],
|
||||||
|
modversion[dep]['max']))
|
||||||
else:
|
else:
|
||||||
requires.append('%s_%s >= %s' %
|
requires.append('%s_%s >= %s' % (
|
||||||
(prefix, dep, modversion[dep]['min']))
|
prefix, dep, modversion[dep]['min']))
|
||||||
else:
|
else:
|
||||||
requires.append('%s_%s >= %s.%s, < %s.%s' %
|
requires.append('%s_%s >= %s.%s, < %s.%s' % (
|
||||||
('trytond', dep, major_version, minor_version,
|
'trytond', dep, major_version, minor_version,
|
||||||
major_version, minor_version + 1))
|
major_version, minor_version + 1))
|
||||||
requires.append('trytond >= %s.%s, < %s.%s' %
|
requires.append('trytond >= %s.%s, < %s.%s' % (
|
||||||
(major_version, minor_version, major_version, minor_version + 1))
|
major_version, minor_version, major_version, minor_version + 1))
|
||||||
|
|
||||||
setup(name='%s_%s' % (PREFIX, MODULE),
|
setup(
|
||||||
|
name='%s_%s' % (PREFIX, MODULE),
|
||||||
version=info.get('version', '0.0.1'),
|
version=info.get('version', '0.0.1'),
|
||||||
description='Tryton module to add a cashbook.',
|
description='Tryton module to add a cashbook.',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
long_description_content_type='text/x-rst',
|
||||||
url='https://www.m-ds.de/',
|
url='https://www.m-ds.de/',
|
||||||
|
download_url='https://scmdev.m-ds.de/Tryton/Extra/cashbook',
|
||||||
author='martin-data services',
|
author='martin-data services',
|
||||||
author_email='service@m-ds.de',
|
author_email='service@m-ds.de',
|
||||||
license='GPL-3',
|
license='GPL-3',
|
||||||
|
@ -87,6 +91,7 @@ setup(name='%s_%s' % (PREFIX, MODULE),
|
||||||
'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',
|
keywords='tryton cashbook',
|
||||||
|
@ -95,9 +100,9 @@ setup(name='%s_%s' % (PREFIX, MODULE),
|
||||||
'trytond.modules.%s' % MODULE,
|
'trytond.modules.%s' % MODULE,
|
||||||
],
|
],
|
||||||
package_data={
|
package_data={
|
||||||
'trytond.modules.%s' % MODULE: (info.get('xml', [])
|
'trytond.modules.%s' % MODULE: (info.get('xml', []) + [
|
||||||
+ ['tryton.cfg', 'locale/*.po', 'tests/*.py',
|
'tryton.cfg', 'locale/*.po', 'tests/*.py',
|
||||||
'view/*.xml', 'icon/*.svg',
|
'view/*.xml', 'icon/*.svg', 'docs/*.txt',
|
||||||
'report/*.fods', 'versiondep.txt', 'README.rst']),
|
'report/*.fods', 'versiondep.txt', 'README.rst']),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
237
splitline.py
237
splitline.py
|
@ -1,84 +1,184 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# This file is part of the cashbook-module from m-ds for Tryton.
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
# 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 ModelView, ModelSQL, Workflow, fields, Check
|
from trytond.model import ModelView, ModelSQL, fields, Index
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.pyson import Eval, If
|
from trytond.pyson import Eval, If
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
from trytond.transaction import Transaction
|
from .line import sel_bookingtype, sel_linestate, STATES, DEPENDS
|
||||||
from .line import sel_linetype, sel_bookingtype, STATES, DEPENDS
|
|
||||||
from .book import sel_state_book
|
from .book import sel_state_book
|
||||||
|
from .mixin import SecondCurrencyMixin
|
||||||
|
|
||||||
|
|
||||||
class SplitLine(ModelSQL, ModelView):
|
sel_linetype = [
|
||||||
|
('cat', 'Category'),
|
||||||
|
('tr', 'Transfer'),
|
||||||
|
]
|
||||||
|
|
||||||
|
sel_target = [
|
||||||
|
('cashbook.book', 'Cashbook'),
|
||||||
|
('cashbook.category', 'Category'),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class SplitLine(SecondCurrencyMixin, ModelSQL, ModelView):
|
||||||
'Split booking line'
|
'Split booking line'
|
||||||
__name__ = 'cashbook.split'
|
__name__ = 'cashbook.split'
|
||||||
|
|
||||||
line = fields.Many2One(string='Line', required=True,
|
line = fields.Many2One(
|
||||||
select=True, ondelete='CASCADE', model_name='cashbook.line',
|
string='Line', required=True,
|
||||||
|
ondelete='CASCADE', model_name='cashbook.line',
|
||||||
readonly=True)
|
readonly=True)
|
||||||
description = fields.Text(string='Description',
|
description = fields.Text(
|
||||||
|
string='Description', states=STATES, depends=DEPENDS)
|
||||||
|
splittype = fields.Selection(
|
||||||
|
string='Type', required=True,
|
||||||
|
help='Type of split booking line', selection=sel_linetype,
|
||||||
states=STATES, depends=DEPENDS)
|
states=STATES, depends=DEPENDS)
|
||||||
category = fields.Many2One(string='Category',
|
category = fields.Many2One(
|
||||||
|
string='Category',
|
||||||
model_name='cashbook.category', ondelete='RESTRICT',
|
model_name='cashbook.category', ondelete='RESTRICT',
|
||||||
states=STATES, depends=DEPENDS+['bookingtype'], required=True,
|
states={
|
||||||
|
'readonly': STATES['readonly'],
|
||||||
|
'required': Eval('splittype', '') == 'cat',
|
||||||
|
'invisible': Eval('splittype', '') != 'cat',
|
||||||
|
}, depends=DEPENDS+['bookingtype', 'splittype'],
|
||||||
domain=[
|
domain=[
|
||||||
If(
|
If(
|
||||||
Eval('bookingtype', '') == 'spin',
|
Eval('bookingtype', '') == 'spin',
|
||||||
('cattype', '=', 'in'),
|
('cattype', '=', 'in'),
|
||||||
('cattype', '=', 'out'),
|
('cattype', '=', 'out'),
|
||||||
)])
|
)])
|
||||||
category_view = fields.Function(fields.Char(string='Category', readonly=True),
|
category_view = fields.Function(fields.Char(
|
||||||
|
string='Category', readonly=True),
|
||||||
'on_change_with_category_view')
|
'on_change_with_category_view')
|
||||||
amount = fields.Numeric(string='Amount', digits=(16, Eval('currency_digits', 2)),
|
booktransf = fields.Many2One(
|
||||||
|
string='Source/Dest',
|
||||||
|
ondelete='RESTRICT', model_name='cashbook.book',
|
||||||
|
domain=[
|
||||||
|
('owner.id', '=', Eval('owner_cashbook', -1)),
|
||||||
|
('id', '!=', Eval('cashbook', -1)),
|
||||||
|
('btype', '!=', None),
|
||||||
|
],
|
||||||
|
states={
|
||||||
|
'readonly': STATES['readonly'],
|
||||||
|
'invisible': Eval('splittype', '') != 'tr',
|
||||||
|
'required': Eval('splittype', '') == 'tr',
|
||||||
|
}, depends=DEPENDS+['bookingtype', 'owner_cashbook', 'cashbook'])
|
||||||
|
|
||||||
|
amount = fields.Numeric(
|
||||||
|
string='Amount', digits=(16, Eval('currency_digits', 2)),
|
||||||
required=True, states=STATES, depends=DEPENDS+['currency_digits'])
|
required=True, states=STATES, depends=DEPENDS+['currency_digits'])
|
||||||
|
|
||||||
currency = fields.Function(fields.Many2One(model_name='currency.currency',
|
date = fields.Function(fields.Date(
|
||||||
|
string='Date', readonly=True), 'on_change_with_date')
|
||||||
|
target = fields.Function(fields.Reference(
|
||||||
|
string='Target', readonly=True,
|
||||||
|
selection=sel_target), 'on_change_with_target')
|
||||||
|
currency = fields.Function(fields.Many2One(
|
||||||
|
model_name='currency.currency',
|
||||||
string="Currency", readonly=True), 'on_change_with_currency')
|
string="Currency", readonly=True), 'on_change_with_currency')
|
||||||
currency_digits = fields.Function(fields.Integer(string='Currency Digits',
|
currency_digits = fields.Function(fields.Integer(
|
||||||
|
string='Currency Digits',
|
||||||
readonly=True), 'on_change_with_currency_digits')
|
readonly=True), 'on_change_with_currency_digits')
|
||||||
bookingtype = fields.Function(fields.Selection(string='Type', readonly=True,
|
bookingtype = fields.Function(fields.Selection(
|
||||||
|
string='Type', readonly=True,
|
||||||
selection=sel_bookingtype), 'on_change_with_bookingtype')
|
selection=sel_bookingtype), 'on_change_with_bookingtype')
|
||||||
state = fields.Function(fields.Selection(string='State', readonly=True,
|
state = fields.Function(fields.Selection(
|
||||||
selection=sel_linetype), 'on_change_with_state')
|
string='State', readonly=True,
|
||||||
state_cashbook = fields.Function(fields.Selection(string='State of Cashbook',
|
selection=sel_linestate), 'on_change_with_state')
|
||||||
|
cashbook = fields.Function(fields.Many2One(
|
||||||
|
string='Cashbook',
|
||||||
|
readonly=True, states={'invisible': True}, model_name='cashbook.book'),
|
||||||
|
'on_change_with_cashbook')
|
||||||
|
feature = fields.Function(fields.Char(
|
||||||
|
string='Feature', readonly=True,
|
||||||
|
states={'invisible': True}), 'on_change_with_feature')
|
||||||
|
booktransf_feature = fields.Function(fields.Char(
|
||||||
|
string='Feature', readonly=True,
|
||||||
|
states={'invisible': True}), 'on_change_with_booktransf_feature')
|
||||||
|
state_cashbook = fields.Function(fields.Selection(
|
||||||
|
string='State of Cashbook',
|
||||||
readonly=True, states={'invisible': True}, selection=sel_state_book),
|
readonly=True, states={'invisible': True}, selection=sel_state_book),
|
||||||
'on_change_with_state_cashbook')
|
'on_change_with_state_cashbook')
|
||||||
|
owner_cashbook = fields.Function(fields.Many2One(
|
||||||
|
string='Owner', readonly=True,
|
||||||
|
states={'invisible': True}, model_name='res.user'),
|
||||||
|
'on_change_with_owner_cashbook')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __setup__(cls):
|
||||||
|
super(SplitLine, cls).__setup__()
|
||||||
|
t = cls.__table__()
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.line, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.splittype, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.category, Index.Equality())),
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.booktransf, Index.Equality())),
|
||||||
|
})
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_splittype(cls):
|
||||||
|
""" default category
|
||||||
|
"""
|
||||||
|
return 'cat'
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
def get_rec_name(self, name):
|
||||||
""" short + name
|
""" short + name
|
||||||
"""
|
"""
|
||||||
return '%(type)s|%(amount)s %(symbol)s|%(desc)s [%(category)s]' % {
|
return '%(type)s|%(amount)s %(symbol)s|%(desc)s [%(target)s]' % {
|
||||||
'desc': (self.description or '-')[:40],
|
'desc': (self.description or '-')[:40],
|
||||||
'amount': Report.format_number(self.amount, None),
|
'amount': Report.format_number(
|
||||||
|
self.amount, None,
|
||||||
|
digits=getattr(self.currency, 'digits', 2)),
|
||||||
'symbol': getattr(self.currency, 'symbol', '-'),
|
'symbol': getattr(self.currency, 'symbol', '-'),
|
||||||
'category': self.category_view,
|
'target': self.category_view
|
||||||
'type': gettext('cashbook.msg_line_bookingtype_%s' % self.line.bookingtype),
|
if self.splittype == 'cat' else self.booktransf.rec_name,
|
||||||
|
'type': gettext(
|
||||||
|
'cashbook.msg_line_bookingtype_%s' % self.line.bookingtype),
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_amount_by_second_currency(self, to_currency):
|
@fields.depends('splittype', 'category', 'booktransf')
|
||||||
""" get amount, calculate credit/debit from currency of current
|
def on_change_splittype(self):
|
||||||
cashbook to 'to_currency'
|
""" clear category if not valid type
|
||||||
"""
|
"""
|
||||||
Currency = Pool().get('currency.currency')
|
if self.splittype:
|
||||||
|
if self.splittype == 'cat':
|
||||||
|
self.booktransf = None
|
||||||
|
if self.splittype == 'tr':
|
||||||
|
self.category = None
|
||||||
|
|
||||||
values = {
|
@fields.depends('line', '_parent_line.date')
|
||||||
'amount': self.amount,
|
def on_change_with_date(self, name=None):
|
||||||
}
|
""" get date of line
|
||||||
|
"""
|
||||||
|
if self.line:
|
||||||
|
if self.line.date is not None:
|
||||||
|
return self.line.date
|
||||||
|
|
||||||
if to_currency.id != self.line.cashbook.currency.id:
|
@fields.depends('splittype', 'category', 'booktransf')
|
||||||
with Transaction().set_context({
|
def on_change_with_target(self, name=None):
|
||||||
'date': self.line.date,
|
""" get category or cashbook
|
||||||
}):
|
"""
|
||||||
values['amount'] = Currency.compute(
|
if self.splittype:
|
||||||
self.line.cashbook.currency,
|
if self.splittype == 'cat':
|
||||||
self.amount,
|
if self.category:
|
||||||
to_currency)
|
return 'cashbook.category,%d' % self.category.id
|
||||||
return values
|
elif self.splittype == 'tr':
|
||||||
|
if self.booktransf:
|
||||||
|
return 'cashbook.book,%d' % self.booktransf.id
|
||||||
|
|
||||||
@fields.depends('category')
|
@fields.depends('category')
|
||||||
def on_change_with_category_view(self, name=None):
|
def on_change_with_category_view(self, name=None):
|
||||||
|
@ -89,7 +189,7 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
if self.category:
|
if self.category:
|
||||||
cfg1 = Configuration.get_singleton()
|
cfg1 = Configuration.get_singleton()
|
||||||
|
|
||||||
if getattr(cfg1, 'catnamelong', True) == True:
|
if getattr(cfg1, 'catnamelong', True) is True:
|
||||||
return self.category.rec_name
|
return self.category.rec_name
|
||||||
else:
|
else:
|
||||||
return self.category.name
|
return self.category.name
|
||||||
|
@ -101,6 +201,13 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
if self.line:
|
if self.line:
|
||||||
return self.line.state
|
return self.line.state
|
||||||
|
|
||||||
|
@fields.depends('line', '_parent_line.cashbook')
|
||||||
|
def on_change_with_cashbook(self, name=None):
|
||||||
|
""" get cashbook
|
||||||
|
"""
|
||||||
|
if self.line:
|
||||||
|
return self.line.cashbook.id
|
||||||
|
|
||||||
@fields.depends('line', '_parent_line.cashbook')
|
@fields.depends('line', '_parent_line.cashbook')
|
||||||
def on_change_with_state_cashbook(self, name=None):
|
def on_change_with_state_cashbook(self, name=None):
|
||||||
""" get state of cashbook
|
""" get state of cashbook
|
||||||
|
@ -108,6 +215,13 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
if self.line:
|
if self.line:
|
||||||
return self.line.cashbook.state
|
return self.line.cashbook.state
|
||||||
|
|
||||||
|
@fields.depends('line', '_parent_line.cashbook')
|
||||||
|
def on_change_with_owner_cashbook(self, name=None):
|
||||||
|
""" get current owner
|
||||||
|
"""
|
||||||
|
if self.line:
|
||||||
|
return self.line.cashbook.owner.id
|
||||||
|
|
||||||
@fields.depends('line', '_parent_line.bookingtype')
|
@fields.depends('line', '_parent_line.bookingtype')
|
||||||
def on_change_with_bookingtype(self, name=None):
|
def on_change_with_bookingtype(self, name=None):
|
||||||
""" get type
|
""" get type
|
||||||
|
@ -115,6 +229,21 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
if self.line:
|
if self.line:
|
||||||
return self.line.bookingtype
|
return self.line.bookingtype
|
||||||
|
|
||||||
|
@fields.depends('line', '_parent_line.cashbook')
|
||||||
|
def on_change_with_feature(self, name=None):
|
||||||
|
""" get feature-set
|
||||||
|
"""
|
||||||
|
if self.line:
|
||||||
|
return self.line.cashbook.btype.feature
|
||||||
|
|
||||||
|
@fields.depends('booktransf', '_parent_booktransf.feature')
|
||||||
|
def on_change_with_booktransf_feature(self, name=None):
|
||||||
|
""" get 'feature' of counterpart
|
||||||
|
"""
|
||||||
|
if self.booktransf:
|
||||||
|
if self.booktransf.btype:
|
||||||
|
return self.booktransf.btype.feature
|
||||||
|
|
||||||
@fields.depends('line', '_parent_line.cashbook')
|
@fields.depends('line', '_parent_line.cashbook')
|
||||||
def on_change_with_currency(self, name=None):
|
def on_change_with_currency(self, name=None):
|
||||||
""" currency of cashbook
|
""" currency of cashbook
|
||||||
|
@ -131,6 +260,17 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
else:
|
else:
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def add_2nd_unit_values(cls, values):
|
||||||
|
""" extend create-values
|
||||||
|
"""
|
||||||
|
Line2 = Pool().get('cashbook.line')
|
||||||
|
line = Line2(values.get('line', None))
|
||||||
|
|
||||||
|
if line:
|
||||||
|
values.update(cls.add_2nd_currency(values, line.cashbook.currency))
|
||||||
|
return values
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, vlist):
|
def create(cls, vlist):
|
||||||
""" add debit/credit
|
""" add debit/credit
|
||||||
|
@ -138,15 +278,19 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
Line2 = Pool().get('cashbook.line')
|
Line2 = Pool().get('cashbook.line')
|
||||||
|
|
||||||
vlist = [x.copy() for x in vlist]
|
vlist = [x.copy() for x in vlist]
|
||||||
|
for values in vlist:
|
||||||
|
values.update(cls.add_2nd_unit_values(values))
|
||||||
records = super(SplitLine, cls).create(vlist)
|
records = super(SplitLine, cls).create(vlist)
|
||||||
|
|
||||||
to_update_line = []
|
to_update_line = []
|
||||||
for record in records:
|
for record in records:
|
||||||
if not record.line in to_update_line:
|
if record.line not in to_update_line:
|
||||||
to_update_line.append(record.line)
|
to_update_line.append(record.line)
|
||||||
|
|
||||||
if len(to_update_line) > 0:
|
to_write = Line2.update_values_by_splitlines(to_update_line)
|
||||||
Line2.update_amount_by_splitlines(to_update_line)
|
if len(to_write) > 0:
|
||||||
|
Line2.write(*to_write)
|
||||||
|
return records
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def write(cls, *args):
|
def write(cls, *args):
|
||||||
|
@ -162,12 +306,13 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
|
|
||||||
if 'amount' in values.keys():
|
if 'amount' in values.keys():
|
||||||
for record in records:
|
for record in records:
|
||||||
if not record.line in to_update_line:
|
if record.line not in to_update_line:
|
||||||
to_update_line.append(record.line)
|
to_update_line.append(record.line)
|
||||||
super(SplitLine, cls).write(*args)
|
super(SplitLine, cls).write(*args)
|
||||||
|
|
||||||
if len(to_update_line) > 0:
|
to_write = Line2.update_values_by_splitlines(to_update_line)
|
||||||
Line2.update_amount_by_splitlines(to_update_line)
|
if len(to_write) > 0:
|
||||||
|
Line2.write(*to_write)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def delete(cls, splitlines):
|
def delete(cls, splitlines):
|
||||||
|
@ -176,6 +321,6 @@ class SplitLine(ModelSQL, ModelView):
|
||||||
Line2 = Pool().get('cashbook.line')
|
Line2 = Pool().get('cashbook.line')
|
||||||
|
|
||||||
Line2.check_permission_delete([x.line for x in splitlines])
|
Line2.check_permission_delete([x.line for x in splitlines])
|
||||||
return super(SplitLine, cls).delete(splitlines)
|
super(SplitLine, cls).delete(splitlines)
|
||||||
|
|
||||||
# end SplitLine
|
# end SplitLine
|
||||||
|
|
|
@ -80,8 +80,8 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_split_write-1">
|
<record model="ir.rule" id="rg_split_write-1">
|
||||||
<field name="domain" eval="['OR',
|
<field name="domain" eval="['OR',
|
||||||
('line.cashbook.owner.id', '=', Eval('user', {}).get('id', -1)),
|
('line.cashbook.owner.id', '=', Eval('user_id', -1)),
|
||||||
('line.cashbook.reviewer.id', 'in', Eval('user', {}).get('groups', [])),
|
('line.cashbook.reviewer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_split_write"/>
|
<field name="rule_group" ref="rg_split_write"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -103,7 +103,7 @@ full copyright notices and license terms. -->
|
||||||
</record>
|
</record>
|
||||||
<record model="ir.rule" id="rg_split_read-1">
|
<record model="ir.rule" id="rg_split_read-1">
|
||||||
<field name="domain" eval="[
|
<field name="domain" eval="[
|
||||||
('line.cashbook.observer.id', 'in', Eval('user', {}).get('groups', [])),
|
('line.cashbook.observer.id', 'in', Eval('groups', [])),
|
||||||
]" pyson="1"/>
|
]" pyson="1"/>
|
||||||
<field name="rule_group" ref="rg_split_read"/>
|
<field name="rule_group" ref="rg_split_read"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -1,35 +1,4 @@
|
||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# -*- coding: utf-8 -*-
|
||||||
# this repository contains the full copyright notices and license terms.
|
# This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
import trytond.tests.test_tryton
|
# full copyright notices and license terms.
|
||||||
import unittest
|
|
||||||
|
|
||||||
from trytond.modules.cashbook.tests.test_type import TypeTestCase
|
|
||||||
from trytond.modules.cashbook.tests.test_book import BookTestCase
|
|
||||||
from trytond.modules.cashbook.tests.test_line import LineTestCase
|
|
||||||
from trytond.modules.cashbook.tests.test_splitline import SplitLineTestCase
|
|
||||||
from trytond.modules.cashbook.tests.test_config import ConfigTestCase
|
|
||||||
from trytond.modules.cashbook.tests.test_category import CategoryTestCase
|
|
||||||
from trytond.modules.cashbook.tests.test_reconciliation import ReconTestCase
|
|
||||||
|
|
||||||
__all__ = ['suite']
|
|
||||||
|
|
||||||
|
|
||||||
class CashbookTestCase(\
|
|
||||||
ReconTestCase,\
|
|
||||||
CategoryTestCase,\
|
|
||||||
ConfigTestCase,\
|
|
||||||
LineTestCase,
|
|
||||||
SplitLineTestCase,
|
|
||||||
BookTestCase,
|
|
||||||
TypeTestCase,
|
|
||||||
):
|
|
||||||
'Test cashbook module'
|
|
||||||
module = 'cashbook'
|
|
||||||
|
|
||||||
# end CashbookTestCase
|
|
||||||
|
|
||||||
def suite():
|
|
||||||
suite = trytond.tests.test_tryton.suite()
|
|
||||||
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(CashbookTestCase))
|
|
||||||
return suite
|
|
||||||
|
|
|
@ -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.tests.test_tryton import ModuleTestCase, with_transaction
|
from trytond.tests.test_tryton import with_transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
|
@ -11,10 +11,9 @@ from datetime import date
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
class BookTestCase(ModuleTestCase):
|
class BookTestCase(object):
|
||||||
'Test cashbook book module'
|
""" test cashbook
|
||||||
module = 'cashbook'
|
"""
|
||||||
|
|
||||||
def prep_sequence(self, name='Book Sequ'):
|
def prep_sequence(self, name='Book Sequ'):
|
||||||
""" create numbering-equence
|
""" create numbering-equence
|
||||||
"""
|
"""
|
||||||
|
@ -51,10 +50,148 @@ class BookTestCase(ModuleTestCase):
|
||||||
'number_sequ': self.prep_sequence().id,
|
'number_sequ': self.prep_sequence().id,
|
||||||
}])
|
}])
|
||||||
self.assertEqual(book.name, 'Book 1')
|
self.assertEqual(book.name, 'Book 1')
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1 | 0.00 usd | Open')
|
||||||
self.assertEqual(book.btype.rec_name, 'CAS - Cash')
|
self.assertEqual(book.btype.rec_name, 'CAS - Cash')
|
||||||
self.assertEqual(book.state, 'open')
|
self.assertEqual(book.state, 'open')
|
||||||
self.assertEqual(book.state_string, 'Open')
|
self.assertEqual(book.state_string, 'Open')
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_book_create_2nd_currency(self):
|
||||||
|
""" create cashbook, in 2nd currency, check balance-fields
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
company = self.prep_company()
|
||||||
|
|
||||||
|
# add EURO, set company-currency to EURO
|
||||||
|
(usd, euro) = self.prep_2nd_currency(company)
|
||||||
|
category = self.prep_category(cattype='in')
|
||||||
|
self.assertEqual(company.currency.rec_name, 'Euro')
|
||||||
|
party = self.prep_party()
|
||||||
|
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': usd.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 5),
|
||||||
|
'description': 'Amount in USD',
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'category': category.id,
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
with Transaction().set_context({
|
||||||
|
'date': date(2022, 5, 5)}):
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(book.currency.rec_name, 'usd')
|
||||||
|
self.assertEqual(book.currency.rate, Decimal('1.05'))
|
||||||
|
self.assertEqual(book.company_currency.rec_name, 'Euro')
|
||||||
|
self.assertEqual(book.company_currency.rate, Decimal('1.0'))
|
||||||
|
|
||||||
|
self.assertEqual(book.balance, Decimal('10.0'))
|
||||||
|
self.assertEqual(book.balance_ref, Decimal('9.52'))
|
||||||
|
|
||||||
|
self.assertEqual(len(book.lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].rec_name,
|
||||||
|
'05/05/2022|Rev|10.00 usd|Amount in USD [Cat1]')
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_book_create_2nd_currency_hierarchical(self):
|
||||||
|
""" create cashbook-hierarchy, in 2nd currency,
|
||||||
|
check balance-fields
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
company = self.prep_company()
|
||||||
|
|
||||||
|
# add EURO, set company-currency to EURO
|
||||||
|
(usd, euro) = self.prep_2nd_currency(company)
|
||||||
|
category = self.prep_category(cattype='in')
|
||||||
|
self.assertEqual(company.currency.rec_name, 'Euro')
|
||||||
|
party = self.prep_party()
|
||||||
|
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'company': company.id,
|
||||||
|
'currency': euro.id,
|
||||||
|
'childs': [('create', [{
|
||||||
|
'name': 'Book 2',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': usd.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 5),
|
||||||
|
'description': 'Amount in USD',
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'category': category.id,
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
with Transaction().set_context({
|
||||||
|
'date': date(2022, 5, 5)}):
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1')
|
||||||
|
self.assertEqual(book.currency.rec_name, 'Euro')
|
||||||
|
self.assertEqual(book.currency.rate, Decimal('1.0'))
|
||||||
|
self.assertEqual(book.company_currency, None)
|
||||||
|
self.assertEqual(book.balance, Decimal('9.52'))
|
||||||
|
self.assertEqual(book.balance_ref, Decimal('9.52'))
|
||||||
|
self.assertEqual(len(book.lines), 0)
|
||||||
|
self.assertEqual(len(book.childs), 1)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
book.childs[0].rec_name,
|
||||||
|
'Book 1/Book 2 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(book.childs[0].currency.rec_name, 'usd')
|
||||||
|
self.assertEqual(book.childs[0].currency.rate, Decimal('1.05'))
|
||||||
|
self.assertEqual(book.childs[0].company_currency.rec_name, 'Euro')
|
||||||
|
self.assertEqual(book.childs[0].balance, Decimal('10.0'))
|
||||||
|
self.assertEqual(book.childs[0].balance_ref, Decimal('9.52'))
|
||||||
|
self.assertEqual(len(book.childs[0].lines), 1)
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_book_create_hierarchy(self):
|
||||||
|
""" create cashbook, hierarchical
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
company = self.prep_company()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Level 1',
|
||||||
|
'btype': None,
|
||||||
|
'company': company.id,
|
||||||
|
'childs': [('create', [{
|
||||||
|
'name': 'Level 2',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
self.assertEqual(book.name, 'Level 1')
|
||||||
|
self.assertEqual(book.rec_name, 'Level 1')
|
||||||
|
self.assertEqual(len(book.childs), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
book.childs[0].rec_name,
|
||||||
|
'Level 1/Level 2 | 0.00 usd | Open')
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_book_deny_delete_open(self):
|
def test_book_deny_delete_open(self):
|
||||||
""" create cashbook, add lines, try to delete in state 'open'
|
""" create cashbook, add lines, try to delete in state 'open'
|
||||||
|
@ -85,11 +222,155 @@ class BookTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.name, 'Book 1')
|
self.assertEqual(book.name, 'Book 1')
|
||||||
self.assertEqual(book.state, 'open')
|
self.assertEqual(book.state, 'open')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The cashbook 'Book 1 | 1.00 usd | Open' cannot be deleted because it contains 1 lines and is not in the status 'Archive'.",
|
UserError,
|
||||||
|
"The cashbook 'Book 1 | 1.00 usd | Open' cannot be deleted" +
|
||||||
|
" because it contains 1 lines and is not in the status 'Archive'.",
|
||||||
Book.delete,
|
Book.delete,
|
||||||
[book])
|
[book])
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_book_check_search_and_sort(self):
|
||||||
|
""" create cashbook, check search on balance
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
category = self.prep_category(cattype='in')
|
||||||
|
company = self.prep_company()
|
||||||
|
party = self.prep_party()
|
||||||
|
books = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': 'test 1',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}, {
|
||||||
|
'name': 'Book 2',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': 'test 2',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('100.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
self.assertEqual(len(books), 2)
|
||||||
|
self.assertEqual(books[0].name, 'Book 1')
|
||||||
|
self.assertEqual(books[0].btype.rec_name, 'CAS - Cash')
|
||||||
|
self.assertEqual(books[1].name, 'Book 2')
|
||||||
|
self.assertEqual(books[1].btype.rec_name, 'CAS - Cash')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance', '=', Decimal('10.0'))]),
|
||||||
|
1)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance', '>', Decimal('5.0'))]),
|
||||||
|
2)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance', '<', Decimal('5.0'))]),
|
||||||
|
0)
|
||||||
|
|
||||||
|
books = Book.search([], order=[('balance', 'ASC')])
|
||||||
|
self.assertEqual(len(books), 2)
|
||||||
|
self.assertEqual(books[0].balance, Decimal('10.0'))
|
||||||
|
self.assertEqual(books[1].balance, Decimal('100.0'))
|
||||||
|
|
||||||
|
books = Book.search([], order=[('balance', 'DESC')])
|
||||||
|
self.assertEqual(len(books), 2)
|
||||||
|
self.assertEqual(books[0].balance, Decimal('100.0'))
|
||||||
|
self.assertEqual(books[1].balance, Decimal('10.0'))
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance_all', '=', Decimal('10.0'))]),
|
||||||
|
1)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance_all', '>', Decimal('5.0'))]),
|
||||||
|
2)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance_all', '<', Decimal('5.0'))]),
|
||||||
|
0)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance_ref', '<', Decimal('5.0'))]),
|
||||||
|
0)
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_book_deny_btype_set_none(self):
|
||||||
|
""" create cashbook, add lines,
|
||||||
|
try to set btype to None with lines
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
category = self.prep_category(cattype='in')
|
||||||
|
company = self.prep_company()
|
||||||
|
party = self.prep_party()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': 'test 1',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('1.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
self.assertEqual(book.name, 'Book 1')
|
||||||
|
self.assertEqual(book.btype.rec_name, 'CAS - Cash')
|
||||||
|
self.assertEqual(book.btype.feature, 'gen')
|
||||||
|
self.assertEqual(book.feature, 'gen')
|
||||||
|
|
||||||
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
|
"The type cannot be deleted on the cash book 'Book 1 | " +
|
||||||
|
"1.00 usd | Open' because it still contains 1 lines.",
|
||||||
|
Book.write,
|
||||||
|
*[
|
||||||
|
[book],
|
||||||
|
{
|
||||||
|
'btype': None,
|
||||||
|
},
|
||||||
|
])
|
||||||
|
|
||||||
|
Book.write(*[
|
||||||
|
[book],
|
||||||
|
{
|
||||||
|
'lines': [('delete', [book.lines[0].id])],
|
||||||
|
}])
|
||||||
|
self.assertEqual(len(book.lines), 0)
|
||||||
|
self.assertEqual(book.btype.rec_name, 'CAS - Cash')
|
||||||
|
|
||||||
|
Book.write(*[
|
||||||
|
[book],
|
||||||
|
{
|
||||||
|
'btype': None,
|
||||||
|
}])
|
||||||
|
self.assertEqual(book.btype, None)
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_book_deny_delete_closed(self):
|
def test_book_deny_delete_closed(self):
|
||||||
""" create cashbook, add lines, try to delete in state 'closed'
|
""" create cashbook, add lines, try to delete in state 'closed'
|
||||||
|
@ -122,8 +403,11 @@ class BookTestCase(ModuleTestCase):
|
||||||
Book.wfclosed([book])
|
Book.wfclosed([book])
|
||||||
self.assertEqual(book.state, 'closed')
|
self.assertEqual(book.state, 'closed')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The cashbook 'Book 1 | 1.00 usd | Closed' cannot be deleted because it contains 1 lines and is not in the status 'Archive'.",
|
UserError,
|
||||||
|
"The cashbook 'Book 1 | 1.00 usd | Closed' cannot be " +
|
||||||
|
"deleted because it contains 1 lines and is not in the " +
|
||||||
|
"status 'Archive'.",
|
||||||
Book.delete,
|
Book.delete,
|
||||||
[book])
|
[book])
|
||||||
|
|
||||||
|
@ -192,8 +476,10 @@ class BookTestCase(ModuleTestCase):
|
||||||
Book.wfclosed([book])
|
Book.wfclosed([book])
|
||||||
self.assertEqual(book.state, 'closed')
|
self.assertEqual(book.state, 'closed')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The cash book 'Book 1a | 1.00 usd | Closed' is 'Closed' and cannot be changed.",
|
UserError,
|
||||||
|
"The cash book 'Book 1a | 1.00 usd | Closed' is 'Closed' " +
|
||||||
|
"and cannot be changed.",
|
||||||
Book.write,
|
Book.write,
|
||||||
*[
|
*[
|
||||||
[book],
|
[book],
|
||||||
|
@ -215,8 +501,10 @@ class BookTestCase(ModuleTestCase):
|
||||||
Book.wfclosed([book])
|
Book.wfclosed([book])
|
||||||
Book.wfarchive([book])
|
Book.wfarchive([book])
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The cash book 'Book 1c | 0.00 usd | Archive' is 'Archive' and cannot be changed.",
|
UserError,
|
||||||
|
"The cash book 'Book 1c | 0.00 usd | Archive' is 'Archive'" +
|
||||||
|
" and cannot be changed.",
|
||||||
Book.write,
|
Book.write,
|
||||||
*[
|
*[
|
||||||
[book],
|
[book],
|
||||||
|
@ -225,62 +513,6 @@ class BookTestCase(ModuleTestCase):
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
@with_transaction()
|
|
||||||
def test_book_deny_update_start_amount(self):
|
|
||||||
""" create cashbook, add lines, update start-amount
|
|
||||||
"""
|
|
||||||
pool = Pool()
|
|
||||||
Book = pool.get('cashbook.book')
|
|
||||||
|
|
||||||
types = self.prep_type()
|
|
||||||
company = self.prep_company()
|
|
||||||
category = self.prep_category(cattype='in')
|
|
||||||
party = self.prep_party()
|
|
||||||
book, = Book.create([{
|
|
||||||
'name': 'Book 1',
|
|
||||||
'btype': types.id,
|
|
||||||
'company': company.id,
|
|
||||||
'currency': company.currency.id,
|
|
||||||
'number_sequ': self.prep_sequence().id,
|
|
||||||
}])
|
|
||||||
self.assertEqual(book.name, 'Book 1')
|
|
||||||
self.assertEqual(book.start_balance, Decimal('0.0'))
|
|
||||||
self.assertEqual(book.rec_name, 'Book 1 | 0.00 usd | Open')
|
|
||||||
|
|
||||||
Book.write(*[
|
|
||||||
[book],
|
|
||||||
{
|
|
||||||
'start_balance': Decimal('1.0'),
|
|
||||||
}])
|
|
||||||
self.assertEqual(book.start_balance, Decimal('1.0'))
|
|
||||||
self.assertEqual(book.balance, Decimal('1.0'))
|
|
||||||
|
|
||||||
Book.write(*[
|
|
||||||
[book],
|
|
||||||
{
|
|
||||||
'lines': [('create', [{
|
|
||||||
'amount': Decimal('2.0'),
|
|
||||||
'description': 'Test',
|
|
||||||
'category': category.id,
|
|
||||||
'bookingtype': 'in',
|
|
||||||
'party': party.id,
|
|
||||||
}])],
|
|
||||||
}])
|
|
||||||
self.assertEqual(book.start_balance, Decimal('1.0'))
|
|
||||||
self.assertEqual(book.balance, Decimal('3.0'))
|
|
||||||
self.assertEqual(len(book.lines), 1)
|
|
||||||
self.assertEqual(book.lines[0].balance, Decimal('3.0'))
|
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
|
||||||
"The initial amount of the cash book 'Fridas book | 3.00 usd | Open' cannot be changed because it already contains bookings.",
|
|
||||||
Book.write,
|
|
||||||
*[
|
|
||||||
[book],
|
|
||||||
{
|
|
||||||
'start_balance': Decimal('1.5'),
|
|
||||||
},
|
|
||||||
])
|
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_book_permission_owner(self):
|
def test_book_permission_owner(self):
|
||||||
""" create book + 2x users, add users to group, check access
|
""" create book + 2x users, add users to group, check access
|
||||||
|
@ -322,8 +554,7 @@ class BookTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.owner.rec_name, 'Frida'),
|
self.assertEqual(book.owner.rec_name, 'Frida'),
|
||||||
|
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'_check_access': True,
|
'_check_access': True}):
|
||||||
}):
|
|
||||||
# change to user 'diego' , try access
|
# change to user 'diego' , try access
|
||||||
with Transaction().set_user(usr_lst[1].id):
|
with Transaction().set_user(usr_lst[1].id):
|
||||||
books = Book.search([])
|
books = Book.search([])
|
||||||
|
@ -333,9 +564,12 @@ class BookTestCase(ModuleTestCase):
|
||||||
with Transaction().set_user(usr_lst[0].id):
|
with Transaction().set_user(usr_lst[0].id):
|
||||||
books = Book.search([])
|
books = Book.search([])
|
||||||
self.assertEqual(len(books), 1)
|
self.assertEqual(len(books), 1)
|
||||||
self.assertEqual(books[0].rec_name, 'Fridas book | 0.00 usd | Open')
|
self.assertEqual(
|
||||||
|
books[0].rec_name,
|
||||||
|
'Fridas book | 0.00 usd | Open')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
'You are not allowed to access "Cashbook.Name".',
|
'You are not allowed to access "Cashbook.Name".',
|
||||||
Book.write,
|
Book.write,
|
||||||
*[
|
*[
|
||||||
|
@ -347,7 +581,8 @@ class BookTestCase(ModuleTestCase):
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_book_permission_reviewer(self):
|
def test_book_permission_reviewer(self):
|
||||||
""" create book + 2x users + 1x reviewer-group, add users to group, check access
|
""" create book + 2x users + 1x reviewer-group,
|
||||||
|
add users to group, check access
|
||||||
"""
|
"""
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
ResUser = pool.get('res.user')
|
ResUser = pool.get('res.user')
|
||||||
|
@ -393,8 +628,7 @@ class BookTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.owner.rec_name, 'Frida'),
|
self.assertEqual(book.owner.rec_name, 'Frida'),
|
||||||
|
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'_check_access': True,
|
'_check_access': True}):
|
||||||
}):
|
|
||||||
# change to user 'diego' , try access
|
# change to user 'diego' , try access
|
||||||
with Transaction().set_user(usr_lst[1].id):
|
with Transaction().set_user(usr_lst[1].id):
|
||||||
books = Book.search([])
|
books = Book.search([])
|
||||||
|
@ -406,11 +640,14 @@ class BookTestCase(ModuleTestCase):
|
||||||
with Transaction().set_user(usr_lst[0].id):
|
with Transaction().set_user(usr_lst[0].id):
|
||||||
books = Book.search([])
|
books = Book.search([])
|
||||||
self.assertEqual(len(books), 1)
|
self.assertEqual(len(books), 1)
|
||||||
self.assertEqual(books[0].rec_name, 'Fridas book | 0.00 usd | Open')
|
self.assertEqual(
|
||||||
|
books[0].rec_name,
|
||||||
|
'Fridas book | 0.00 usd | Open')
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_book_permission_observer(self):
|
def test_book_permission_observer(self):
|
||||||
""" create book + 2x users + 1x observer-group, add users to group, check access
|
""" create book + 2x users + 1x observer-group,
|
||||||
|
add users to group, check access
|
||||||
"""
|
"""
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
ResUser = pool.get('res.user')
|
ResUser = pool.get('res.user')
|
||||||
|
@ -456,8 +693,7 @@ class BookTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.owner.rec_name, 'Frida'),
|
self.assertEqual(book.owner.rec_name, 'Frida'),
|
||||||
|
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'_check_access': True,
|
'_check_access': True}):
|
||||||
}):
|
|
||||||
# change to user 'diego' , try access
|
# change to user 'diego' , try access
|
||||||
with Transaction().set_user(usr_lst[1].id):
|
with Transaction().set_user(usr_lst[1].id):
|
||||||
books = Book.search([])
|
books = Book.search([])
|
||||||
|
@ -469,6 +705,8 @@ class BookTestCase(ModuleTestCase):
|
||||||
with Transaction().set_user(usr_lst[0].id):
|
with Transaction().set_user(usr_lst[0].id):
|
||||||
books = Book.search([])
|
books = Book.search([])
|
||||||
self.assertEqual(len(books), 1)
|
self.assertEqual(len(books), 1)
|
||||||
self.assertEqual(books[0].rec_name, 'Fridas book | 0.00 usd | Open')
|
self.assertEqual(
|
||||||
|
books[0].rec_name,
|
||||||
|
'Fridas book | 0.00 usd | Open')
|
||||||
|
|
||||||
# end BookTestCase
|
# end BookTestCase
|
183
tests/bookingwiz.py
Normal file
183
tests/bookingwiz.py
Normal file
|
@ -0,0 +1,183 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
from trytond.tests.test_tryton import with_transaction
|
||||||
|
from trytond.pool import Pool
|
||||||
|
from trytond.transaction import Transaction
|
||||||
|
from datetime import date
|
||||||
|
from decimal import Decimal
|
||||||
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
|
|
||||||
|
class BookingWizardTestCase(object):
|
||||||
|
""" test booking wizard
|
||||||
|
"""
|
||||||
|
@with_transaction()
|
||||||
|
def test_bookwiz_expense(self):
|
||||||
|
""" run booking-wizard to store expense
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
BookingWiz = pool.get('cashbook.enterbooking', type='wizard')
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
Category = pool.get('cashbook.category')
|
||||||
|
Party = pool.get('party.party')
|
||||||
|
IrDate = pool.get('ir.date')
|
||||||
|
Config = pool.get('cashbook.configuration')
|
||||||
|
|
||||||
|
company = self.prep_company()
|
||||||
|
with Transaction().set_context({
|
||||||
|
'company': company.id}):
|
||||||
|
types = self.prep_type()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Cash Book',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 1, 1),
|
||||||
|
}])
|
||||||
|
|
||||||
|
party, = Party.create([{
|
||||||
|
'name': 'Foodshop Zehlendorf',
|
||||||
|
'addresses': [('create', [{}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
categories = Category.create([{
|
||||||
|
'name': 'Income',
|
||||||
|
'cattype': 'in',
|
||||||
|
}, {
|
||||||
|
'name': 'Food',
|
||||||
|
'cattype': 'out',
|
||||||
|
}])
|
||||||
|
|
||||||
|
cfg1 = Config()
|
||||||
|
cfg1.fixate = True
|
||||||
|
cfg1.save()
|
||||||
|
|
||||||
|
(sess_id, start_state, end_state) = BookingWiz.create()
|
||||||
|
w_obj = BookingWiz(sess_id)
|
||||||
|
self.assertEqual(start_state, 'start')
|
||||||
|
self.assertEqual(end_state, 'end')
|
||||||
|
|
||||||
|
result = BookingWiz.execute(sess_id, {}, start_state)
|
||||||
|
self.assertEqual(list(result.keys()), ['view'])
|
||||||
|
self.assertEqual(result['view']['defaults']['bookingtype'], 'out')
|
||||||
|
self.assertEqual(result['view']['defaults']['cashbook'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['amount'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['party'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['booktransf'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['description'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['category'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['fixate'], True)
|
||||||
|
|
||||||
|
self.assertEqual(len(book.lines), 0)
|
||||||
|
|
||||||
|
r1 = {
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'cashbook': book.id,
|
||||||
|
'party': party.id,
|
||||||
|
'description': 'Test 1',
|
||||||
|
'category': categories[1].id,
|
||||||
|
'bookingtype': 'out',
|
||||||
|
'fixate': True}
|
||||||
|
for x in r1.keys():
|
||||||
|
setattr(w_obj.start, x, r1[x])
|
||||||
|
|
||||||
|
IrDate.today = MagicMock(return_value=date(2022, 5, 1))
|
||||||
|
result = BookingWiz.execute(sess_id, {'start': r1}, 'save_')
|
||||||
|
BookingWiz.delete(sess_id)
|
||||||
|
IrDate.today = MagicMock(return_value=date.today())
|
||||||
|
|
||||||
|
self.assertEqual(len(book.lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Exp|-10.00 usd|Test 1 [Food]')
|
||||||
|
self.assertEqual(book.lines[0].state, 'check')
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_bookwiz_transfer(self):
|
||||||
|
""" run booking-wizard to store expense
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
BookingWiz = pool.get('cashbook.enterbooking', type='wizard')
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
Category = pool.get('cashbook.category')
|
||||||
|
Party = pool.get('party.party')
|
||||||
|
IrDate = pool.get('ir.date')
|
||||||
|
|
||||||
|
company = self.prep_company()
|
||||||
|
with Transaction().set_context({
|
||||||
|
'company': company.id}):
|
||||||
|
types = self.prep_type()
|
||||||
|
books = Book.create([{
|
||||||
|
'name': 'Cash Book',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 1, 1),
|
||||||
|
}, {
|
||||||
|
'name': 'Bank',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 1, 1),
|
||||||
|
}])
|
||||||
|
|
||||||
|
party, = Party.create([{
|
||||||
|
'name': 'Foodshop Zehlendorf',
|
||||||
|
'addresses': [('create', [{}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
Category.create([{
|
||||||
|
'name': 'Income',
|
||||||
|
'cattype': 'in',
|
||||||
|
}, {
|
||||||
|
'name': 'Food',
|
||||||
|
'cattype': 'out',
|
||||||
|
}])
|
||||||
|
|
||||||
|
(sess_id, start_state, end_state) = BookingWiz.create()
|
||||||
|
w_obj = BookingWiz(sess_id)
|
||||||
|
self.assertEqual(start_state, 'start')
|
||||||
|
self.assertEqual(end_state, 'end')
|
||||||
|
|
||||||
|
result = BookingWiz.execute(sess_id, {}, start_state)
|
||||||
|
self.assertEqual(list(result.keys()), ['view'])
|
||||||
|
self.assertEqual(result['view']['defaults']['bookingtype'], 'out')
|
||||||
|
self.assertEqual(result['view']['defaults']['cashbook'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['amount'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['party'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['booktransf'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['description'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['category'], None)
|
||||||
|
self.assertEqual(result['view']['defaults']['fixate'], False)
|
||||||
|
|
||||||
|
self.assertEqual(len(books[0].lines), 0)
|
||||||
|
self.assertEqual(len(books[1].lines), 0)
|
||||||
|
|
||||||
|
r1 = {
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'cashbook': books[0].id,
|
||||||
|
'description': 'Test 1',
|
||||||
|
'booktransf': books[1].id,
|
||||||
|
'bookingtype': 'mvout',
|
||||||
|
'fixate': False}
|
||||||
|
for x in r1.keys():
|
||||||
|
setattr(w_obj.start, x, r1[x])
|
||||||
|
|
||||||
|
IrDate.today = MagicMock(return_value=date(2022, 5, 1))
|
||||||
|
result = BookingWiz.execute(sess_id, {'start': r1}, 'save_')
|
||||||
|
BookingWiz.delete(sess_id)
|
||||||
|
IrDate.today = MagicMock(return_value=date.today())
|
||||||
|
|
||||||
|
self.assertEqual(len(books[0].lines), 1)
|
||||||
|
self.assertEqual(len(books[1].lines), 0)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].rec_name,
|
||||||
|
'05/01/2022|to|-10.00 usd|Test 1 [Bank | 0.00 usd | Open]')
|
||||||
|
|
||||||
|
# end BookingWizardTestCase
|
|
@ -3,21 +3,19 @@
|
||||||
# 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.tests.test_tryton import ModuleTestCase, with_transaction
|
from trytond.tests.test_tryton import with_transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
class CategoryTestCase(ModuleTestCase):
|
class CategoryTestCase(object):
|
||||||
'Test cashbook categoy module'
|
""" test category
|
||||||
module = 'cashbook'
|
"""
|
||||||
|
|
||||||
def prep_category(self, name='Cat1', cattype='out'):
|
def prep_category(self, name='Cat1', cattype='out'):
|
||||||
""" create category
|
""" create category
|
||||||
"""
|
"""
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Company = pool.get('company.company')
|
|
||||||
Category = pool.get('cashbook.category')
|
Category = pool.get('cashbook.category')
|
||||||
|
|
||||||
company = self.prep_company()
|
company = self.prep_company()
|
||||||
|
@ -28,6 +26,72 @@ class CategoryTestCase(ModuleTestCase):
|
||||||
}])
|
}])
|
||||||
return category
|
return category
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_category_check_rec_name(self):
|
||||||
|
""" create category, test rec_name, search, order
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Category = pool.get('cashbook.category')
|
||||||
|
company = self.prep_company()
|
||||||
|
|
||||||
|
Category.create([{
|
||||||
|
'company': company.id,
|
||||||
|
'name': 'Level 1',
|
||||||
|
'cattype': 'in',
|
||||||
|
'childs': [('create', [{
|
||||||
|
'company': company.id,
|
||||||
|
'name': 'Level 2a',
|
||||||
|
'cattype': 'in',
|
||||||
|
}, {
|
||||||
|
'company': company.id,
|
||||||
|
'name': 'Level 2b',
|
||||||
|
'cattype': 'in',
|
||||||
|
}])],
|
||||||
|
}, {
|
||||||
|
'company': company.id,
|
||||||
|
'name': 'Level 1b',
|
||||||
|
'cattype': 'in',
|
||||||
|
'childs': [('create', [{
|
||||||
|
'company': company.id,
|
||||||
|
'name': 'Level 1b.2a',
|
||||||
|
'cattype': 'in',
|
||||||
|
}, {
|
||||||
|
'company': company.id,
|
||||||
|
'name': 'Level 1b.2b',
|
||||||
|
'cattype': 'in',
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
self.assertEqual(Category.search_count([
|
||||||
|
('rec_name', 'ilike', '%1b.2b%'),
|
||||||
|
]), 1)
|
||||||
|
self.assertEqual(Category.search_count([
|
||||||
|
('rec_name', 'ilike', '%1b.2%'),
|
||||||
|
]), 2)
|
||||||
|
self.assertEqual(Category.search_count([
|
||||||
|
('rec_name', '=', 'Level 1b/Level 1b.2b'),
|
||||||
|
]), 1)
|
||||||
|
|
||||||
|
# ordering #1
|
||||||
|
categories = Category.search([], order=[('rec_name', 'ASC')])
|
||||||
|
self.assertEqual(len(categories), 6)
|
||||||
|
self.assertEqual(categories[0].rec_name, 'Level 1')
|
||||||
|
self.assertEqual(categories[1].rec_name, 'Level 1b')
|
||||||
|
self.assertEqual(categories[2].rec_name, 'Level 1b/Level 1b.2a')
|
||||||
|
self.assertEqual(categories[3].rec_name, 'Level 1b/Level 1b.2b')
|
||||||
|
self.assertEqual(categories[4].rec_name, 'Level 1/Level 2a')
|
||||||
|
self.assertEqual(categories[5].rec_name, 'Level 1/Level 2b')
|
||||||
|
|
||||||
|
# ordering #2
|
||||||
|
categories = Category.search([], order=[('rec_name', 'DESC')])
|
||||||
|
self.assertEqual(len(categories), 6)
|
||||||
|
self.assertEqual(categories[0].rec_name, 'Level 1/Level 2b')
|
||||||
|
self.assertEqual(categories[1].rec_name, 'Level 1/Level 2a')
|
||||||
|
self.assertEqual(categories[2].rec_name, 'Level 1b/Level 1b.2b')
|
||||||
|
self.assertEqual(categories[3].rec_name, 'Level 1b/Level 1b.2a')
|
||||||
|
self.assertEqual(categories[4].rec_name, 'Level 1b')
|
||||||
|
self.assertEqual(categories[5].rec_name, 'Level 1')
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_category_create_check_category_type(self):
|
def test_category_create_check_category_type(self):
|
||||||
""" create category, update type of category
|
""" create category, update type of category
|
||||||
|
@ -53,8 +117,10 @@ class CategoryTestCase(ModuleTestCase):
|
||||||
self.assertEqual(category.childs[0].rec_name, 'Level 1/Level 2')
|
self.assertEqual(category.childs[0].rec_name, 'Level 1/Level 2')
|
||||||
self.assertEqual(category.childs[0].cattype, 'in')
|
self.assertEqual(category.childs[0].cattype, 'in')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
'The value for field "Type" in "Category" is not valid according to its domain.',
|
UserError,
|
||||||
|
'The value "out" for field "Type" in "Level 1/Level 2" of ' +
|
||||||
|
'"Category" is not valid according to its domain.',
|
||||||
Category.write,
|
Category.write,
|
||||||
*[
|
*[
|
||||||
[category.childs[0]],
|
[category.childs[0]],
|
||||||
|
@ -74,7 +140,6 @@ class CategoryTestCase(ModuleTestCase):
|
||||||
self.assertEqual(category.childs[0].rec_name, 'Level 1/Level 2')
|
self.assertEqual(category.childs[0].rec_name, 'Level 1/Level 2')
|
||||||
self.assertEqual(category.childs[0].cattype, 'out')
|
self.assertEqual(category.childs[0].cattype, 'out')
|
||||||
|
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_category_create_nodupl_at_root(self):
|
def test_category_create_nodupl_at_root(self):
|
||||||
""" create category, duplicates are allowed at root-level
|
""" create category, duplicates are allowed at root-level
|
||||||
|
@ -85,11 +150,11 @@ class CategoryTestCase(ModuleTestCase):
|
||||||
company = self.prep_company()
|
company = self.prep_company()
|
||||||
|
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'company': company.id,
|
'company': company.id}):
|
||||||
}):
|
|
||||||
cat1, = Category.create([{
|
cat1, = Category.create([{
|
||||||
'name': 'Test 1',
|
'name': 'Test 1',
|
||||||
'description': 'Info',
|
'description': 'Info',
|
||||||
|
'cattype': 'in',
|
||||||
}])
|
}])
|
||||||
self.assertEqual(cat1.name, 'Test 1')
|
self.assertEqual(cat1.name, 'Test 1')
|
||||||
self.assertEqual(cat1.rec_name, 'Test 1')
|
self.assertEqual(cat1.rec_name, 'Test 1')
|
||||||
|
@ -97,10 +162,11 @@ class CategoryTestCase(ModuleTestCase):
|
||||||
self.assertEqual(cat1.company.rec_name, 'm-ds')
|
self.assertEqual(cat1.company.rec_name, 'm-ds')
|
||||||
self.assertEqual(cat1.parent, None)
|
self.assertEqual(cat1.parent, None)
|
||||||
|
|
||||||
# duplicate, allowed
|
# duplicate of different type, allowed
|
||||||
cat2, = Category.create([{
|
cat2, = Category.create([{
|
||||||
'name': 'Test 1',
|
'name': 'Test 1',
|
||||||
'description': 'Info',
|
'description': 'Info',
|
||||||
|
'cattype': 'out',
|
||||||
}])
|
}])
|
||||||
self.assertEqual(cat2.name, 'Test 1')
|
self.assertEqual(cat2.name, 'Test 1')
|
||||||
self.assertEqual(cat2.rec_name, 'Test 1')
|
self.assertEqual(cat2.rec_name, 'Test 1')
|
||||||
|
@ -108,6 +174,17 @@ class CategoryTestCase(ModuleTestCase):
|
||||||
self.assertEqual(cat2.company.rec_name, 'm-ds')
|
self.assertEqual(cat2.company.rec_name, 'm-ds')
|
||||||
self.assertEqual(cat2.parent, None)
|
self.assertEqual(cat2.parent, None)
|
||||||
|
|
||||||
|
# deny duplicate of same type
|
||||||
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
|
'The category name already exists at this level.',
|
||||||
|
Category.create,
|
||||||
|
[{
|
||||||
|
'name': 'Test 1',
|
||||||
|
'description': 'Info',
|
||||||
|
'cattype': 'in',
|
||||||
|
}])
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_category_create_nodupl_diff_level(self):
|
def test_category_create_nodupl_diff_level(self):
|
||||||
""" create category
|
""" create category
|
||||||
|
@ -118,8 +195,7 @@ class CategoryTestCase(ModuleTestCase):
|
||||||
company = self.prep_company()
|
company = self.prep_company()
|
||||||
|
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'company': company.id,
|
'company': company.id}):
|
||||||
}):
|
|
||||||
cat1, = Category.create([{
|
cat1, = Category.create([{
|
||||||
'name': 'Test 1',
|
'name': 'Test 1',
|
||||||
'description': 'Info',
|
'description': 'Info',
|
||||||
|
@ -145,9 +221,9 @@ class CategoryTestCase(ModuleTestCase):
|
||||||
company = self.prep_company()
|
company = self.prep_company()
|
||||||
|
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'company': company.id,
|
'company': company.id}):
|
||||||
}):
|
self.assertRaisesRegex(
|
||||||
self.assertRaisesRegex(UserError,
|
UserError,
|
||||||
'The category name already exists at this level.',
|
'The category name already exists at this level.',
|
||||||
Category.create,
|
Category.create,
|
||||||
[{
|
[{
|
|
@ -3,19 +3,17 @@
|
||||||
# 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.tests.test_tryton import ModuleTestCase, with_transaction
|
from trytond.tests.test_tryton import with_transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.exceptions import UserError
|
|
||||||
from trytond.modules.company.tests import create_company
|
from trytond.modules.company.tests import create_company
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
class ConfigTestCase(ModuleTestCase):
|
class ConfigTestCase(object):
|
||||||
'Test config type module'
|
""" test config
|
||||||
module = 'cashbook'
|
"""
|
||||||
|
|
||||||
def prep_company(self):
|
def prep_company(self):
|
||||||
""" get/create company
|
""" get/create company
|
||||||
"""
|
"""
|
||||||
|
@ -42,6 +40,7 @@ class ConfigTestCase(ModuleTestCase):
|
||||||
self.assertEqual(cfg2.checked, True)
|
self.assertEqual(cfg2.checked, True)
|
||||||
self.assertEqual(cfg2.done, False)
|
self.assertEqual(cfg2.done, False)
|
||||||
self.assertEqual(cfg2.catnamelong, True)
|
self.assertEqual(cfg2.catnamelong, True)
|
||||||
|
self.assertEqual(cfg2.defbook, None)
|
||||||
return cfg2
|
return cfg2
|
||||||
|
|
||||||
def prep_party(self, name='Party'):
|
def prep_party(self, name='Party'):
|
||||||
|
@ -97,6 +96,13 @@ class ConfigTestCase(ModuleTestCase):
|
||||||
'rate': Decimal('1.05'),
|
'rate': Decimal('1.05'),
|
||||||
}])
|
}])
|
||||||
|
|
||||||
|
# delete unwanted rates
|
||||||
|
usd_1 = CurrencyRate.search([
|
||||||
|
('currency.id', '=', usd.id),
|
||||||
|
('date', '!=', date(2022, 5, 2)),
|
||||||
|
])
|
||||||
|
CurrencyRate.delete(usd_1)
|
||||||
|
|
||||||
return (usd, euro)
|
return (usd, euro)
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
|
@ -105,6 +111,37 @@ class ConfigTestCase(ModuleTestCase):
|
||||||
"""
|
"""
|
||||||
self.prep_config()
|
self.prep_config()
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_config_defbook(self):
|
||||||
|
""" create config, add default-cashbook
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Configuration = pool.get('cashbook.configuration')
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
|
||||||
|
self.prep_config()
|
||||||
|
types = self.prep_type()
|
||||||
|
company = self.prep_company()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
}])
|
||||||
|
self.assertEqual(book.name, 'Book 1')
|
||||||
|
|
||||||
|
cfg1 = Configuration.get_singleton()
|
||||||
|
|
||||||
|
Configuration.write(*[
|
||||||
|
[cfg1],
|
||||||
|
{
|
||||||
|
'defbook': book.id,
|
||||||
|
}])
|
||||||
|
|
||||||
|
cfg2 = Configuration.get_singleton()
|
||||||
|
self.assertEqual(cfg2.defbook.rec_name, 'Book 1 | 0.00 usd | Open')
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_config_create_multi_user(self):
|
def test_config_create_multi_user(self):
|
||||||
""" create config, multi-user
|
""" create config, multi-user
|
||||||
|
@ -130,8 +167,7 @@ class ConfigTestCase(ModuleTestCase):
|
||||||
self.assertEqual(usr_lst[1].name, 'Diego')
|
self.assertEqual(usr_lst[1].name, 'Diego')
|
||||||
|
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'_check_access': True,
|
'_check_access': True}):
|
||||||
}):
|
|
||||||
# change to user 'frida'
|
# change to user 'frida'
|
||||||
with Transaction().set_user(usr_lst[0].id):
|
with Transaction().set_user(usr_lst[0].id):
|
||||||
cfg1 = Configuration()
|
cfg1 = Configuration()
|
||||||
|
@ -142,10 +178,12 @@ class ConfigTestCase(ModuleTestCase):
|
||||||
self.assertEqual(cfg2.date_to, None)
|
self.assertEqual(cfg2.date_to, None)
|
||||||
self.assertEqual(cfg2.checked, True)
|
self.assertEqual(cfg2.checked, True)
|
||||||
self.assertEqual(cfg2.done, False)
|
self.assertEqual(cfg2.done, False)
|
||||||
|
self.assertEqual(cfg2.fixate, False)
|
||||||
|
|
||||||
cfg2.date_from = date(2022, 4, 1)
|
cfg2.date_from = date(2022, 4, 1)
|
||||||
cfg2.date_to = date(2022, 5, 30)
|
cfg2.date_to = date(2022, 5, 30)
|
||||||
cfg2.checked = False
|
cfg2.checked = False
|
||||||
|
cfg2.fixate = True
|
||||||
cfg2.save()
|
cfg2.save()
|
||||||
|
|
||||||
# change to user 'diego'
|
# change to user 'diego'
|
||||||
|
@ -158,6 +196,7 @@ class ConfigTestCase(ModuleTestCase):
|
||||||
self.assertEqual(cfg2.date_to, None)
|
self.assertEqual(cfg2.date_to, None)
|
||||||
self.assertEqual(cfg2.checked, True)
|
self.assertEqual(cfg2.checked, True)
|
||||||
self.assertEqual(cfg2.done, False)
|
self.assertEqual(cfg2.done, False)
|
||||||
|
self.assertEqual(cfg2.fixate, False)
|
||||||
|
|
||||||
cfg2.date_from = date(2022, 4, 15)
|
cfg2.date_from = date(2022, 4, 15)
|
||||||
cfg2.date_to = date(2022, 5, 15)
|
cfg2.date_to = date(2022, 5, 15)
|
||||||
|
@ -173,5 +212,6 @@ class ConfigTestCase(ModuleTestCase):
|
||||||
self.assertEqual(cfg2.date_to, date(2022, 5, 30))
|
self.assertEqual(cfg2.date_to, date(2022, 5, 30))
|
||||||
self.assertEqual(cfg2.checked, False)
|
self.assertEqual(cfg2.checked, False)
|
||||||
self.assertEqual(cfg2.done, False)
|
self.assertEqual(cfg2.done, False)
|
||||||
|
self.assertEqual(cfg2.fixate, True)
|
||||||
|
|
||||||
# end ConfigTestCase
|
# end ConfigTestCase
|
File diff suppressed because it is too large
Load diff
|
@ -3,18 +3,16 @@
|
||||||
# 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.tests.test_tryton import ModuleTestCase, with_transaction
|
from trytond.tests.test_tryton import with_transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.transaction import Transaction
|
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
from datetime import date
|
from datetime import date
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
class ReconTestCase(ModuleTestCase):
|
class ReconTestCase(object):
|
||||||
'Test cashbook reconciliation module'
|
""" test reconciliation
|
||||||
module = 'cashbook'
|
"""
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_recon_check_overlap_start(self):
|
def test_recon_check_overlap_start(self):
|
||||||
""" create, check deny of overlap date - date_from
|
""" create, check deny of overlap date - date_from
|
||||||
|
@ -24,7 +22,7 @@ class ReconTestCase(ModuleTestCase):
|
||||||
Reconciliation = pool.get('cashbook.recon')
|
Reconciliation = pool.get('cashbook.recon')
|
||||||
|
|
||||||
types = self.prep_type()
|
types = self.prep_type()
|
||||||
category = self.prep_category(cattype='in')
|
self.prep_category(cattype='in')
|
||||||
company = self.prep_company()
|
company = self.prep_company()
|
||||||
book, = Book.create([{
|
book, = Book.create([{
|
||||||
'name': 'Book 1',
|
'name': 'Book 1',
|
||||||
|
@ -41,22 +39,25 @@ class ReconTestCase(ModuleTestCase):
|
||||||
}])
|
}])
|
||||||
|
|
||||||
Book.write(*[
|
Book.write(*[
|
||||||
[book],
|
[book], {'reconciliations': [('create', [{
|
||||||
{
|
|
||||||
'reconciliations': [('create', [{
|
|
||||||
'date': date(2022, 6, 1),
|
'date': date(2022, 6, 1),
|
||||||
'date_from': date(2022, 6, 1),
|
'date_from': date(2022, 6, 1),
|
||||||
'date_to': date(2022, 6, 30),
|
'date_to': date(2022, 6, 30),
|
||||||
}])],
|
}])],
|
||||||
}])
|
}])
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
self.assertEqual(book.reconciliations[1].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.reconciliations[1].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
'The date range overlaps with another reconciliation.',
|
'The date range overlaps with another reconciliation.',
|
||||||
Reconciliation.write,
|
Reconciliation.write,
|
||||||
*[
|
*[
|
||||||
[book.reconciliations[1]],
|
[book.reconciliations[0]],
|
||||||
{
|
{
|
||||||
'date_from': date(2022, 4, 15),
|
'date_from': date(2022, 4, 15),
|
||||||
'date_to': date(2022, 5, 2),
|
'date_to': date(2022, 5, 2),
|
||||||
|
@ -72,7 +73,7 @@ class ReconTestCase(ModuleTestCase):
|
||||||
Reconciliation = pool.get('cashbook.recon')
|
Reconciliation = pool.get('cashbook.recon')
|
||||||
|
|
||||||
types = self.prep_type()
|
types = self.prep_type()
|
||||||
category = self.prep_category(cattype='in')
|
self.prep_category(cattype='in')
|
||||||
company = self.prep_company()
|
company = self.prep_company()
|
||||||
book, = Book.create([{
|
book, = Book.create([{
|
||||||
'name': 'Book 1',
|
'name': 'Book 1',
|
||||||
|
@ -89,22 +90,25 @@ class ReconTestCase(ModuleTestCase):
|
||||||
}])
|
}])
|
||||||
|
|
||||||
Book.write(*[
|
Book.write(*[
|
||||||
[book],
|
[book], {'reconciliations': [('create', [{
|
||||||
{
|
|
||||||
'reconciliations': [('create', [{
|
|
||||||
'date': date(2022, 6, 1),
|
'date': date(2022, 6, 1),
|
||||||
'date_from': date(2022, 6, 1),
|
'date_from': date(2022, 6, 1),
|
||||||
'date_to': date(2022, 6, 30),
|
'date_to': date(2022, 6, 30),
|
||||||
}])],
|
}])],
|
||||||
}])
|
}])
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
self.assertEqual(book.reconciliations[1].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.reconciliations[1].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
'The date range overlaps with another reconciliation.',
|
'The date range overlaps with another reconciliation.',
|
||||||
Reconciliation.write,
|
Reconciliation.write,
|
||||||
*[
|
*[
|
||||||
[book.reconciliations[1]],
|
[book.reconciliations[0]],
|
||||||
{
|
{
|
||||||
'date_from': date(2022, 5, 30),
|
'date_from': date(2022, 5, 30),
|
||||||
},
|
},
|
||||||
|
@ -119,7 +123,7 @@ class ReconTestCase(ModuleTestCase):
|
||||||
Reconciliation = pool.get('cashbook.recon')
|
Reconciliation = pool.get('cashbook.recon')
|
||||||
|
|
||||||
types = self.prep_type()
|
types = self.prep_type()
|
||||||
category = self.prep_category(cattype='in')
|
self.prep_category(cattype='in')
|
||||||
company = self.prep_company()
|
company = self.prep_company()
|
||||||
book, = Book.create([{
|
book, = Book.create([{
|
||||||
'name': 'Book 1',
|
'name': 'Book 1',
|
||||||
|
@ -136,22 +140,25 @@ class ReconTestCase(ModuleTestCase):
|
||||||
}])
|
}])
|
||||||
|
|
||||||
Book.write(*[
|
Book.write(*[
|
||||||
[book],
|
[book], {'reconciliations': [('create', [{
|
||||||
{
|
|
||||||
'reconciliations': [('create', [{
|
|
||||||
'date': date(2022, 6, 1),
|
'date': date(2022, 6, 1),
|
||||||
'date_from': date(2022, 6, 1),
|
'date_from': date(2022, 6, 1),
|
||||||
'date_to': date(2022, 6, 30),
|
'date_to': date(2022, 6, 30),
|
||||||
}])],
|
}])],
|
||||||
}])
|
}])
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
self.assertEqual(book.reconciliations[1].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.reconciliations[1].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
'The date range overlaps with another reconciliation.',
|
'The date range overlaps with another reconciliation.',
|
||||||
Reconciliation.write,
|
Reconciliation.write,
|
||||||
*[
|
*[
|
||||||
[book.reconciliations[1]],
|
[book.reconciliations[0]],
|
||||||
{
|
{
|
||||||
'date_from': date(2022, 5, 5),
|
'date_from': date(2022, 5, 5),
|
||||||
'date_to': date(2022, 5, 15),
|
'date_to': date(2022, 5, 15),
|
||||||
|
@ -167,7 +174,7 @@ class ReconTestCase(ModuleTestCase):
|
||||||
Reconciliation = pool.get('cashbook.recon')
|
Reconciliation = pool.get('cashbook.recon')
|
||||||
|
|
||||||
types = self.prep_type()
|
types = self.prep_type()
|
||||||
category = self.prep_category(cattype='in')
|
self.prep_category(cattype='in')
|
||||||
company = self.prep_company()
|
company = self.prep_company()
|
||||||
book, = Book.create([{
|
book, = Book.create([{
|
||||||
'name': 'Book 1',
|
'name': 'Book 1',
|
||||||
|
@ -184,18 +191,21 @@ class ReconTestCase(ModuleTestCase):
|
||||||
}])
|
}])
|
||||||
|
|
||||||
Book.write(*[
|
Book.write(*[
|
||||||
[book],
|
[book], {'reconciliations': [('create', [{
|
||||||
{
|
|
||||||
'reconciliations': [('create', [{
|
|
||||||
'date': date(2022, 6, 1),
|
'date': date(2022, 6, 1),
|
||||||
'date_from': date(2022, 6, 1),
|
'date_from': date(2022, 6, 1),
|
||||||
'date_to': date(2022, 6, 30),
|
'date_to': date(2022, 6, 30),
|
||||||
}])],
|
}])],
|
||||||
}])
|
}])
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
self.assertEqual(book.reconciliations[1].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.reconciliations[1].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
'The date range overlaps with another reconciliation.',
|
'The date range overlaps with another reconciliation.',
|
||||||
Reconciliation.write,
|
Reconciliation.write,
|
||||||
*[
|
*[
|
||||||
|
@ -221,7 +231,6 @@ class ReconTestCase(ModuleTestCase):
|
||||||
'btype': types.id,
|
'btype': types.id,
|
||||||
'company': company.id,
|
'company': company.id,
|
||||||
'currency': company.currency.id,
|
'currency': company.currency.id,
|
||||||
'start_balance': Decimal('12.50'),
|
|
||||||
'start_date': date(2022, 5, 1),
|
'start_date': date(2022, 5, 1),
|
||||||
'number_sequ': self.prep_sequence().id,
|
'number_sequ': self.prep_sequence().id,
|
||||||
'reconciliations': [('create', [{
|
'reconciliations': [('create', [{
|
||||||
|
@ -231,10 +240,15 @@ class ReconTestCase(ModuleTestCase):
|
||||||
}])],
|
}])],
|
||||||
}])
|
}])
|
||||||
self.assertEqual(book.name, 'Book 1')
|
self.assertEqual(book.name, 'Book 1')
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
self.assertEqual(book.reconciliations[0].feature, 'gen')
|
||||||
|
|
||||||
Reconciliation.wfcheck(list(book.reconciliations))
|
Reconciliation.wfcheck(list(book.reconciliations))
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 12.50 usd - 12.50 usd [0]')
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_recon_set_start_amount_by_predecessor(self):
|
def test_recon_set_start_amount_by_predecessor(self):
|
||||||
|
@ -254,7 +268,6 @@ class ReconTestCase(ModuleTestCase):
|
||||||
'btype': types.id,
|
'btype': types.id,
|
||||||
'company': company.id,
|
'company': company.id,
|
||||||
'currency': company.currency.id,
|
'currency': company.currency.id,
|
||||||
'start_balance': Decimal('12.50'),
|
|
||||||
'start_date': date(2022, 5, 1),
|
'start_date': date(2022, 5, 1),
|
||||||
'number_sequ': self.prep_sequence().id,
|
'number_sequ': self.prep_sequence().id,
|
||||||
'reconciliations': [('create', [{
|
'reconciliations': [('create', [{
|
||||||
|
@ -280,14 +293,18 @@ class ReconTestCase(ModuleTestCase):
|
||||||
}])
|
}])
|
||||||
self.assertEqual(book.name, 'Book 1')
|
self.assertEqual(book.name, 'Book 1')
|
||||||
self.assertEqual(len(book.reconciliations), 1)
|
self.assertEqual(len(book.reconciliations), 1)
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
self.assertEqual(len(book.reconciliations[0].lines), 0)
|
self.assertEqual(len(book.reconciliations[0].lines), 0)
|
||||||
|
|
||||||
Lines.wfcheck(list(book.lines))
|
Lines.wfcheck(list(book.lines))
|
||||||
Reconciliation.wfcheck(list(book.reconciliations))
|
Reconciliation.wfcheck(list(book.reconciliations))
|
||||||
|
|
||||||
self.assertEqual(book.reconciliations[0].state, 'check')
|
self.assertEqual(book.reconciliations[0].state, 'check')
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 12.50 usd - 24.50 usd [2]')
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 12.00 usd [2]')
|
||||||
Reconciliation.wfdone(list(book.reconciliations))
|
Reconciliation.wfdone(list(book.reconciliations))
|
||||||
self.assertEqual(book.reconciliations[0].state, 'done')
|
self.assertEqual(book.reconciliations[0].state, 'done')
|
||||||
|
|
||||||
|
@ -296,9 +313,13 @@ class ReconTestCase(ModuleTestCase):
|
||||||
'date_from': date(2022, 5, 31),
|
'date_from': date(2022, 5, 31),
|
||||||
'date_to': date(2022, 6, 30),
|
'date_to': date(2022, 6, 30),
|
||||||
}])
|
}])
|
||||||
self.assertEqual(recons[0].rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
|
recons[0].rec_name,
|
||||||
|
'05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
Reconciliation.wfcheck(recons)
|
Reconciliation.wfcheck(recons)
|
||||||
self.assertEqual(recons[0].rec_name, '05/31/2022 - 06/30/2022 | 24.50 usd - 24.50 usd [0]')
|
self.assertEqual(
|
||||||
|
recons[0].rec_name,
|
||||||
|
'05/31/2022 - 06/30/2022 | 12.00 usd - 12.00 usd [0]')
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_recon_predecessor_done(self):
|
def test_recon_predecessor_done(self):
|
||||||
|
@ -326,7 +347,9 @@ class ReconTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.name, 'Book 1')
|
self.assertEqual(book.name, 'Book 1')
|
||||||
self.assertEqual(book.state, 'open')
|
self.assertEqual(book.state, 'open')
|
||||||
Reconciliation.wfcheck(list(book.reconciliations))
|
Reconciliation.wfcheck(list(book.reconciliations))
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
self.assertEqual(book.reconciliations[0].state, 'check')
|
self.assertEqual(book.reconciliations[0].state, 'check')
|
||||||
|
|
||||||
recons = Reconciliation.create([{
|
recons = Reconciliation.create([{
|
||||||
|
@ -334,14 +357,20 @@ class ReconTestCase(ModuleTestCase):
|
||||||
'date_from': date(2022, 5, 31),
|
'date_from': date(2022, 5, 31),
|
||||||
'date_to': date(2022, 6, 30),
|
'date_to': date(2022, 6, 30),
|
||||||
}])
|
}])
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The predecessor '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]' must be in the 'Done' state before you can check the current reconciliation '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]'.",
|
UserError,
|
||||||
|
"The predecessor " +
|
||||||
|
"'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]' " +
|
||||||
|
"must be in the 'Done' state before you can check the " +
|
||||||
|
"current reconciliation " +
|
||||||
|
"'05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]'.",
|
||||||
Reconciliation.wfcheck,
|
Reconciliation.wfcheck,
|
||||||
recons)
|
recons)
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_recon_autoset_date_to(self):
|
def test_recon_autoset_date_to(self):
|
||||||
""" create reconciliation, check: set date_to to last date of checked-line
|
""" create reconciliation, check:
|
||||||
|
set date_to to last date of checked-line
|
||||||
"""
|
"""
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Book = pool.get('cashbook.book')
|
Book = pool.get('cashbook.book')
|
||||||
|
@ -384,10 +413,14 @@ class ReconTestCase(ModuleTestCase):
|
||||||
'date_to': date(2022, 5, 31),
|
'date_to': date(2022, 5, 31),
|
||||||
}])
|
}])
|
||||||
# dates are updates by .create()
|
# dates are updates by .create()
|
||||||
self.assertEqual(recon.rec_name, '05/01/2022 - 05/18/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
|
recon.rec_name,
|
||||||
|
'05/01/2022 - 05/18/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
|
||||||
Reconciliation.wfcheck([recon])
|
Reconciliation.wfcheck([recon])
|
||||||
self.assertEqual(recon.rec_name, '05/01/2022 - 05/18/2022 | 0.00 usd - 15.00 usd [2]')
|
self.assertEqual(
|
||||||
|
recon.rec_name,
|
||||||
|
'05/01/2022 - 05/18/2022 | 0.00 usd - 15.00 usd [2]')
|
||||||
|
|
||||||
@with_transaction()
|
@with_transaction()
|
||||||
def test_recon_autoset_date_from(self):
|
def test_recon_autoset_date_from(self):
|
||||||
|
@ -418,7 +451,8 @@ class ReconTestCase(ModuleTestCase):
|
||||||
Reconciliation.wfdone([book.reconciliations[0]])
|
Reconciliation.wfdone([book.reconciliations[0]])
|
||||||
|
|
||||||
# date_from is corrected by .create() to start_date of book
|
# date_from is corrected by .create() to start_date of book
|
||||||
self.assertEqual(book.reconciliations[0].rec_name,
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].rec_name,
|
||||||
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
|
||||||
r2, = Reconciliation.create([{
|
r2, = Reconciliation.create([{
|
||||||
|
@ -426,7 +460,9 @@ class ReconTestCase(ModuleTestCase):
|
||||||
'date_from': date(2022, 6, 10),
|
'date_from': date(2022, 6, 10),
|
||||||
'date_to': date(2022, 6, 30),
|
'date_to': date(2022, 6, 30),
|
||||||
}])
|
}])
|
||||||
self.assertEqual(r2.rec_name, '05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
|
r2.rec_name,
|
||||||
|
'05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
|
||||||
# update 'date_from' to wrong value
|
# update 'date_from' to wrong value
|
||||||
Reconciliation.write(*[
|
Reconciliation.write(*[
|
||||||
|
@ -434,10 +470,15 @@ class ReconTestCase(ModuleTestCase):
|
||||||
{
|
{
|
||||||
'date_from': date(2022, 6, 1),
|
'date_from': date(2022, 6, 1),
|
||||||
}])
|
}])
|
||||||
self.assertEqual(r2.rec_name, '06/01/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
|
r2.rec_name,
|
||||||
|
'06/01/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The start date '06/01/2022' of the current reconciliation '06/01/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]' must correspond to the end date '05/31/2022' of the predecessor.",
|
UserError,
|
||||||
|
"The start date '06/01/2022' of the current reconciliation" +
|
||||||
|
" '06/01/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]' " +
|
||||||
|
"must correspond to the end date '05/31/2022' of the predecessor.",
|
||||||
Reconciliation.wfcheck,
|
Reconciliation.wfcheck,
|
||||||
[r2])
|
[r2])
|
||||||
|
|
||||||
|
@ -485,14 +526,23 @@ class ReconTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.name, 'Book 1')
|
self.assertEqual(book.name, 'Book 1')
|
||||||
self.assertEqual(book.state, 'open')
|
self.assertEqual(book.state, 'open')
|
||||||
self.assertEqual(len(book.lines), 2)
|
self.assertEqual(len(book.lines), 2)
|
||||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
self.assertEqual(
|
||||||
self.assertEqual(book.lines[1].rec_name, '05/05/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[1].rec_name,
|
||||||
|
'05/05/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
||||||
self.assertEqual(len(book.reconciliations), 1)
|
self.assertEqual(len(book.reconciliations), 1)
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
self.assertEqual(len(book.reconciliations[0].lines), 0)
|
self.assertEqual(len(book.reconciliations[0].lines), 0)
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"For reconciliation, the line '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]' must be in the status 'Check' or 'Done'.",
|
UserError,
|
||||||
|
"For reconciliation, the line " +
|
||||||
|
"'05/01/2022|Rev|1.00 usd|Text 1 [Cat1]' must be in the " +
|
||||||
|
"status 'Check' or 'Done'.",
|
||||||
Lines.write,
|
Lines.write,
|
||||||
*[
|
*[
|
||||||
[book.lines[0]],
|
[book.lines[0]],
|
||||||
|
@ -509,8 +559,11 @@ class ReconTestCase(ModuleTestCase):
|
||||||
}])
|
}])
|
||||||
self.assertEqual(len(book.reconciliations[0].lines), 2)
|
self.assertEqual(len(book.reconciliations[0].lines), 2)
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The status cannot be changed to 'Edit' as long as the line '05/01/2022|1.00 usd|Text 1 [Cat1]' is associated with a reconciliation.",
|
UserError,
|
||||||
|
"The status cannot be changed to 'Edit' as long as the line " +
|
||||||
|
"'05/01/2022|1.00 usd|Text 1 [Cat1]' is associated " +
|
||||||
|
"with a reconciliation.",
|
||||||
Lines.wfedit,
|
Lines.wfedit,
|
||||||
[book.lines[0]])
|
[book.lines[0]])
|
||||||
|
|
||||||
|
@ -534,18 +587,28 @@ class ReconTestCase(ModuleTestCase):
|
||||||
Reconciliation.wfcheck(list(book.reconciliations))
|
Reconciliation.wfcheck(list(book.reconciliations))
|
||||||
self.assertEqual(book.reconciliations[0].state, 'check')
|
self.assertEqual(book.reconciliations[0].state, 'check')
|
||||||
self.assertEqual(len(book.reconciliations[0].lines), 1)
|
self.assertEqual(len(book.reconciliations[0].lines), 1)
|
||||||
self.assertEqual(book.reconciliations[0].lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
self.assertEqual(
|
||||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
book.reconciliations[0].lines[0].rec_name,
|
||||||
self.assertEqual(book.lines[1].rec_name, '06/01/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
'05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||||
|
self.assertEqual(book.lines[0].state, 'check')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[1].rec_name,
|
||||||
|
'06/01/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
||||||
|
self.assertEqual(book.lines[1].state, 'edit')
|
||||||
|
|
||||||
# move 2nd line into date-range of checked-reconciliation, wf-check
|
# move 1st line into date-range of checked-reconciliation, wf-check
|
||||||
Lines.write(*[
|
Lines.write(*[
|
||||||
[book.lines[1]],
|
[book.lines[1]],
|
||||||
{
|
{
|
||||||
'date': date(2022, 5, 20),
|
'date': date(2022, 5, 20),
|
||||||
}])
|
}])
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"For the date '05/20/2022' there is already a completed reconciliation. Use a different date.",
|
UserError,
|
||||||
|
"For the date '05/20/2022' there is already a completed " +
|
||||||
|
"reconciliation. Use a different date.",
|
||||||
Lines.wfcheck,
|
Lines.wfcheck,
|
||||||
[book.lines[1]])
|
[book.lines[1]])
|
||||||
|
|
||||||
|
@ -570,7 +633,13 @@ class ReconTestCase(ModuleTestCase):
|
||||||
'date_from': date(2022, 5, 31),
|
'date_from': date(2022, 5, 31),
|
||||||
'date_to': date(2022, 6, 30),
|
'date_to': date(2022, 6, 30),
|
||||||
}])
|
}])
|
||||||
Reconciliation.wfdone([book.reconciliations[0]])
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/31/2022 - 06/30/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.reconciliations[1].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 1.00 usd [1]')
|
||||||
|
Reconciliation.wfdone([book.reconciliations[1]])
|
||||||
Reconciliation.wfcheck([recon2])
|
Reconciliation.wfcheck([recon2])
|
||||||
|
|
||||||
Lines.write(*[
|
Lines.write(*[
|
||||||
|
@ -578,8 +647,10 @@ class ReconTestCase(ModuleTestCase):
|
||||||
{
|
{
|
||||||
'date': date(2022, 5, 31),
|
'date': date(2022, 5, 31),
|
||||||
}])
|
}])
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"For the date '05/31/2022' there is already a completed reconciliation. Use a different date.",
|
UserError,
|
||||||
|
"For the date '05/31/2022' there is already a completed " +
|
||||||
|
"reconciliation. Use a different date.",
|
||||||
Lines.wfcheck,
|
Lines.wfcheck,
|
||||||
[book.lines[1]])
|
[book.lines[1]])
|
||||||
|
|
||||||
|
@ -627,13 +698,19 @@ class ReconTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.name, 'Book 1')
|
self.assertEqual(book.name, 'Book 1')
|
||||||
self.assertEqual(book.state, 'open')
|
self.assertEqual(book.state, 'open')
|
||||||
self.assertEqual(len(book.lines), 2)
|
self.assertEqual(len(book.lines), 2)
|
||||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
self.assertEqual(
|
||||||
self.assertEqual(book.lines[1].rec_name, '06/05/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[1].rec_name,
|
||||||
|
'06/05/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
||||||
|
|
||||||
Lines.wfcheck([book.lines[0]])
|
Lines.wfcheck([book.lines[0]])
|
||||||
Reconciliation.wfcheck([book.reconciliations[0]])
|
Reconciliation.wfcheck([book.reconciliations[0]])
|
||||||
self.assertEqual(len(book.reconciliations[0].lines), 1)
|
self.assertEqual(len(book.reconciliations[0].lines), 1)
|
||||||
self.assertEqual(book.reconciliations[0].lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||||
|
|
||||||
Lines.write(*[
|
Lines.write(*[
|
||||||
[book.lines[1]],
|
[book.lines[1]],
|
||||||
|
@ -641,8 +718,11 @@ class ReconTestCase(ModuleTestCase):
|
||||||
'date': date(2022, 5, 15),
|
'date': date(2022, 5, 15),
|
||||||
}])
|
}])
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"In the date range from 05/01/2022 to 05/31/2022, there are still cashbook lines that do not belong to any reconciliation.",
|
UserError,
|
||||||
|
"In the date range from 05/01/2022 to 05/31/2022, " +
|
||||||
|
"there are still cashbook lines that do not belong " +
|
||||||
|
"to any reconciliation.",
|
||||||
Reconciliation.wfdone,
|
Reconciliation.wfdone,
|
||||||
[book.reconciliations[0]])
|
[book.reconciliations[0]])
|
||||||
|
|
||||||
|
@ -688,20 +768,27 @@ class ReconTestCase(ModuleTestCase):
|
||||||
self.assertEqual(len(book.reconciliations), 1)
|
self.assertEqual(len(book.reconciliations), 1)
|
||||||
self.assertEqual(len(book.reconciliations[0].lines), 1)
|
self.assertEqual(len(book.reconciliations[0].lines), 1)
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The reconciliation '05/01/2022 - 05/31/2022 | 0.00 - 0.00 usd [0]' cannot be deleted, its in state 'Check'.",
|
UserError,
|
||||||
|
"The reconciliation '05/01/2022 - 05/31/2022 " +
|
||||||
|
"| 0.00 - 0.00 usd [0]' cannot be deleted, its in state 'Check'.",
|
||||||
Reconciliation.delete,
|
Reconciliation.delete,
|
||||||
list(book.reconciliations))
|
list(book.reconciliations))
|
||||||
|
|
||||||
Book.wfclosed([book])
|
Book.wfclosed([book])
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The cashbook line '05/01/2022 - 05/31/2022: 0.00 usd' cannot be deleted because the Cashbook 'Book 1 | 1.00 usd | Closed' is in state 'Closed'.",
|
UserError,
|
||||||
|
"The cashbook line '05/01/2022 - 05/31/2022: 0.00 usd' " +
|
||||||
|
"cannot be deleted because the Cashbook " +
|
||||||
|
"'Book 1 | 1.00 usd | Closed' is in state 'Closed'.",
|
||||||
Reconciliation.delete,
|
Reconciliation.delete,
|
||||||
list(book.reconciliations))
|
list(book.reconciliations))
|
||||||
|
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"The cash book 'Book 1 | 1.00 usd | Closed' is 'Closed' and cannot be changed.",
|
UserError,
|
||||||
|
"The cash book 'Book 1 | 1.00 usd | Closed' is 'Closed' " +
|
||||||
|
"and cannot be changed.",
|
||||||
Reconciliation.write,
|
Reconciliation.write,
|
||||||
*[
|
*[
|
||||||
list(book.reconciliations),
|
list(book.reconciliations),
|
||||||
|
@ -754,17 +841,27 @@ class ReconTestCase(ModuleTestCase):
|
||||||
self.assertEqual(book.name, 'Book 1')
|
self.assertEqual(book.name, 'Book 1')
|
||||||
self.assertEqual(book.state, 'open')
|
self.assertEqual(book.state, 'open')
|
||||||
self.assertEqual(len(book.lines), 2)
|
self.assertEqual(len(book.lines), 2)
|
||||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
self.assertEqual(
|
||||||
self.assertEqual(book.lines[1].rec_name, '05/05/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[1].rec_name,
|
||||||
|
'05/05/2022|Rev|1.00 usd|Text 2 [Cat1]')
|
||||||
self.assertEqual(book.lines[0].reconciliation, None)
|
self.assertEqual(book.lines[0].reconciliation, None)
|
||||||
self.assertEqual(book.lines[1].reconciliation, None)
|
self.assertEqual(book.lines[1].reconciliation, None)
|
||||||
self.assertEqual(len(book.reconciliations), 1)
|
self.assertEqual(len(book.reconciliations), 1)
|
||||||
self.assertEqual(book.reconciliations[0].rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
self.assertEqual(
|
||||||
|
book.reconciliations[0].rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]')
|
||||||
self.assertEqual(len(book.reconciliations[0].lines), 0)
|
self.assertEqual(len(book.reconciliations[0].lines), 0)
|
||||||
|
|
||||||
# run wf, fail with lines not 'checked'
|
# run wf, fail with lines not 'checked'
|
||||||
self.assertRaisesRegex(UserError,
|
self.assertRaisesRegex(
|
||||||
"For the reconciliation '05/01/2022 - 05/31/2022 | 0.00 usd - 0.00 usd [0]' of the cashbook 'Book 1 | 2.00 usd | Open', all lines in the date range from '05/01/2022' to '05/31/2022' must be in the 'Check' state.",
|
UserError,
|
||||||
|
"For the reconciliation '05/01/2022 - 05/31/2022 | " +
|
||||||
|
"0.00 usd - 0.00 usd [0]' of the cashbook " +
|
||||||
|
"'Book 1 | 2.00 usd | Open', all lines in the date range " +
|
||||||
|
"from '05/01/2022' to '05/31/2022' must be in the 'Check' state.",
|
||||||
Reconciliation.wfcheck,
|
Reconciliation.wfcheck,
|
||||||
list(book.reconciliations),
|
list(book.reconciliations),
|
||||||
)
|
)
|
||||||
|
@ -773,8 +870,12 @@ class ReconTestCase(ModuleTestCase):
|
||||||
Lines.wfcheck(book.lines)
|
Lines.wfcheck(book.lines)
|
||||||
Reconciliation.wfcheck(list(book.reconciliations))
|
Reconciliation.wfcheck(list(book.reconciliations))
|
||||||
self.assertEqual(len(book.reconciliations[0].lines), 2)
|
self.assertEqual(len(book.reconciliations[0].lines), 2)
|
||||||
self.assertEqual(book.lines[0].reconciliation.rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 2.00 usd [2]')
|
self.assertEqual(
|
||||||
self.assertEqual(book.lines[1].reconciliation.rec_name, '05/01/2022 - 05/31/2022 | 0.00 usd - 2.00 usd [2]')
|
book.lines[0].reconciliation.rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 2.00 usd [2]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[1].reconciliation.rec_name,
|
||||||
|
'05/01/2022 - 05/31/2022 | 0.00 usd - 2.00 usd [2]')
|
||||||
|
|
||||||
# check --> edit
|
# check --> edit
|
||||||
Reconciliation.wfedit(list(book.reconciliations))
|
Reconciliation.wfedit(list(book.reconciliations))
|
415
tests/splitline.py
Normal file
415
tests/splitline.py
Normal file
|
@ -0,0 +1,415 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
from trytond.tests.test_tryton import with_transaction
|
||||||
|
from trytond.pool import Pool
|
||||||
|
from datetime import date
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
|
|
||||||
|
class SplitLineTestCase(object):
|
||||||
|
""" test split lines
|
||||||
|
"""
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_splitline_in_category(self):
|
||||||
|
""" add book, check splitbooking - incoming
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
category1 = self.prep_category(cattype='in')
|
||||||
|
company = self.prep_company()
|
||||||
|
self.prep_party()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
}])
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1 | 0.00 usd | Open')
|
||||||
|
self.assertEqual(len(book.lines), 0)
|
||||||
|
|
||||||
|
Book.write(*[
|
||||||
|
[book],
|
||||||
|
{
|
||||||
|
'lines': [('create', [{
|
||||||
|
'bookingtype': 'spin',
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'splitlines': [('create', [{
|
||||||
|
'amount': Decimal('5.0'),
|
||||||
|
'splittype': 'cat',
|
||||||
|
'description': 'from category',
|
||||||
|
'category': category1.id,
|
||||||
|
}, {
|
||||||
|
'amount': Decimal('6.0'),
|
||||||
|
'splittype': 'cat',
|
||||||
|
'description': 'from cashbook',
|
||||||
|
'category': category1.id,
|
||||||
|
}])],
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
self.assertEqual(len(book.lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev/Sp|11.00 usd|- [-]')
|
||||||
|
self.assertEqual(book.lines[0].category, None)
|
||||||
|
self.assertEqual(len(book.lines[0].splitlines), 2)
|
||||||
|
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].feature, 'gen')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].booktransf_feature, None)
|
||||||
|
self.assertEqual(book.lines[0].splitlines[1].feature, 'gen')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[1].booktransf_feature, None)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].splitlines[0].rec_name,
|
||||||
|
'Rev/Sp|5.00 usd|from category [Cat1]')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].splitlines[1].rec_name,
|
||||||
|
'Rev/Sp|6.00 usd|from cashbook [Cat1]')
|
||||||
|
|
||||||
|
# check function fields
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].splitlines[0].category_view,
|
||||||
|
'Cat1')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].date, date(2022, 5, 1))
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].target.rec_name, 'Cat1')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].currency.rec_name, 'usd')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].currency_digits, 2)
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].bookingtype, 'spin')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].state, 'edit')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].splitlines[0].cashbook.rec_name,
|
||||||
|
'Book 1 | 11.00 usd | Open')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].feature, 'gen')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].booktransf_feature, None)
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].state_cashbook, 'open')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].splitlines[0].owner_cashbook.rec_name,
|
||||||
|
'Administrator')
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_splitline_category_and_transfer(self):
|
||||||
|
""" add book, line, two split-lines,
|
||||||
|
category + transfer
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
Line = pool.get('cashbook.line')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
category1 = self.prep_category(cattype='in')
|
||||||
|
company = self.prep_company()
|
||||||
|
party = self.prep_party()
|
||||||
|
books = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': 'Text 1',
|
||||||
|
'category': category1.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('1.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}, {
|
||||||
|
'name': 'Book 2',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
}])
|
||||||
|
self.assertEqual(books[0].rec_name, 'Book 1 | 1.00 usd | Open')
|
||||||
|
self.assertEqual(len(books[0].lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||||
|
self.assertEqual(books[1].rec_name, 'Book 2 | 0.00 usd | Open')
|
||||||
|
|
||||||
|
Book.write(*[
|
||||||
|
[books[0]],
|
||||||
|
{
|
||||||
|
'lines': [('write', [books[0].lines[0]], {
|
||||||
|
'bookingtype': 'spin',
|
||||||
|
'splitlines': [('create', [{
|
||||||
|
'amount': Decimal('5.0'),
|
||||||
|
'splittype': 'cat',
|
||||||
|
'description': 'from category',
|
||||||
|
'category': category1.id,
|
||||||
|
}, {
|
||||||
|
'amount': Decimal('6.0'),
|
||||||
|
'splittype': 'tr',
|
||||||
|
'description': 'from cashbook',
|
||||||
|
'booktransf': books[1].id,
|
||||||
|
}])],
|
||||||
|
})]
|
||||||
|
}])
|
||||||
|
self.assertEqual(len(books[0].lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev/Sp|11.00 usd|Text 1 [-]')
|
||||||
|
self.assertEqual(books[0].lines[0].category, None)
|
||||||
|
self.assertEqual(len(books[0].lines[0].splitlines), 2)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].splitlines[0].rec_name,
|
||||||
|
'Rev/Sp|5.00 usd|from category [Cat1]')
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].splitlines[1].rec_name,
|
||||||
|
'Rev/Sp|6.00 usd|from cashbook [Book 2 | 0.00 usd | Open]')
|
||||||
|
self.assertEqual(len(books[1].lines), 0)
|
||||||
|
self.assertEqual(books[0].lines[0].splitlines[0].feature, 'gen')
|
||||||
|
|
||||||
|
self.assertEqual(books[0].lines[0].splitlines[0].feature, 'gen')
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].splitlines[0].booktransf_feature, None)
|
||||||
|
self.assertEqual(books[0].lines[0].splitlines[1].feature, 'gen')
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].splitlines[1].booktransf_feature, 'gen')
|
||||||
|
|
||||||
|
# wf: edit -> check
|
||||||
|
Line.wfcheck(books[0].lines)
|
||||||
|
self.assertEqual(len(books[0].lines), 1)
|
||||||
|
self.assertEqual(books[0].lines[0].state, 'check')
|
||||||
|
self.assertEqual(books[0].lines[0].number, '1')
|
||||||
|
self.assertEqual(len(books[0].lines[0].references), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].references[0].rec_name,
|
||||||
|
'05/01/2022|to|-6.00 usd|from cashbook [Book 1 | 11.00 usd | Open]')
|
||||||
|
|
||||||
|
self.assertEqual(len(books[1].lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
books[1].lines[0].reference.rec_name,
|
||||||
|
'05/01/2022|Rev/Sp|11.00 usd|Text 1 [-]')
|
||||||
|
self.assertEqual(
|
||||||
|
books[1].lines[0].rec_name,
|
||||||
|
'05/01/2022|to|-6.00 usd|from cashbook [Book 1 | 11.00 usd | Open]')
|
||||||
|
|
||||||
|
# wf: check --> edit
|
||||||
|
Line.wfedit(books[0].lines)
|
||||||
|
self.assertEqual(len(books[0].lines), 1)
|
||||||
|
self.assertEqual(len(books[0].lines[0].references), 0)
|
||||||
|
self.assertEqual(len(books[1].lines), 0)
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_splitline_category_and_transfer_2ndcurrency(self):
|
||||||
|
""" add book, line, two split-lines,
|
||||||
|
category + transfer, target-cashbook in USD
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
Line = pool.get('cashbook.line')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
category1 = self.prep_category(cattype='out')
|
||||||
|
company = self.prep_company()
|
||||||
|
party = self.prep_party()
|
||||||
|
(usd, euro) = self.prep_2nd_currency(company)
|
||||||
|
|
||||||
|
books = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': euro.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': 'Text 1',
|
||||||
|
'category': category1.id,
|
||||||
|
'bookingtype': 'out',
|
||||||
|
'amount': Decimal('1.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}, {
|
||||||
|
'name': 'Book 2',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': usd.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
}])
|
||||||
|
self.assertEqual(books[0].rec_name, 'Book 1 | -1.00 € | Open')
|
||||||
|
self.assertEqual(len(books[0].lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].rec_name,
|
||||||
|
'05/01/2022|Exp|-1.00 €|Text 1 [Cat1]')
|
||||||
|
self.assertEqual(books[1].rec_name, 'Book 2 | 0.00 usd | Open')
|
||||||
|
|
||||||
|
# EUR --> USD
|
||||||
|
Book.write(*[
|
||||||
|
[books[0]],
|
||||||
|
{
|
||||||
|
'lines': [('write', [books[0].lines[0]], {
|
||||||
|
'bookingtype': 'spout',
|
||||||
|
'splitlines': [('create', [{
|
||||||
|
'amount': Decimal('5.0'),
|
||||||
|
'splittype': 'cat',
|
||||||
|
'description': 'to category',
|
||||||
|
'category': category1.id,
|
||||||
|
}, {
|
||||||
|
'amount': Decimal('6.0'),
|
||||||
|
'splittype': 'tr',
|
||||||
|
'description': 'to book2',
|
||||||
|
'booktransf': books[1].id,
|
||||||
|
}])],
|
||||||
|
})]
|
||||||
|
}])
|
||||||
|
self.assertEqual(len(books[0].lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].rec_name,
|
||||||
|
'05/01/2022|Exp/Sp|-11.00 €|Text 1 [-]')
|
||||||
|
self.assertEqual(books[0].lines[0].category, None)
|
||||||
|
self.assertEqual(len(books[0].lines[0].splitlines), 2)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].splitlines[0].rec_name,
|
||||||
|
'Exp/Sp|5.00 €|to category [Cat1]')
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].splitlines[0].amount_2nd_currency, None)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].splitlines[1].rec_name,
|
||||||
|
'Exp/Sp|6.00 €|to book2 [Book 2 | 0.00 usd | Open]')
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].splitlines[1].amount_2nd_currency,
|
||||||
|
Decimal('6.3'))
|
||||||
|
self.assertEqual(len(books[1].lines), 0)
|
||||||
|
|
||||||
|
# wf: edit -> check
|
||||||
|
Line.wfcheck(books[0].lines)
|
||||||
|
self.assertEqual(len(books[0].lines), 1)
|
||||||
|
self.assertEqual(books[0].lines[0].state, 'check')
|
||||||
|
self.assertEqual(books[0].lines[0].number, '1')
|
||||||
|
self.assertEqual(len(books[0].lines[0].references), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].lines[0].references[0].rec_name,
|
||||||
|
'05/01/2022|from|6.30 usd|to book2 [Book 1 | -11.00 € | Open]')
|
||||||
|
|
||||||
|
self.assertEqual(len(books[1].lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
books[1].lines[0].reference.rec_name,
|
||||||
|
'05/01/2022|Exp/Sp|-11.00 €|Text 1 [-]')
|
||||||
|
self.assertEqual(
|
||||||
|
books[1].lines[0].rec_name,
|
||||||
|
'05/01/2022|from|6.30 usd|to book2 [Book 1 | -11.00 € | Open]')
|
||||||
|
self.assertEqual(
|
||||||
|
books[1].lines[0].amount, Decimal('6.3'))
|
||||||
|
self.assertEqual(
|
||||||
|
books[1].lines[0].amount_2nd_currency, Decimal('6.0'))
|
||||||
|
|
||||||
|
# wf: check --> edit
|
||||||
|
Line.wfedit(books[0].lines)
|
||||||
|
self.assertEqual(len(books[0].lines), 1)
|
||||||
|
self.assertEqual(len(books[0].lines[0].references), 0)
|
||||||
|
self.assertEqual(len(books[1].lines), 0)
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_splitline_check_clear_by_bookingtype(self):
|
||||||
|
""" add book, line, category, set line to 'in',
|
||||||
|
then update to 'spin'
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
Lines = pool.get('cashbook.line')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
category1 = self.prep_category(cattype='in')
|
||||||
|
category2 = self.prep_category(name='Cat2', cattype='in')
|
||||||
|
company = self.prep_company()
|
||||||
|
party = self.prep_party()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': company.currency.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': 'Text 1',
|
||||||
|
'category': category1.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('1.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
self.assertEqual(len(book.lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
||||||
|
self.assertEqual(book.lines[0].amount, Decimal('1.0'))
|
||||||
|
self.assertEqual(book.lines[0].category.rec_name, 'Cat1')
|
||||||
|
|
||||||
|
Lines.write(*[
|
||||||
|
[book.lines[0]],
|
||||||
|
{
|
||||||
|
'bookingtype': 'spin',
|
||||||
|
'splitlines': [('create', [{
|
||||||
|
'amount': Decimal('5.0'),
|
||||||
|
'category': category1.id,
|
||||||
|
'description': 'line 1'
|
||||||
|
}, {
|
||||||
|
'amount': Decimal('2.0'),
|
||||||
|
'category': category2.id,
|
||||||
|
'description': 'line 2',
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev/Sp|7.00 usd|Text 1 [-]')
|
||||||
|
self.assertEqual(book.lines[0].amount, Decimal('7.0'))
|
||||||
|
self.assertEqual(book.lines[0].category, None)
|
||||||
|
|
||||||
|
self.assertEqual(len(book.lines[0].splitlines), 2)
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].amount, Decimal('5.0'))
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].category.rec_name, 'Cat1')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].description, 'line 1')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].splitlines[0].rec_name,
|
||||||
|
'Rev/Sp|5.00 usd|line 1 [Cat1]')
|
||||||
|
|
||||||
|
self.assertEqual(book.lines[0].splitlines[1].amount, Decimal('2.0'))
|
||||||
|
self.assertEqual(book.lines[0].splitlines[1].category.rec_name, 'Cat2')
|
||||||
|
self.assertEqual(book.lines[0].splitlines[1].description, 'line 2')
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].splitlines[1].rec_name,
|
||||||
|
'Rev/Sp|2.00 usd|line 2 [Cat2]')
|
||||||
|
|
||||||
|
Lines.write(*[
|
||||||
|
[book.lines[0]],
|
||||||
|
{
|
||||||
|
'splitlines': [
|
||||||
|
('write',
|
||||||
|
[book.lines[0].splitlines[0]],
|
||||||
|
{
|
||||||
|
'amount': Decimal('3.5'),
|
||||||
|
})],
|
||||||
|
}])
|
||||||
|
self.assertEqual(book.lines[0].splitlines[0].amount, Decimal('3.5'))
|
||||||
|
self.assertEqual(book.lines[0].splitlines[1].amount, Decimal('2.0'))
|
||||||
|
self.assertEqual(book.lines[0].amount, Decimal('5.5'))
|
||||||
|
|
||||||
|
Lines.write(*[
|
||||||
|
[book.lines[0]],
|
||||||
|
{
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('7.5'),
|
||||||
|
'category': category2.id,
|
||||||
|
}])
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev|7.50 usd|Text 1 [Cat2]')
|
||||||
|
self.assertEqual(book.lines[0].category.rec_name, 'Cat2')
|
||||||
|
self.assertEqual(len(book.lines[0].splitlines), 0)
|
||||||
|
|
||||||
|
# end SplitLineTestCase
|
37
tests/test_module.py
Normal file
37
tests/test_module.py
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
|
||||||
|
from trytond.tests.test_tryton import ModuleTestCase
|
||||||
|
|
||||||
|
from .type import TypeTestCase
|
||||||
|
from .book import BookTestCase
|
||||||
|
from .line import LineTestCase
|
||||||
|
from .splitline import SplitLineTestCase
|
||||||
|
from .config import ConfigTestCase
|
||||||
|
from .category import CategoryTestCase
|
||||||
|
from .reconciliation import ReconTestCase
|
||||||
|
from .bookingwiz import BookingWizardTestCase
|
||||||
|
from .valuestore import ValuestoreTestCase
|
||||||
|
|
||||||
|
|
||||||
|
class CashbookTestCase(
|
||||||
|
ValuestoreTestCase,
|
||||||
|
BookingWizardTestCase,
|
||||||
|
ReconTestCase,
|
||||||
|
CategoryTestCase,
|
||||||
|
ConfigTestCase,
|
||||||
|
LineTestCase,
|
||||||
|
SplitLineTestCase,
|
||||||
|
BookTestCase,
|
||||||
|
TypeTestCase,
|
||||||
|
ModuleTestCase):
|
||||||
|
'Test cashbook module'
|
||||||
|
module = 'cashbook'
|
||||||
|
|
||||||
|
# end CashbookTestCase
|
||||||
|
|
||||||
|
|
||||||
|
del ModuleTestCase
|
|
@ -1,109 +0,0 @@
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
# This file is part of the cashbook-module from m-ds for Tryton.
|
|
||||||
# The COPYRIGHT file at the top level of this repository contains the
|
|
||||||
# full copyright notices and license terms.
|
|
||||||
|
|
||||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
|
||||||
from trytond.pool import Pool
|
|
||||||
from trytond.transaction import Transaction
|
|
||||||
from trytond.exceptions import UserError
|
|
||||||
from datetime import date
|
|
||||||
from unittest.mock import MagicMock
|
|
||||||
from decimal import Decimal
|
|
||||||
|
|
||||||
|
|
||||||
class SplitLineTestCase(ModuleTestCase):
|
|
||||||
'Test split line module'
|
|
||||||
module = 'cashbook'
|
|
||||||
|
|
||||||
@with_transaction()
|
|
||||||
def test_splitline_check_clear_by_bookingtype(self):
|
|
||||||
""" add book, line, category, set line to 'in',
|
|
||||||
then update to 'spin'
|
|
||||||
"""
|
|
||||||
pool = Pool()
|
|
||||||
Book = pool.get('cashbook.book')
|
|
||||||
Lines = pool.get('cashbook.line')
|
|
||||||
|
|
||||||
types = self.prep_type()
|
|
||||||
category1 = self.prep_category(cattype='in')
|
|
||||||
category2 = self.prep_category(name='Cat2', cattype='in')
|
|
||||||
company = self.prep_company()
|
|
||||||
party = self.prep_party()
|
|
||||||
book, = Book.create([{
|
|
||||||
'name': 'Book 1',
|
|
||||||
'btype': types.id,
|
|
||||||
'company': company.id,
|
|
||||||
'currency': company.currency.id,
|
|
||||||
'number_sequ': self.prep_sequence().id,
|
|
||||||
'start_date': date(2022, 5, 1),
|
|
||||||
'lines': [('create', [{
|
|
||||||
'date': date(2022, 5, 1),
|
|
||||||
'description': 'Text 1',
|
|
||||||
'category': category1.id,
|
|
||||||
'bookingtype': 'in',
|
|
||||||
'amount': Decimal('1.0'),
|
|
||||||
'party': party.id,
|
|
||||||
}])],
|
|
||||||
}])
|
|
||||||
|
|
||||||
self.assertEqual(len(book.lines), 1)
|
|
||||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|1.00 usd|Text 1 [Cat1]')
|
|
||||||
self.assertEqual(book.lines[0].amount, Decimal('1.0'))
|
|
||||||
self.assertEqual(book.lines[0].category.rec_name, 'Cat1')
|
|
||||||
|
|
||||||
Lines.write(*[
|
|
||||||
[book.lines[0]],
|
|
||||||
{
|
|
||||||
'bookingtype': 'spin',
|
|
||||||
'splitlines': [('create', [{
|
|
||||||
'amount': Decimal('5.0'),
|
|
||||||
'category': category1.id,
|
|
||||||
'description': 'line 1'
|
|
||||||
}, {
|
|
||||||
'amount': Decimal('2.0'),
|
|
||||||
'category': category2.id,
|
|
||||||
'description': 'line 2',
|
|
||||||
}])],
|
|
||||||
}])
|
|
||||||
|
|
||||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev/Sp|7.00 usd|Text 1 [-]')
|
|
||||||
self.assertEqual(book.lines[0].amount, Decimal('7.0'))
|
|
||||||
self.assertEqual(book.lines[0].category, None)
|
|
||||||
|
|
||||||
self.assertEqual(len(book.lines[0].splitlines), 2)
|
|
||||||
self.assertEqual(book.lines[0].splitlines[0].amount, Decimal('5.0'))
|
|
||||||
self.assertEqual(book.lines[0].splitlines[0].category.rec_name, 'Cat1')
|
|
||||||
self.assertEqual(book.lines[0].splitlines[0].description, 'line 1')
|
|
||||||
self.assertEqual(book.lines[0].splitlines[0].rec_name, 'Rev/Sp|5.00 usd|line 1 [Cat1]')
|
|
||||||
|
|
||||||
self.assertEqual(book.lines[0].splitlines[1].amount, Decimal('2.0'))
|
|
||||||
self.assertEqual(book.lines[0].splitlines[1].category.rec_name, 'Cat2')
|
|
||||||
self.assertEqual(book.lines[0].splitlines[1].description, 'line 2')
|
|
||||||
self.assertEqual(book.lines[0].splitlines[1].rec_name, 'Rev/Sp|2.00 usd|line 2 [Cat2]')
|
|
||||||
|
|
||||||
Lines.write(*[
|
|
||||||
[book.lines[0]],
|
|
||||||
{
|
|
||||||
'splitlines': [('write',
|
|
||||||
[book.lines[0].splitlines[0]],
|
|
||||||
{
|
|
||||||
'amount': Decimal('3.5'),
|
|
||||||
})],
|
|
||||||
}])
|
|
||||||
self.assertEqual(book.lines[0].splitlines[0].amount, Decimal('3.5'))
|
|
||||||
self.assertEqual(book.lines[0].splitlines[1].amount, Decimal('2.0'))
|
|
||||||
self.assertEqual(book.lines[0].amount, Decimal('5.5'))
|
|
||||||
|
|
||||||
Lines.write(*[
|
|
||||||
[book.lines[0]],
|
|
||||||
{
|
|
||||||
'bookingtype': 'in',
|
|
||||||
'amount': Decimal('7.5'),
|
|
||||||
'category': category2.id,
|
|
||||||
}])
|
|
||||||
self.assertEqual(book.lines[0].rec_name, '05/01/2022|Rev|7.50 usd|Text 1 [Cat2]')
|
|
||||||
self.assertEqual(book.lines[0].category.rec_name, 'Cat2')
|
|
||||||
self.assertEqual(len(book.lines[0].splitlines), 0)
|
|
||||||
|
|
||||||
# end SplitLineTestCase
|
|
|
@ -3,16 +3,15 @@
|
||||||
# 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.tests.test_tryton import ModuleTestCase, with_transaction
|
from trytond.tests.test_tryton import with_transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.exceptions import UserError
|
from trytond.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
class TypeTestCase(ModuleTestCase):
|
class TypeTestCase(object):
|
||||||
'Test cashbook type module'
|
""" test types
|
||||||
module = 'cashbook'
|
"""
|
||||||
|
|
||||||
def prep_type(self, name='Cash', short='CAS'):
|
def prep_type(self, name='Cash', short='CAS'):
|
||||||
""" create book-type
|
""" create book-type
|
||||||
"""
|
"""
|
840
tests/valuestore.py
Normal file
840
tests/valuestore.py
Normal file
|
@ -0,0 +1,840 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
from datetime import date, timedelta
|
||||||
|
from decimal import Decimal
|
||||||
|
from trytond.tests.test_tryton import with_transaction
|
||||||
|
from trytond.pool import Pool
|
||||||
|
from trytond.exceptions import UserError
|
||||||
|
from trytond.transaction import Transaction
|
||||||
|
|
||||||
|
|
||||||
|
class ValuestoreTestCase(object):
|
||||||
|
""" test storage of values
|
||||||
|
"""
|
||||||
|
@with_transaction()
|
||||||
|
def test_valstore_update_currency_rate(self):
|
||||||
|
""" create cashbook, check update of cashbook on
|
||||||
|
update of rates of currency
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
ValueStore = pool.get('cashbook.values')
|
||||||
|
Currency = pool.get('currency.currency')
|
||||||
|
Queue = pool.get('ir.queue')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
company = self.prep_company()
|
||||||
|
(usd, euro) = self.prep_2nd_currency(company)
|
||||||
|
self.assertEqual(company.currency.rec_name, 'Euro')
|
||||||
|
|
||||||
|
with Transaction().set_context({
|
||||||
|
'company': company.id,
|
||||||
|
'date': date(2022, 5, 20)}):
|
||||||
|
|
||||||
|
self.assertEqual(Queue.search_count([]), 0)
|
||||||
|
|
||||||
|
category = self.prep_category(cattype='in')
|
||||||
|
party = self.prep_party()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': usd.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': '10 US$',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}, {
|
||||||
|
'date': date(2022, 5, 10),
|
||||||
|
'description': '5 US$',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('5.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
# run worker
|
||||||
|
self.assertEqual(
|
||||||
|
ValueStore.search_count([]),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
self.prep_valstore_run_worker()
|
||||||
|
|
||||||
|
book, = Book.search([])
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1 | 15.00 usd | Open')
|
||||||
|
self.assertEqual(book.balance, Decimal('15.0'))
|
||||||
|
self.assertEqual(book.balance_all, Decimal('15.0'))
|
||||||
|
self.assertEqual(book.balance_ref, Decimal('14.29'))
|
||||||
|
self.assertEqual(
|
||||||
|
len(book.value_store),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[0].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[1].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance_all|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[2].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance_ref|14.29|2')
|
||||||
|
|
||||||
|
# add rate to usd
|
||||||
|
self.assertEqual(Queue.search_count([]), 0)
|
||||||
|
Currency.write(*[
|
||||||
|
[usd],
|
||||||
|
{
|
||||||
|
'rates': [('create', [{
|
||||||
|
'date': date(2022, 5, 6),
|
||||||
|
'rate': Decimal('1.08'),
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
self.assertEqual(Queue.search_count([]), 1)
|
||||||
|
self.prep_valstore_run_worker()
|
||||||
|
self.assertEqual(Queue.search_count([]), 0)
|
||||||
|
|
||||||
|
# check reference-currency
|
||||||
|
book, = Book.search([])
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1 | 15.00 usd | Open')
|
||||||
|
self.assertEqual(book.balance, Decimal('15.0'))
|
||||||
|
self.assertEqual(book.balance_all, Decimal('15.0'))
|
||||||
|
self.assertEqual(book.balance_ref, Decimal('13.89'))
|
||||||
|
self.assertEqual(
|
||||||
|
len(book.value_store),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[0].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[1].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance_all|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[2].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance_ref|13.89|2')
|
||||||
|
|
||||||
|
# find rate
|
||||||
|
self.assertEqual(len(usd.rates), 2)
|
||||||
|
self.assertEqual(usd.rates[0].date, date(2022, 5, 6))
|
||||||
|
self.assertEqual(usd.rates[0].rate, Decimal('1.08'))
|
||||||
|
|
||||||
|
# update rate
|
||||||
|
self.assertEqual(Queue.search_count([]), 0)
|
||||||
|
Currency.write(*[
|
||||||
|
[usd],
|
||||||
|
{
|
||||||
|
'rates': [(
|
||||||
|
'write',
|
||||||
|
[usd.rates[0]],
|
||||||
|
{'rate': Decimal('1.12')})],
|
||||||
|
}])
|
||||||
|
self.assertEqual(Queue.search_count([]), 1)
|
||||||
|
self.prep_valstore_run_worker()
|
||||||
|
self.assertEqual(Queue.search_count([]), 0)
|
||||||
|
|
||||||
|
book, = Book.search([])
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1 | 15.00 usd | Open')
|
||||||
|
self.assertEqual(book.balance_ref, Decimal('13.39'))
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[2].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance_ref|13.39|2')
|
||||||
|
|
||||||
|
# delete rate
|
||||||
|
self.assertEqual(Queue.search_count([]), 0)
|
||||||
|
Currency.write(*[
|
||||||
|
[usd],
|
||||||
|
{
|
||||||
|
'rates': [('delete', [usd.rates[0]])],
|
||||||
|
}])
|
||||||
|
self.assertEqual(Queue.search_count([]), 1)
|
||||||
|
self.prep_valstore_run_worker()
|
||||||
|
self.assertEqual(Queue.search_count([]), 0)
|
||||||
|
|
||||||
|
book, = Book.search([])
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1 | 15.00 usd | Open')
|
||||||
|
self.assertEqual(book.balance_ref, Decimal('14.29'))
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[2].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance_ref|14.29|2')
|
||||||
|
|
||||||
|
def prep_valstore_run_worker(self):
|
||||||
|
""" run tasks from queue
|
||||||
|
"""
|
||||||
|
Queue = Pool().get('ir.queue')
|
||||||
|
|
||||||
|
tasks = Queue.search([])
|
||||||
|
for task in tasks:
|
||||||
|
task.run()
|
||||||
|
Queue.delete(tasks)
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_valstore_update_store_values(self):
|
||||||
|
""" create cashbook, store value
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
ValueStore = pool.get('cashbook.values')
|
||||||
|
Queue = pool.get('ir.queue')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
company = self.prep_company()
|
||||||
|
(usd, euro) = self.prep_2nd_currency(company)
|
||||||
|
self.assertEqual(company.currency.rec_name, 'Euro')
|
||||||
|
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
|
|
||||||
|
self.assertEqual(Queue.search_count([]), 0)
|
||||||
|
|
||||||
|
category = self.prep_category(cattype='in')
|
||||||
|
party = self.prep_party()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': usd.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': '10 US$',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}, {
|
||||||
|
'date': date(2022, 5, 10),
|
||||||
|
'description': '5 US$',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('5.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
# run worker
|
||||||
|
self.assertEqual(
|
||||||
|
ValueStore.search_count([]),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
self.prep_valstore_run_worker()
|
||||||
|
|
||||||
|
# check values until 2022-05-05
|
||||||
|
with Transaction().set_context({
|
||||||
|
'date': date(2022, 5, 5)}):
|
||||||
|
|
||||||
|
book, = Book.search([])
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(book.balance, Decimal('10.0'))
|
||||||
|
self.assertEqual(book.balance_all, Decimal('15.0'))
|
||||||
|
self.assertEqual(book.balance_ref, Decimal('14.29'))
|
||||||
|
self.assertEqual(
|
||||||
|
len(book.value_store),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[0].rec_name,
|
||||||
|
'[Book 1 | 10.00 usd | Open]|balance|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[1].rec_name,
|
||||||
|
'[Book 1 | 10.00 usd | Open]|balance_all|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
book.value_store[2].rec_name,
|
||||||
|
'[Book 1 | 10.00 usd | Open]|balance_ref|14.29|2')
|
||||||
|
|
||||||
|
# values created by book-create, without context
|
||||||
|
self.assertEqual(
|
||||||
|
ValueStore.search_count([]),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
|
||||||
|
values = ValueStore.search([], order=[('field_name', 'ASC')])
|
||||||
|
self.assertEqual(
|
||||||
|
len(values),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
self.assertEqual(
|
||||||
|
values[0].rec_name,
|
||||||
|
'[Book 1 | 10.00 usd | Open]|balance|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[1].rec_name,
|
||||||
|
'[Book 1 | 10.00 usd | Open]|balance_all|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[2].rec_name,
|
||||||
|
'[Book 1 | 10.00 usd | Open]|balance_ref|14.29|2')
|
||||||
|
|
||||||
|
# check write of too much digits
|
||||||
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
|
r'The number of digits in the value ' +
|
||||||
|
r'"' + r"'12.345'" +
|
||||||
|
r'" for field "Value" in "[Book 1 | 10\.00 usd | ' +
|
||||||
|
r'Open]|balance|12\.35|2" of "Value Store" exceeds ' +
|
||||||
|
r'the limit of "2".',
|
||||||
|
ValueStore.write,
|
||||||
|
*[
|
||||||
|
[values[0]],
|
||||||
|
{
|
||||||
|
'numvalue': Decimal('12.345'),
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
# update with context
|
||||||
|
Book.valuestore_update_records([book])
|
||||||
|
|
||||||
|
values = ValueStore.search([], order=[('field_name', 'ASC')])
|
||||||
|
self.assertEqual(
|
||||||
|
len(values),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[0].rec_name,
|
||||||
|
'[Book 1 | 10.00 usd | Open]|balance|10.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[1].rec_name,
|
||||||
|
'[Book 1 | 10.00 usd | Open]|balance_all|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[2].rec_name,
|
||||||
|
'[Book 1 | 10.00 usd | Open]|balance_ref|14.29|2')
|
||||||
|
|
||||||
|
# check values until 2022-05-15
|
||||||
|
with Transaction().set_context({
|
||||||
|
'date': date(2022, 5, 15)}):
|
||||||
|
|
||||||
|
book, = Book.search([])
|
||||||
|
self.assertEqual(book.rec_name, 'Book 1 | 15.00 usd | Open')
|
||||||
|
self.assertEqual(book.balance, Decimal('15.0'))
|
||||||
|
self.assertEqual(book.balance_all, Decimal('15.0'))
|
||||||
|
self.assertEqual(book.balance_ref, Decimal('14.29'))
|
||||||
|
|
||||||
|
# update values
|
||||||
|
self.assertEqual(
|
||||||
|
ValueStore.search_count([]),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
Book.valuestore_update_records([book])
|
||||||
|
|
||||||
|
values = ValueStore.search(
|
||||||
|
[('field_name', 'in', [
|
||||||
|
'balance', 'balance_all', 'balance_ref'])],
|
||||||
|
order=[('field_name', 'ASC')])
|
||||||
|
self.assertEqual(len(values), 3)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[0].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[1].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance_all|15.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[2].rec_name,
|
||||||
|
'[Book 1 | 15.00 usd | Open]|balance_ref|14.29|2')
|
||||||
|
|
||||||
|
# delete book, should delete values
|
||||||
|
Book.write(*[
|
||||||
|
[book],
|
||||||
|
{'lines': [('delete', [x.id for x in book.lines])]}
|
||||||
|
])
|
||||||
|
self.assertEqual(
|
||||||
|
ValueStore.search_count([]),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
Book.delete([book])
|
||||||
|
self.assertEqual(ValueStore.search_count([]), 0)
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_valstore_update_store_values_line(self):
|
||||||
|
""" create cashbooks hierarchical, add lines
|
||||||
|
check update of parent cashbooks
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
Line = pool.get('cashbook.line')
|
||||||
|
ValueStore = pool.get('cashbook.values')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
company = self.prep_company()
|
||||||
|
(usd, euro) = self.prep_2nd_currency(company)
|
||||||
|
self.assertEqual(company.currency.rec_name, 'Euro')
|
||||||
|
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
|
category = self.prep_category(cattype='in')
|
||||||
|
party = self.prep_party()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Lev 0',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': usd.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': '10 US$',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
'childs': [('create', [{
|
||||||
|
'name': 'Lev 1a',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': euro.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
}, {
|
||||||
|
'name': 'Lev 1b',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': euro.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
self.assertEqual(book.rec_name, 'Lev 0 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(len(book.lines), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
book.lines[0].rec_name,
|
||||||
|
'05/01/2022|Rev|10.00 usd|10 US$ [Cat1]')
|
||||||
|
self.assertEqual(len(book.childs), 2)
|
||||||
|
self.assertEqual(
|
||||||
|
book.childs[0].rec_name, 'Lev 0/Lev 1a | 0.00 € | Open')
|
||||||
|
self.assertEqual(len(book.childs[0].lines), 0)
|
||||||
|
self.assertEqual(
|
||||||
|
book.childs[1].rec_name, 'Lev 0/Lev 1b | 0.00 € | Open')
|
||||||
|
self.assertEqual(len(book.childs[1].lines), 0)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
ValueStore.search_count([]),
|
||||||
|
3 * len(Book.valuestore_fields()))
|
||||||
|
self.prep_valstore_run_worker()
|
||||||
|
|
||||||
|
values = ValueStore.search(
|
||||||
|
[('field_name', 'in', [
|
||||||
|
'balance', 'balance_all', 'balance_ref'])],
|
||||||
|
order=[('cashbook', 'ASC'), ('field_name', 'ASC')])
|
||||||
|
self.assertEqual(len(values), 3 * 3)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[0].rec_name,
|
||||||
|
'[Lev 0 | 10.00 usd | Open]|balance|10.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[1].rec_name,
|
||||||
|
'[Lev 0 | 10.00 usd | Open]|balance_all|10.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[2].rec_name,
|
||||||
|
'[Lev 0 | 10.00 usd | Open]|balance_ref|9.52|2')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[3].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 0.00 € | Open]|balance|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[4].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 0.00 € | Open]|balance_all|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[5].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 0.00 € | Open]|balance_ref|0.00|2')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[6].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[7].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance_all|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[8].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance_ref|0.00|2')
|
||||||
|
|
||||||
|
# add bookings
|
||||||
|
Line.create(self.prep_valstore_line_create_data(
|
||||||
|
[{
|
||||||
|
'cashbook': values[0].cashbook.id, # Lev 0
|
||||||
|
'amount': Decimal('2.0'),
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'category': category.id,
|
||||||
|
'date': date(2022, 5, 10),
|
||||||
|
}, {
|
||||||
|
'cashbook': values[3].cashbook.id, # Lev 1a
|
||||||
|
'amount': Decimal('3.0'),
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'category': category.id,
|
||||||
|
'date': date(2022, 5, 10),
|
||||||
|
}]))
|
||||||
|
|
||||||
|
# add 'date' to context, will return computed
|
||||||
|
# (not stored) values
|
||||||
|
with Transaction().set_context({'date': date(2022, 5, 10)}):
|
||||||
|
values = ValueStore.search(
|
||||||
|
[('field_name', 'in', [
|
||||||
|
'balance', 'balance_all', 'balance_ref'])],
|
||||||
|
order=[('cashbook', 'ASC'), ('field_name', 'ASC')])
|
||||||
|
self.assertEqual(len(values), 9)
|
||||||
|
self.assertEqual(
|
||||||
|
values[0].rec_name,
|
||||||
|
'[Lev 0 | 15.15 usd | Open]|balance|10.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[1].rec_name,
|
||||||
|
'[Lev 0 | 15.15 usd | Open]|balance_all|10.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[2].rec_name,
|
||||||
|
'[Lev 0 | 15.15 usd | Open]|balance_ref|9.52|2')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[3].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 3.00 € | Open]|balance|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[4].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 3.00 € | Open]|balance_all|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[5].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 3.00 € | Open]|balance_ref|0.00|2')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[6].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[7].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance_all|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[8].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance_ref|0.00|2')
|
||||||
|
|
||||||
|
# before run of workers - w/o 'date' in context
|
||||||
|
values = ValueStore.search(
|
||||||
|
[('field_name', 'in', [
|
||||||
|
'balance', 'balance_all', 'balance_ref'])],
|
||||||
|
order=[('cashbook', 'ASC'), ('field_name', 'ASC')])
|
||||||
|
self.assertEqual(len(values), 9)
|
||||||
|
self.assertEqual(
|
||||||
|
values[0].rec_name,
|
||||||
|
'[Lev 0 | 10.00 usd | Open]|balance|10.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[1].rec_name,
|
||||||
|
'[Lev 0 | 10.00 usd | Open]|balance_all|10.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[2].rec_name,
|
||||||
|
'[Lev 0 | 10.00 usd | Open]|balance_ref|9.52|2')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[3].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 0.00 € | Open]|balance|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[4].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 0.00 € | Open]|balance_all|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[5].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 0.00 € | Open]|balance_ref|0.00|2')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[6].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[7].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance_all|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[8].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance_ref|0.00|2')
|
||||||
|
|
||||||
|
self.prep_valstore_run_worker()
|
||||||
|
|
||||||
|
# after run of workers
|
||||||
|
values = ValueStore.search(
|
||||||
|
[('field_name', 'in', [
|
||||||
|
'balance', 'balance_all', 'balance_ref'])],
|
||||||
|
order=[('cashbook', 'ASC'), ('field_name', 'ASC')])
|
||||||
|
self.assertEqual(len(values), 9)
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[0].rec_name,
|
||||||
|
'[Lev 0 | 15.15 usd | Open]|balance|15.15|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[1].rec_name,
|
||||||
|
'[Lev 0 | 15.15 usd | Open]|balance_all|15.15|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[2].rec_name,
|
||||||
|
'[Lev 0 | 15.15 usd | Open]|balance_ref|14.43|2')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[3].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 3.00 € | Open]|balance|3.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[4].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 3.00 € | Open]|balance_all|3.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[5].rec_name,
|
||||||
|
'[Lev 0/Lev 1a | 3.00 € | Open]|balance_ref|3.00|2')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
values[6].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[7].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance_all|0.00|2')
|
||||||
|
self.assertEqual(
|
||||||
|
values[8].rec_name,
|
||||||
|
'[Lev 0/Lev 1b | 0.00 € | Open]|balance_ref|0.00|2')
|
||||||
|
|
||||||
|
def prep_valstore_line_create_data(self, query):
|
||||||
|
""" allow add of data
|
||||||
|
"""
|
||||||
|
return query
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_valstore_search_sort_books(self):
|
||||||
|
""" create cashbooks add lines, search/sort
|
||||||
|
with and w/o 'date' in context
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
Line = pool.get('cashbook.line')
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
company = self.prep_company()
|
||||||
|
(usd, euro) = self.prep_2nd_currency(company)
|
||||||
|
self.assertEqual(company.currency.rec_name, 'Euro')
|
||||||
|
|
||||||
|
with Transaction().set_context({'company': company.id}):
|
||||||
|
category = self.prep_category(cattype='in')
|
||||||
|
party = self.prep_party()
|
||||||
|
books = Book.create([{
|
||||||
|
'name': 'Cashbook 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': usd.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': '10 US$',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])]}, {
|
||||||
|
'name': 'Cashbook 2',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': euro.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
}, {
|
||||||
|
'name': 'Cashbook 3',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': euro.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
}])
|
||||||
|
self.assertEqual(len(books), 3)
|
||||||
|
self.assertEqual(books[0].rec_name, 'Cashbook 1 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(books[1].rec_name, 'Cashbook 2 | 0.00 € | Open')
|
||||||
|
self.assertEqual(books[2].rec_name, 'Cashbook 3 | 0.00 € | Open')
|
||||||
|
|
||||||
|
Line.create(self.prep_valstore_line_create_data(
|
||||||
|
[{
|
||||||
|
'cashbook': books[1].id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('5.0'),
|
||||||
|
'date': date(2022, 5, 6),
|
||||||
|
'description': '5€ in',
|
||||||
|
'category': category.id,
|
||||||
|
}, {
|
||||||
|
'cashbook': books[2].id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('6.0'),
|
||||||
|
'date': date(2022, 5, 7),
|
||||||
|
'description': '6€ in',
|
||||||
|
'category': category.id,
|
||||||
|
}]))
|
||||||
|
|
||||||
|
# no 'date' in context, using stored values
|
||||||
|
# workers not yet processed
|
||||||
|
books = Book.search([], order=[('name', 'ASC')])
|
||||||
|
self.assertEqual(len(books), 3)
|
||||||
|
self.assertEqual(books[0].rec_name, 'Cashbook 1 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(books[1].rec_name, 'Cashbook 2 | 0.00 € | Open')
|
||||||
|
self.assertEqual(books[2].rec_name, 'Cashbook 3 | 0.00 € | Open')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance', '=', Decimal('0.0'))]),
|
||||||
|
2)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance_all', '=', Decimal('0.0'))]),
|
||||||
|
2)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance_ref', '=', Decimal('0.0'))]),
|
||||||
|
2)
|
||||||
|
|
||||||
|
# check sorting - using stored values
|
||||||
|
books = Book.search([], order=[
|
||||||
|
('balance_all', 'DESC'), ('name', 'ASC')])
|
||||||
|
self.assertEqual(len(books), 3)
|
||||||
|
self.assertEqual(books[0].rec_name, 'Cashbook 1 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(books[1].rec_name, 'Cashbook 2 | 0.00 € | Open')
|
||||||
|
self.assertEqual(books[2].rec_name, 'Cashbook 3 | 0.00 € | Open')
|
||||||
|
|
||||||
|
# search again with 'date' - using computed values
|
||||||
|
with Transaction().set_context({'date': date(2022, 5, 6)}):
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance', '=', Decimal('5.0'))]),
|
||||||
|
1)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([
|
||||||
|
('balance', '>=', Decimal('5.0')),
|
||||||
|
('balance', '<', Decimal('9.0')),
|
||||||
|
]),
|
||||||
|
1)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([
|
||||||
|
('balance_all', '>=', Decimal('5.0'))]),
|
||||||
|
3)
|
||||||
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
|
"Search with 'date' no allowed for field " +
|
||||||
|
"'balance_ref' on model 'cashbook.book'.",
|
||||||
|
Book.search_count,
|
||||||
|
[('balance_ref', '=', Decimal('0.0'))])
|
||||||
|
|
||||||
|
self.assertRaisesRegex(
|
||||||
|
UserError,
|
||||||
|
"Search with 'date' no allowed for field " +
|
||||||
|
"'balance_ref' on model 'cashbook.book'.",
|
||||||
|
Book.search,
|
||||||
|
[], order=[('balance_ref', 'ASC')])
|
||||||
|
|
||||||
|
# check sorting - using computed values
|
||||||
|
books = Book.search([], order=[
|
||||||
|
('balance_all', 'DESC'),
|
||||||
|
('name', 'ASC'),
|
||||||
|
('balance', 'ASC')])
|
||||||
|
self.assertEqual(len(books), 3)
|
||||||
|
self.assertEqual(
|
||||||
|
books[0].rec_name, 'Cashbook 1 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(
|
||||||
|
books[1].rec_name, 'Cashbook 3 | 0.00 € | Open')
|
||||||
|
self.assertEqual(books[1].balance_all, Decimal('6.0'))
|
||||||
|
self.assertEqual(
|
||||||
|
books[2].rec_name, 'Cashbook 2 | 5.00 € | Open')
|
||||||
|
|
||||||
|
with Transaction().set_context({'date': date(2022, 5, 7)}):
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance', '=', Decimal('5.0'))]),
|
||||||
|
1)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([
|
||||||
|
('balance', '>=', Decimal('5.0')),
|
||||||
|
('balance', '<', Decimal('9.0')),
|
||||||
|
]),
|
||||||
|
2)
|
||||||
|
|
||||||
|
# run workers
|
||||||
|
self.prep_valstore_run_worker()
|
||||||
|
|
||||||
|
# check stored values - no 'date' in context
|
||||||
|
books = Book.search([], order=[('name', 'ASC')])
|
||||||
|
self.assertEqual(len(books), 3)
|
||||||
|
self.assertEqual(books[0].rec_name, 'Cashbook 1 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(books[1].rec_name, 'Cashbook 2 | 5.00 € | Open')
|
||||||
|
self.assertEqual(books[2].rec_name, 'Cashbook 3 | 6.00 € | Open')
|
||||||
|
|
||||||
|
# check sorting - using stored values
|
||||||
|
# run most sorters
|
||||||
|
books = Book.search([], order=[
|
||||||
|
('balance_all', 'DESC'),
|
||||||
|
('name', 'ASC'),
|
||||||
|
('balance', 'ASC'),
|
||||||
|
('balance_ref', 'ASC')])
|
||||||
|
self.assertEqual(len(books), 3)
|
||||||
|
self.assertEqual(books[0].rec_name, 'Cashbook 1 | 10.00 usd | Open')
|
||||||
|
self.assertEqual(books[1].rec_name, 'Cashbook 3 | 6.00 € | Open')
|
||||||
|
self.assertEqual(books[2].rec_name, 'Cashbook 2 | 5.00 € | Open')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance', '=', Decimal('0.0'))]),
|
||||||
|
0)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance', '=', Decimal('5.0'))]),
|
||||||
|
1)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance', '=', Decimal('6.0'))]),
|
||||||
|
1)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([
|
||||||
|
('balance', '>=', Decimal('5.0')),
|
||||||
|
('balance', '<', Decimal('9.0')),
|
||||||
|
]),
|
||||||
|
2)
|
||||||
|
self.assertEqual(
|
||||||
|
Book.search_count([('balance_ref', '=', Decimal('6.0'))]),
|
||||||
|
1)
|
||||||
|
|
||||||
|
@with_transaction()
|
||||||
|
def test_valstore_maintain_values(self):
|
||||||
|
""" create cashbook, check maintenance -
|
||||||
|
update records by cron, delete lost records
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
ValueStore = pool.get('cashbook.values')
|
||||||
|
tab_book = Book.__table__()
|
||||||
|
cursor = Transaction().connection.cursor()
|
||||||
|
|
||||||
|
types = self.prep_type()
|
||||||
|
company = self.prep_company()
|
||||||
|
(usd, euro) = self.prep_2nd_currency(company)
|
||||||
|
self.assertEqual(company.currency.rec_name, 'Euro')
|
||||||
|
|
||||||
|
category = self.prep_category(cattype='in')
|
||||||
|
party = self.prep_party()
|
||||||
|
book, = Book.create([{
|
||||||
|
'name': 'Book 1',
|
||||||
|
'btype': types.id,
|
||||||
|
'company': company.id,
|
||||||
|
'currency': usd.id,
|
||||||
|
'number_sequ': self.prep_sequence().id,
|
||||||
|
'start_date': date(2022, 5, 1),
|
||||||
|
'lines': [('create', [{
|
||||||
|
'date': date(2022, 5, 1),
|
||||||
|
'description': '10 US$',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('10.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}, {
|
||||||
|
'date': date(2022, 5, 10),
|
||||||
|
'description': '5 US$',
|
||||||
|
'category': category.id,
|
||||||
|
'bookingtype': 'in',
|
||||||
|
'amount': Decimal('5.0'),
|
||||||
|
'party': party.id,
|
||||||
|
}])],
|
||||||
|
}])
|
||||||
|
|
||||||
|
# clean 'numvalue'
|
||||||
|
# maintenance_values() will restore it
|
||||||
|
val1, = ValueStore.search([('field_name', '=', 'balance')])
|
||||||
|
ValueStore.write(*[[val1], {'numvalue': None}])
|
||||||
|
|
||||||
|
self.assertTrue(val1.write_date is not None)
|
||||||
|
self.assertTrue(val1.create_date is not None)
|
||||||
|
self.assertEqual(val1.numvalue, None)
|
||||||
|
|
||||||
|
# update outdated records
|
||||||
|
with Transaction().set_context({
|
||||||
|
'maintenance_date': val1.write_date.date() +
|
||||||
|
timedelta(days=2)}):
|
||||||
|
ValueStore.maintenance_values()
|
||||||
|
|
||||||
|
val1, = ValueStore.search([('field_name', '=', 'balance')])
|
||||||
|
self.assertEqual(val1.numvalue, Decimal('15.0'))
|
||||||
|
|
||||||
|
# delete book
|
||||||
|
self.assertEqual(Book.search_count([]), 1)
|
||||||
|
self.assertEqual(
|
||||||
|
ValueStore.search_count([]),
|
||||||
|
len(Book.valuestore_fields()))
|
||||||
|
query = tab_book.delete(where=tab_book.id == book.id)
|
||||||
|
cursor.execute(*query)
|
||||||
|
self.assertEqual(Book.search_count([]), 0)
|
||||||
|
self.assertEqual(ValueStore.search_count([]), 0)
|
||||||
|
|
||||||
|
# end ValuestoreTestCase
|
|
@ -1,10 +1,11 @@
|
||||||
[tryton]
|
[tryton]
|
||||||
version=6.0.0
|
version=7.0.0
|
||||||
depends:
|
depends:
|
||||||
res
|
res
|
||||||
currency
|
currency
|
||||||
party
|
party
|
||||||
company
|
company
|
||||||
|
irrulecontext
|
||||||
xml:
|
xml:
|
||||||
icon.xml
|
icon.xml
|
||||||
group.xml
|
group.xml
|
||||||
|
@ -19,4 +20,6 @@ xml:
|
||||||
splitline.xml
|
splitline.xml
|
||||||
wizard_openline.xml
|
wizard_openline.xml
|
||||||
wizard_runreport.xml
|
wizard_runreport.xml
|
||||||
|
wizard_booking.xml
|
||||||
menu.xml
|
menu.xml
|
||||||
|
cron.xml
|
||||||
|
|
40
types.py
40
types.py
|
@ -3,8 +3,9 @@
|
||||||
# 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 ModelView, ModelSQL, fields, Unique
|
from trytond.model import ModelView, ModelSQL, fields, Unique, Index
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
|
from trytond.i18n import gettext
|
||||||
|
|
||||||
|
|
||||||
class Type(ModelSQL, ModelView):
|
class Type(ModelSQL, ModelView):
|
||||||
|
@ -13,8 +14,13 @@ class Type(ModelSQL, ModelView):
|
||||||
|
|
||||||
name = fields.Char(string='Name', required=True, translate=True)
|
name = fields.Char(string='Name', required=True, translate=True)
|
||||||
short = fields.Char(string='Abbreviation', required=True, size=3)
|
short = fields.Char(string='Abbreviation', required=True, size=3)
|
||||||
company = fields.Many2One(string='Company', model_name='company.company',
|
company = fields.Many2One(
|
||||||
|
string='Company', model_name='company.company',
|
||||||
required=True, ondelete="RESTRICT")
|
required=True, ondelete="RESTRICT")
|
||||||
|
feature = fields.Selection(
|
||||||
|
string='Feature', required=True,
|
||||||
|
selection='get_sel_feature',
|
||||||
|
help='Select feature set of the Cashbook.')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
|
@ -22,25 +28,43 @@ class Type(ModelSQL, ModelView):
|
||||||
cls._order.insert(0, ('name', 'ASC'))
|
cls._order.insert(0, ('name', 'ASC'))
|
||||||
t = cls.__table__()
|
t = cls.__table__()
|
||||||
cls._sql_constraints.extend([
|
cls._sql_constraints.extend([
|
||||||
('code_uniq', Unique(t, t.short), 'cashbook.msg_type_short_unique'),
|
('code_uniq',
|
||||||
|
Unique(t, t.short),
|
||||||
|
'cashbook.msg_type_short_unique'),
|
||||||
])
|
])
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.feature, Index.Equality())),
|
||||||
|
})
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_feature(cls):
|
||||||
|
""" default: general
|
||||||
|
"""
|
||||||
|
return 'gen'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_sel_feature(cls):
|
||||||
|
""" get feature-modes
|
||||||
|
"""
|
||||||
|
return [('gen', gettext('cashbook.msg_btype_general'))]
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
def get_rec_name(self, name):
|
||||||
""" short + name
|
""" short + name
|
||||||
"""
|
"""
|
||||||
return '%(short)s - %(name)s' % {
|
return '%(short)s - %(name)s' % {
|
||||||
'short': self.short or '-',
|
'short': self.short or '-',
|
||||||
'name': self.name or '-',
|
'name': self.name or '-'}
|
||||||
}
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def search_rec_name(cls, name, clause):
|
def search_rec_name(cls, name, clause):
|
||||||
""" search in name + short
|
""" search in name + short
|
||||||
"""
|
"""
|
||||||
return ['OR',
|
return [
|
||||||
|
'OR',
|
||||||
('name',) + tuple(clause[1:]),
|
('name',) + tuple(clause[1:]),
|
||||||
('short',) + tuple(clause[1:]),
|
('short',) + tuple(clause[1:])]
|
||||||
]
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
|
|
217
valuestore.py
Normal file
217
valuestore.py
Normal file
|
@ -0,0 +1,217 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
|
||||||
|
from sql.functions import CurrentTimestamp, DateTrunc
|
||||||
|
from sql.aggregate import Count
|
||||||
|
from sql.conditionals import Coalesce
|
||||||
|
from trytond.model import ModelSQL, fields, Unique, Index
|
||||||
|
from trytond.pool import Pool
|
||||||
|
from trytond.transaction import Transaction
|
||||||
|
from trytond.pyson import Eval, PYSON, PYSONEncoder, PYSONDecoder
|
||||||
|
from trytond.model.modelstorage import EvalEnvironment
|
||||||
|
from trytond.report import Report
|
||||||
|
|
||||||
|
|
||||||
|
class ValueStore(ModelSQL):
|
||||||
|
'Value Store'
|
||||||
|
__name__ = 'cashbook.values'
|
||||||
|
|
||||||
|
cashbook = fields.Many2One(
|
||||||
|
string='Cashbook', required=True, model_name='cashbook.book',
|
||||||
|
ondelete='CASCADE')
|
||||||
|
field_name = fields.Char(string='Field Name', required=True)
|
||||||
|
numvalue = fields.Numeric(
|
||||||
|
string='Value', digits=(16, Eval('valuedigits', 6)),
|
||||||
|
depends=['valuedigits'])
|
||||||
|
valuedigits = fields.Function(fields.Integer(
|
||||||
|
string='Digits', readonly=True),
|
||||||
|
'on_change_with_valuedigits')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __register__(cls, module_name):
|
||||||
|
super(ValueStore, cls).__register__(module_name)
|
||||||
|
|
||||||
|
# clear value-store, re-calc
|
||||||
|
records = cls.search([])
|
||||||
|
if records:
|
||||||
|
cls.delete(records)
|
||||||
|
cls.maintenance_values()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def __setup__(cls):
|
||||||
|
super(ValueStore, cls).__setup__()
|
||||||
|
t = cls.__table__()
|
||||||
|
cls._sql_constraints.extend([
|
||||||
|
('uniqu_field',
|
||||||
|
Unique(t, t.cashbook, t.field_name),
|
||||||
|
'cashbook.msg_value_exists_in_store'),
|
||||||
|
])
|
||||||
|
cls._sql_indexes.update({
|
||||||
|
Index(
|
||||||
|
t,
|
||||||
|
(t.field_name, Index.Equality())),
|
||||||
|
})
|
||||||
|
|
||||||
|
def get_rec_name(self, name):
|
||||||
|
""" name, balance, state
|
||||||
|
"""
|
||||||
|
return '|'.join([
|
||||||
|
'[' + getattr(self.cashbook, 'rec_name', '-') + ']',
|
||||||
|
self.field_name or '-',
|
||||||
|
Report.format_number(
|
||||||
|
self.numvalue,
|
||||||
|
None,
|
||||||
|
digits=self.valuedigits or 2)
|
||||||
|
if self.numvalue is not None else '-',
|
||||||
|
str(self.valuedigits) if self.valuedigits is not None else '-'])
|
||||||
|
|
||||||
|
@fields.depends('cashbook', 'field_name')
|
||||||
|
def on_change_with_valuedigits(self, name=None):
|
||||||
|
""" get digits by field name
|
||||||
|
"""
|
||||||
|
Cashbook = Pool().get('cashbook.book')
|
||||||
|
|
||||||
|
if self.cashbook and self.field_name:
|
||||||
|
fieldobj = Cashbook._fields.get(self.field_name, None)
|
||||||
|
if fieldobj:
|
||||||
|
digit = getattr(fieldobj, 'digits', (16, 6))[1]
|
||||||
|
if isinstance(digit, PYSON):
|
||||||
|
# execute pyson on linked record
|
||||||
|
digit = PYSONDecoder(
|
||||||
|
EvalEnvironment(self.cashbook, Cashbook)
|
||||||
|
).decode(PYSONEncoder().encode(digit))
|
||||||
|
return digit
|
||||||
|
return 6
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _maintenance_fields(cls):
|
||||||
|
""" list of model and fieldnames,
|
||||||
|
to daily update
|
||||||
|
"""
|
||||||
|
return ['balance']
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def maintenance_values(cls):
|
||||||
|
""" update values by cron
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Cashbook = pool.get('cashbook.book')
|
||||||
|
tab_val = cls.__table__()
|
||||||
|
tab_book = Cashbook.__table__()
|
||||||
|
cursor = Transaction().connection.cursor()
|
||||||
|
context = Transaction().context
|
||||||
|
|
||||||
|
# select records older than 'check_dt'
|
||||||
|
check_dt = context.get('maintenance_date', None)
|
||||||
|
if not check_dt:
|
||||||
|
check_dt = DateTrunc('day', CurrentTimestamp())
|
||||||
|
|
||||||
|
# select records to update
|
||||||
|
query = tab_val.select(
|
||||||
|
tab_val.id,
|
||||||
|
where=tab_val.field_name.in_(cls._maintenance_fields()) &
|
||||||
|
(DateTrunc('day', Coalesce(
|
||||||
|
tab_val.write_date,
|
||||||
|
tab_val.create_date,
|
||||||
|
'1990-01-01 00:00:00')) < check_dt))
|
||||||
|
cursor.execute(*query)
|
||||||
|
records = []
|
||||||
|
for x in cursor.fetchall():
|
||||||
|
cb = cls(x[0]).cashbook
|
||||||
|
if cb not in records:
|
||||||
|
records.append(cb)
|
||||||
|
|
||||||
|
# add records with missing fields in value-store
|
||||||
|
num_fields = len(Cashbook.valuestore_fields())
|
||||||
|
query = tab_book.join(
|
||||||
|
tab_val,
|
||||||
|
condition=tab_book.id == tab_val.cashbook,
|
||||||
|
type_='LEFT OUTER',
|
||||||
|
).select(
|
||||||
|
tab_book.id,
|
||||||
|
Count(tab_val.id).as_('num'),
|
||||||
|
group_by=[tab_book.id],
|
||||||
|
having=Count(tab_val.id) < num_fields)
|
||||||
|
cursor.execute(*query)
|
||||||
|
records.extend([Cashbook(x[0]) for x in cursor.fetchall()])
|
||||||
|
|
||||||
|
if records:
|
||||||
|
Cashbook.valuestore_update_records([x for x in records])
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_book_by_line(cls, records):
|
||||||
|
""" select books above current record to update
|
||||||
|
records: cashbook.line
|
||||||
|
"""
|
||||||
|
Book = Pool().get('cashbook.book')
|
||||||
|
|
||||||
|
to_update = []
|
||||||
|
if records:
|
||||||
|
books = Book.search([
|
||||||
|
('parent', 'parent_of', [x.cashbook.id for x in records])
|
||||||
|
])
|
||||||
|
to_update.extend([
|
||||||
|
x for x in books
|
||||||
|
if x not in to_update])
|
||||||
|
return to_update
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_book_by_books(cls, records):
|
||||||
|
""" select books above current record to update
|
||||||
|
records: cashbook.book
|
||||||
|
"""
|
||||||
|
Book = Pool().get('cashbook.book')
|
||||||
|
|
||||||
|
to_update = []
|
||||||
|
if records:
|
||||||
|
books = Book.search([
|
||||||
|
('parent', 'parent_of', [x.id for x in records])
|
||||||
|
])
|
||||||
|
to_update.extend([
|
||||||
|
x for x in books
|
||||||
|
if x not in to_update])
|
||||||
|
return to_update
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def update_books(cls, books):
|
||||||
|
""" get cashbooks to update, queue it
|
||||||
|
"""
|
||||||
|
Book = Pool().get('cashbook.book')
|
||||||
|
|
||||||
|
if books:
|
||||||
|
Book.__queue__.valuestore_update_records(books)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def update_values(cls, data):
|
||||||
|
""" data: {'fieldname': {id1: value, id2: value, ...}, ...}
|
||||||
|
"""
|
||||||
|
to_write = []
|
||||||
|
to_create = []
|
||||||
|
|
||||||
|
for name in data.keys():
|
||||||
|
for record_id in data[name].keys():
|
||||||
|
# get existing record
|
||||||
|
records = cls.search([
|
||||||
|
('cashbook', '=', record_id),
|
||||||
|
('field_name', '=', name)])
|
||||||
|
|
||||||
|
if records:
|
||||||
|
for record in records:
|
||||||
|
to_write.extend([
|
||||||
|
[record],
|
||||||
|
{'numvalue': data[name][record_id]}])
|
||||||
|
else:
|
||||||
|
to_create.append({
|
||||||
|
'cashbook': record_id,
|
||||||
|
'field_name': name,
|
||||||
|
'numvalue': data[name][record_id]})
|
||||||
|
|
||||||
|
if to_create:
|
||||||
|
cls.create(to_create)
|
||||||
|
if to_write:
|
||||||
|
cls.write(*to_write)
|
||||||
|
|
||||||
|
# end ValueStore
|
|
@ -1 +1 @@
|
||||||
|
irrulecontext;7.0.1;7.0.999;mds
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
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. -->
|
||||||
<form col="6">
|
<form col="4">
|
||||||
<label name="name"/>
|
<label name="name" xexpand="0"/>
|
||||||
<field name="name" colspan="3"/>
|
<field name="name" colspan="2"/>
|
||||||
<group id="grpst" colspan="2" col="3">
|
<group id="grpst" col="3">
|
||||||
<label name="state"/>
|
<label name="state"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<group id="grpstate" col="3">
|
<group id="grpstate" col="3">
|
||||||
|
@ -15,32 +15,49 @@ full copyright notices and license terms. -->
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
|
<label name="btype"/>
|
||||||
|
<field name="btype"/>
|
||||||
|
<newline/>
|
||||||
|
|
||||||
|
<notebook colspan="4">
|
||||||
|
<page name="balance" string="Balance" col="6">
|
||||||
|
<separator colspan="2" id="balance" string="Balance"/>
|
||||||
|
<newline/>
|
||||||
|
<label name="balance"/>
|
||||||
|
<field name="balance" symbol="currency"/>
|
||||||
|
<newline/>
|
||||||
|
<label name="balance_all"/>
|
||||||
|
<field name="balance_all" symbol="currency"/>
|
||||||
|
<newline/>
|
||||||
|
<label name="balance_ref"/>
|
||||||
|
<field name="balance_ref" symbol="company_currency"/>
|
||||||
|
</page>
|
||||||
|
<page name="reconciliations" string="Reconciliations" col="1">
|
||||||
|
<field name="reconciliations"/>
|
||||||
|
</page>
|
||||||
|
<page name="description" string="Description" col="1">
|
||||||
|
<field name="description"/>
|
||||||
|
</page>
|
||||||
|
<page id="pggeneral" string="General Information" col="4">
|
||||||
|
<label name="company"/>
|
||||||
|
<field name="company"/>
|
||||||
|
<label name="parent"/>
|
||||||
|
<field name="parent"/>
|
||||||
|
|
||||||
|
<label name="currency"/>
|
||||||
|
<field name="currency"/>
|
||||||
|
<newline/>
|
||||||
|
|
||||||
|
<field name="childs" colspan="4"/>
|
||||||
|
</page>
|
||||||
|
<page name="number_sequ" string="Amount and Numbering" col="4">
|
||||||
<label name="number_sequ"/>
|
<label name="number_sequ"/>
|
||||||
<field name="number_sequ"/>
|
<field name="number_sequ"/>
|
||||||
<label name="number_atcheck"/>
|
<label name="number_atcheck"/>
|
||||||
<field name="number_atcheck"/>
|
<field name="number_atcheck"/>
|
||||||
<newline/>
|
|
||||||
|
|
||||||
<label name="btype"/>
|
|
||||||
<field name="btype"/>
|
|
||||||
<label name="currency"/>
|
|
||||||
<field name="currency"/>
|
|
||||||
<newline/>
|
|
||||||
<label id="phaccount" colspan="2" string=" "/>
|
|
||||||
<newline/>
|
|
||||||
|
|
||||||
<label name="start_balance"/>
|
|
||||||
<field name="start_balance"/>
|
|
||||||
<label name="balance"/>
|
|
||||||
<field name="balance"/>
|
|
||||||
<newline/>
|
|
||||||
<label name="start_date"/>
|
<label name="start_date"/>
|
||||||
<field name="start_date"/>
|
<field name="start_date"/>
|
||||||
<newline/>
|
|
||||||
|
|
||||||
<notebook colspan="6">
|
|
||||||
<page id="pgrecon" string="Reconciliations" col="1">
|
|
||||||
<field name="reconciliations"/>
|
|
||||||
</page>
|
</page>
|
||||||
<page id="pgperm" string="Owner and Authorizeds" col="4">
|
<page id="pgperm" string="Owner and Authorizeds" col="4">
|
||||||
<label name="owner"/>
|
<label name="owner"/>
|
||||||
|
@ -54,4 +71,5 @@ full copyright notices and license terms. -->
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
|
|
||||||
|
<field name="feature"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -2,16 +2,10 @@
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
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. -->
|
||||||
<tree>
|
<tree keyword_open="1">
|
||||||
<field name="name"/>
|
<field name="rec_name" expand="1"/>
|
||||||
<field name="btype"/>
|
<field name="balance" sum="1" symbol="currency"/>
|
||||||
<field name="start_balance"/>
|
<field name="balance_all" symbol="currency" optional="1"/>
|
||||||
<field name="balance"/>
|
<field name="balance_ref" symbol="company_currency" optional="1"/>
|
||||||
<field name="currency"/>
|
<field name="state" optional="0"/>
|
||||||
<field name="owner"/>
|
|
||||||
<field name="reviewer"/>
|
|
||||||
<field name="observer"/>
|
|
||||||
<field name="state"/>
|
|
||||||
<button name="wfopen"/>
|
|
||||||
<button name="wfclosed"/>
|
|
||||||
</tree>
|
</tree>
|
||||||
|
|
13
view/book_tree.xml
Normal file
13
view/book_tree.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
|
The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
full copyright notices and license terms. -->
|
||||||
|
<tree keyword_open="1" tree_state="1">
|
||||||
|
<field name="name" expand="1"/>
|
||||||
|
<field name="balance" symbol="currency"/>
|
||||||
|
<field name="balance_all" symbol="currency" optional="1"/>
|
||||||
|
<field name="balance_ref" symbol="company_currency" optional="1"/>
|
||||||
|
<field name="state" optional="0"/>
|
||||||
|
<field name="parent" tree_invisible="1"/>
|
||||||
|
<field name="childs" tree_invisible="1"/>
|
||||||
|
</tree>
|
|
@ -2,20 +2,14 @@
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
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. -->
|
||||||
<form col="10">
|
<form col="8">
|
||||||
<label name="cashbook"/>
|
|
||||||
<field name="cashbook" widget="selection"/>
|
|
||||||
|
|
||||||
<label name="date_from"/>
|
<label name="date_from"/>
|
||||||
<field name="date_from"/>
|
<field name="date_from"/>
|
||||||
<label name="date_to"/>
|
<label name="date_to"/>
|
||||||
<field name="date_to"/>
|
<field name="date_to"/>
|
||||||
|
|
||||||
<label name="checked"/>
|
<label name="checked"/>
|
||||||
<field name="checked"/>
|
<field name="checked"/>
|
||||||
<label name="done"/>
|
<label name="done"/>
|
||||||
<field name="done"/>
|
<field name="done"/>
|
||||||
|
|
||||||
<field name="num_cashbook"/>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
|
@ -2,25 +2,22 @@
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
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. -->
|
||||||
<form col="6">
|
<form col="4">
|
||||||
<label name="name"/>
|
<label name="name"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<label name="cattype"/>
|
<label name="cattype"/>
|
||||||
<field name="cattype"/>
|
<field name="cattype"/>
|
||||||
<label id="phaccount" colspan="2" string=" "/>
|
|
||||||
|
|
||||||
<label name="description"/>
|
<label name="description"/>
|
||||||
<field name="description" colspan="5"/>
|
<field name="description" colspan="3"/>
|
||||||
|
|
||||||
<notebook colspan="6">
|
<notebook colspan="4">
|
||||||
<page string="General Information" id="general" col="6">
|
<page string="General Information" id="general" col="4">
|
||||||
<label name="company"/>
|
<label name="company"/>
|
||||||
<field name="company"/>
|
<field name="company"/>
|
||||||
<label name="parent"/>
|
<label name="parent"/>
|
||||||
<field name="parent"/>
|
<field name="parent"/>
|
||||||
<label name="sequence"/>
|
<field name="childs" colspan="4"/>
|
||||||
<field name="sequence"/>
|
|
||||||
<field name="childs" colspan="6"/>
|
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
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. -->
|
||||||
<tree sequence="sequence">
|
<tree>
|
||||||
<field name="rec_name"/>
|
<field name="rec_name"/>
|
||||||
<field name="cattype"/>
|
|
||||||
<field name="sequence" tree_invisible="1"/>
|
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
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. -->
|
||||||
<tree sequence="sequence">
|
<tree >
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="cattype"/>
|
|
||||||
<field name="sequence" tree_invisible="1"/>
|
|
||||||
<field name="parent" tree_invisible="1"/>
|
<field name="parent" tree_invisible="1"/>
|
||||||
<field name="childs" tree_invisible="1"/>
|
<field name="childs" tree_invisible="1"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -12,6 +12,26 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<label name="done"/>
|
<label name="done"/>
|
||||||
<field name="done"/>
|
<field name="done"/>
|
||||||
|
|
||||||
|
<separator id="sepenterbook" colspan="4" string="Enter Booking Wizard"/>
|
||||||
|
<label name="defbook"/>
|
||||||
|
<field name="defbook"/>
|
||||||
|
<label name="book1"/>
|
||||||
|
<field name="book1"/>
|
||||||
|
|
||||||
|
<label name="book2"/>
|
||||||
|
<field name="book2"/>
|
||||||
|
<label name="book3"/>
|
||||||
|
<field name="book3"/>
|
||||||
|
|
||||||
|
<label name="book4"/>
|
||||||
|
<field name="book4"/>
|
||||||
|
<label name="book5"/>
|
||||||
|
<field name="book5"/>
|
||||||
|
|
||||||
|
<label name="fixate"/>
|
||||||
|
<field name="fixate"/>
|
||||||
|
<newline/>
|
||||||
|
|
||||||
<separator id="sepcb" colspan="4" string="Cashbook"/>
|
<separator id="sepcb" colspan="4" string="Cashbook"/>
|
||||||
<label name="catnamelong"/>
|
<label name="catnamelong"/>
|
||||||
<field name="catnamelong"/>
|
<field name="catnamelong"/>
|
||||||
|
|
35
view/enterbooking_start_form.xml
Normal file
35
view/enterbooking_start_form.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
|
The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
full copyright notices and license terms. -->
|
||||||
|
<form col="2">
|
||||||
|
<label name="cashbook"/>
|
||||||
|
<field name="cashbook" widget="selection"/>
|
||||||
|
|
||||||
|
<notebook colspan="2">
|
||||||
|
<page id="general" string="Booking" col="2">
|
||||||
|
<label name="bookingtype"/>
|
||||||
|
<field name="bookingtype"/>
|
||||||
|
<label name="amount"/>
|
||||||
|
<field name="amount" symbol="currency"/>
|
||||||
|
<label name="category"/>
|
||||||
|
<field name="category"/>
|
||||||
|
<label name="booktransf"/>
|
||||||
|
<field name="booktransf"/>
|
||||||
|
<label name="party"/>
|
||||||
|
<field name="party"/>
|
||||||
|
</page>
|
||||||
|
<page id="descr" string="Description" col="1">
|
||||||
|
<field name="description"/>
|
||||||
|
</page>
|
||||||
|
<page name="fixate" col="2">
|
||||||
|
<label name="fixate"/>
|
||||||
|
<field name="fixate"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
|
||||||
|
<field name="cashbooks"/>
|
||||||
|
<field name="currency_digits"/>
|
||||||
|
<field name="currency"/>
|
||||||
|
<field name="owner_cashbook"/>
|
||||||
|
</form>
|
|
@ -34,8 +34,15 @@ full copyright notices and license terms. -->
|
||||||
<label name="category"/>
|
<label name="category"/>
|
||||||
<field name="category"/>
|
<field name="category"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
|
||||||
<label name="booktransf"/>
|
<label name="booktransf"/>
|
||||||
<field name="booktransf"/>
|
<field name="booktransf" colspan="3"/>
|
||||||
|
<newline/>
|
||||||
|
|
||||||
|
<label name="amount_2nd_currency"/>
|
||||||
|
<field name="amount_2nd_currency" symbol="currency2nd"/>
|
||||||
|
<label name="rate_2nd_currency"/>
|
||||||
|
<field name="rate_2nd_currency"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
|
||||||
<notebook colspan="6">
|
<notebook colspan="6">
|
||||||
|
@ -51,4 +58,6 @@ full copyright notices and license terms. -->
|
||||||
</notebook>
|
</notebook>
|
||||||
|
|
||||||
<field name="owner_cashbook"/>
|
<field name="owner_cashbook"/>
|
||||||
|
<field name="feature"/>
|
||||||
|
<field name="booktransf_feature"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -4,16 +4,14 @@ The COPYRIGHT file at the top level of this repository contains the
|
||||||
full copyright notices and license terms. -->
|
full copyright notices and license terms. -->
|
||||||
<tree>
|
<tree>
|
||||||
<field name="cashbook" tree_invisible="1"/>
|
<field name="cashbook" tree_invisible="1"/>
|
||||||
<field name="number"/>
|
<field name="number" optional="0"/>
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<field name="payee"/>
|
<field name="payee"/>
|
||||||
<field name="category_view"/>
|
<field name="category_view"/>
|
||||||
<field name="description" expand="1"/>
|
<field name="descr_short" expand="1"/>
|
||||||
<field name="credit" sum="Credit"/>
|
<field name="credit" sum="1" optional="0"/>
|
||||||
<field name="debit" sum="Debit"/>
|
<field name="debit" sum="1" optional="0"/>
|
||||||
<field name="balance"/>
|
<field name="balance" optional="0"/>
|
||||||
<field name="currency"/>
|
<field name="state" optional="0"/>
|
||||||
<field name="state"/>
|
|
||||||
<button name="wfedit"/>
|
|
||||||
<button name="wfcheck"/>
|
<button name="wfcheck"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
16
view/line_recon_list.xml
Normal file
16
view/line_recon_list.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
||||||
|
The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
full copyright notices and license terms. -->
|
||||||
|
<tree>
|
||||||
|
<field name="cashbook" tree_invisible="1"/>
|
||||||
|
<field name="number" optional="0"/>
|
||||||
|
<field name="date" optional="0"/>
|
||||||
|
<field name="payee" optional="0"/>
|
||||||
|
<field name="category_view" optional="0"/>
|
||||||
|
<field name="descr_short" expand="1" optional="0"/>
|
||||||
|
<field name="credit" sum="1" optional="0"/>
|
||||||
|
<field name="debit" sum="1" optional="0"/>
|
||||||
|
<field name="state" optional="0"/>
|
||||||
|
<button name="wfrecon"/>
|
||||||
|
</tree>
|
|
@ -23,13 +23,16 @@ full copyright notices and license terms. -->
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<label name="start_amount"/>
|
<label name="start_amount"/>
|
||||||
<field name="start_amount"/>
|
<field name="start_amount" symbol="currency"/>
|
||||||
<label name="end_amount"/>
|
<label name="end_amount"/>
|
||||||
<field name="end_amount"/>
|
<field name="end_amount" symbol="currency"/>
|
||||||
|
|
||||||
<label name="date"/>
|
<label name="date"/>
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
|
||||||
<field name="lines" colspan="6"/>
|
<field name="lines" colspan="6"
|
||||||
|
view_ids="cashbook.line_recon_view_list,cashbook.line_view_form"/>
|
||||||
|
|
||||||
|
<field name="feature"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -4,11 +4,11 @@ The COPYRIGHT file at the top level of this repository contains the
|
||||||
full copyright notices and license terms. -->
|
full copyright notices and license terms. -->
|
||||||
<tree>
|
<tree>
|
||||||
<field name="cashbook"/>
|
<field name="cashbook"/>
|
||||||
<field name="date"/>
|
<field name="date" optional="0"/>
|
||||||
<field name="date_from"/>
|
<field name="date_from" optional="0"/>
|
||||||
<field name="date_to"/>
|
<field name="date_to" optional="0"/>
|
||||||
<field name="start_amount"/>
|
<field name="start_amount" optional="0"/>
|
||||||
<field name="end_amount"/>
|
<field name="end_amount" optional="0"/>
|
||||||
<field name="lines"/>
|
<field name="lines" optional="0"/>
|
||||||
<field name="state"/>
|
<field name="state" optional="0"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -1,18 +1,31 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
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. -->
|
||||||
<form col="4">
|
<form col="4">
|
||||||
|
|
||||||
<label name="line"/>
|
<label name="line"/>
|
||||||
<field name="line" colspan="3"/>
|
<field name="line" colspan="5"/>
|
||||||
|
|
||||||
<label name="amount"/>
|
<label name="amount"/>
|
||||||
<field name="amount" symbol="currency"/>
|
<field name="amount" symbol="currency"/>
|
||||||
<label name="category"/>
|
<label name="splittype"/>
|
||||||
<field name="category"/>
|
<field name="splittype"/>
|
||||||
|
|
||||||
<group name="description" colspan="4" col="1" string="Description" yexpand="1">
|
<label name="category"/>
|
||||||
<field name="description" yfill="1"/>
|
<field name="category" colspan="3"/>
|
||||||
</group>
|
<label name="booktransf"/>
|
||||||
|
<field name="booktransf" colspan="3"/>
|
||||||
|
|
||||||
|
<label name="amount_2nd_currency"/>
|
||||||
|
<field name="amount_2nd_currency" symbol="currency2nd"/>
|
||||||
|
<label name="rate_2nd_currency"/>
|
||||||
|
<field name="rate_2nd_currency"/>
|
||||||
|
|
||||||
|
<notebook colspan="4">
|
||||||
|
<page name="description" col="1" string="Description">
|
||||||
|
<field name="description"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
<field name="feature"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
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. -->
|
||||||
<tree editable="1">
|
<tree editable="1">
|
||||||
<field name="line" tree_invisible="1"/>
|
<field name="line" tree_invisible="1"/>
|
||||||
|
<field name="feature" tree_invisible="1"/>
|
||||||
|
<field name="splittype"/>
|
||||||
<field name="category"/>
|
<field name="category"/>
|
||||||
<field name="description" expand="1"/>
|
<field name="booktransf"/>
|
||||||
<field name="amount" sum="Amount"/>
|
<field name="description" expand="1" optional="0"/>
|
||||||
<field name="currency"/>
|
<field name="amount" sum="1" symbol="currency" optional="0"/>
|
||||||
|
<field name="amount_2nd_currency" symbol="currency2nd" optional="0"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
@ -7,4 +7,8 @@ full copyright notices and license terms. -->
|
||||||
<field name="short"/>
|
<field name="short"/>
|
||||||
<label name="name"/>
|
<label name="name"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
|
||||||
|
<label name="feature"/>
|
||||||
|
<field name="feature"/>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -5,4 +5,5 @@ full copyright notices and license terms. -->
|
||||||
<tree>
|
<tree>
|
||||||
<field name="short"/>
|
<field name="short"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
<field name="feature"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
210
wizard_booking.py
Normal file
210
wizard_booking.py
Normal file
|
@ -0,0 +1,210 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
# The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
# full copyright notices and license terms.
|
||||||
|
|
||||||
|
from trytond.model import ModelView, fields
|
||||||
|
from trytond.wizard import Wizard, StateView, StateTransition, Button
|
||||||
|
from trytond.pool import Pool
|
||||||
|
from trytond.transaction import Transaction
|
||||||
|
from trytond.pyson import Eval, Bool, If, And
|
||||||
|
from decimal import Decimal
|
||||||
|
from .line import sel_bookingtype
|
||||||
|
|
||||||
|
sel_booktypewiz = [x for x in sel_bookingtype if not x[0] in ['spin', 'spout']]
|
||||||
|
|
||||||
|
|
||||||
|
class EnterBookingStart(ModelView):
|
||||||
|
'Enter Booking'
|
||||||
|
__name__ = 'cashbook.enterbooking.start'
|
||||||
|
|
||||||
|
cashbook = fields.Many2One(
|
||||||
|
string='Cashbook', model_name='cashbook.book',
|
||||||
|
domain=[('id', 'in', Eval('cashbooks', [])), ('btype', '!=', None)],
|
||||||
|
depends=['cashbooks'], required=True)
|
||||||
|
cashbooks = fields.One2Many(
|
||||||
|
string='Cashbooks', field=None,
|
||||||
|
model_name='cashbook.book', readonly=True,
|
||||||
|
states={'invisible': True})
|
||||||
|
owner_cashbook = fields.Function(fields.Many2One(
|
||||||
|
string='Owner', readonly=True,
|
||||||
|
states={'invisible': True}, model_name='res.user'),
|
||||||
|
'on_change_with_owner_cashbook')
|
||||||
|
currency = fields.Function(fields.Many2One(
|
||||||
|
string='Currency',
|
||||||
|
model_name='currency.currency', states={'invisible': True}),
|
||||||
|
'on_change_with_currency')
|
||||||
|
currency_digits = fields.Function(fields.Integer(
|
||||||
|
string='Currency Digits',
|
||||||
|
readonly=True, states={'invisible': True}),
|
||||||
|
'on_change_with_currency_digits')
|
||||||
|
bookingtype = fields.Selection(
|
||||||
|
string='Type', required=True, selection=sel_booktypewiz)
|
||||||
|
amount = fields.Numeric(
|
||||||
|
string='Amount',
|
||||||
|
depends=['currency_digits', 'bookingtype'],
|
||||||
|
digits=(16, Eval('currency_digits', 2)), required=True,
|
||||||
|
domain=[('amount', '>=', Decimal('0.0'))])
|
||||||
|
description = fields.Text(
|
||||||
|
string='Description', states={'required': Bool(Eval('fixate'))},
|
||||||
|
depends=['fixate'])
|
||||||
|
category = fields.Many2One(
|
||||||
|
string='Category',
|
||||||
|
model_name='cashbook.category', depends=['bookingtype'],
|
||||||
|
states={
|
||||||
|
'readonly': ~Bool(Eval('bookingtype')),
|
||||||
|
'required': Eval('bookingtype', '').in_(['in', 'out']),
|
||||||
|
'invisible': ~Eval('bookingtype', '').in_(['in', 'out']),
|
||||||
|
},
|
||||||
|
domain=[
|
||||||
|
If(
|
||||||
|
Eval('bookingtype', '').in_(['in', 'mvin']),
|
||||||
|
('cattype', '=', 'in'),
|
||||||
|
('cattype', '=', 'out'),
|
||||||
|
)])
|
||||||
|
fixate = fields.Boolean(
|
||||||
|
string='Fixate', help='The booking is fixed immediately.')
|
||||||
|
|
||||||
|
# party or cashbook as counterpart
|
||||||
|
booktransf = fields.Many2One(
|
||||||
|
string='Source/Dest',
|
||||||
|
model_name='cashbook.book',
|
||||||
|
domain=[
|
||||||
|
('owner.id', '=', Eval('owner_cashbook', -1)),
|
||||||
|
('id', '!=', Eval('cashbook', -1)),
|
||||||
|
],
|
||||||
|
states={
|
||||||
|
'invisible': ~Eval('bookingtype', '').in_(['mvin', 'mvout']),
|
||||||
|
'required': Eval('bookingtype', '').in_(['mvin', 'mvout']),
|
||||||
|
}, depends=['bookingtype', 'owner_cashbook', 'cashbook'])
|
||||||
|
party = fields.Many2One(
|
||||||
|
string='Party', model_name='party.party',
|
||||||
|
states={
|
||||||
|
'invisible': ~Eval('bookingtype', '').in_(['in', 'out']),
|
||||||
|
'required': And(
|
||||||
|
Bool(Eval('fixate')),
|
||||||
|
Eval('bookingtype', '').in_(['in', 'out']))},
|
||||||
|
depends=['bookingtype', 'fixate'])
|
||||||
|
|
||||||
|
@fields.depends('bookingtype', 'category')
|
||||||
|
def on_change_bookingtype(self):
|
||||||
|
""" clear category if not valid type
|
||||||
|
"""
|
||||||
|
types = {
|
||||||
|
'in': ['in', 'mvin'],
|
||||||
|
'out': ['out', 'mvout'],
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.bookingtype:
|
||||||
|
if self.category:
|
||||||
|
if self.bookingtype not in types.get(
|
||||||
|
self.category.cattype, ''):
|
||||||
|
self.category = None
|
||||||
|
|
||||||
|
@fields.depends('cashbook', '_parent_cashbook.owner')
|
||||||
|
def on_change_with_owner_cashbook(self, name=None):
|
||||||
|
""" get current owner
|
||||||
|
"""
|
||||||
|
if self.cashbook:
|
||||||
|
return self.cashbook.owner.id
|
||||||
|
|
||||||
|
@fields.depends('cashbook', '_parent_cashbook.currency')
|
||||||
|
def on_change_with_currency(self, name=None):
|
||||||
|
""" digits
|
||||||
|
"""
|
||||||
|
if self.cashbook:
|
||||||
|
return self.cashbook.currency.id
|
||||||
|
|
||||||
|
@fields.depends('cashbook', '_parent_cashbook.currency')
|
||||||
|
def on_change_with_currency_digits(self, name=None):
|
||||||
|
""" digits
|
||||||
|
"""
|
||||||
|
if self.cashbook:
|
||||||
|
return self.cashbook.currency.digits
|
||||||
|
else:
|
||||||
|
return 2
|
||||||
|
|
||||||
|
# end EnterBookingStart
|
||||||
|
|
||||||
|
|
||||||
|
class EnterBookingWizard(Wizard):
|
||||||
|
'Enter Booking'
|
||||||
|
__name__ = 'cashbook.enterbooking'
|
||||||
|
|
||||||
|
start_state = 'start'
|
||||||
|
start = StateView(
|
||||||
|
'cashbook.enterbooking.start',
|
||||||
|
'cashbook.enterbooking_start_form', [
|
||||||
|
Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
|
Button('Save', 'save_', 'tryton-save', default=True),
|
||||||
|
Button('Save & Next', 'savenext_', 'tryton-forward'),
|
||||||
|
])
|
||||||
|
save_ = StateTransition()
|
||||||
|
savenext_ = StateTransition()
|
||||||
|
|
||||||
|
def default_start(self, fields):
|
||||||
|
""" setup form
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Cashbook = pool.get('cashbook.book')
|
||||||
|
Configuration = pool.get('cashbook.configuration')
|
||||||
|
|
||||||
|
cfg1 = Configuration.get_singleton()
|
||||||
|
|
||||||
|
book_ids = []
|
||||||
|
for x in ['defbook', 'book1', 'book2', 'book3', 'book4', 'book5']:
|
||||||
|
if getattr(cfg1, x, None) is not None:
|
||||||
|
book_ids.append(getattr(cfg1, x, None).id)
|
||||||
|
|
||||||
|
result = {
|
||||||
|
'fixate': cfg1.fixate
|
||||||
|
if cfg1 and cfg1.fixate is not None else False,
|
||||||
|
'cashbooks': [x.id for x in Cashbook.search([
|
||||||
|
('state', '=', 'open'),
|
||||||
|
('btype', '!=', None),
|
||||||
|
('owner', '=', Transaction().user),
|
||||||
|
('id', 'in', book_ids),
|
||||||
|
])],
|
||||||
|
'bookingtype': getattr(self.start, 'bookingtype', 'out'),
|
||||||
|
'cashbook': getattr(getattr(cfg1, 'defbook', None), 'id', None),
|
||||||
|
'amount': None,
|
||||||
|
'party': None,
|
||||||
|
'booktransf': None,
|
||||||
|
'description': None,
|
||||||
|
'category': None,
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
|
||||||
|
def transition_save_(self):
|
||||||
|
""" store booking
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Line = pool.get('cashbook.line')
|
||||||
|
IrDate = pool.get('ir.date')
|
||||||
|
|
||||||
|
query = {
|
||||||
|
'cashbook': self.start.cashbook.id,
|
||||||
|
'description': self.start.description,
|
||||||
|
'date': IrDate.today(),
|
||||||
|
'bookingtype': self.start.bookingtype,
|
||||||
|
'amount': self.start.amount,
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.start.bookingtype in ['in', 'out']:
|
||||||
|
query['category'] = self.start.category.id
|
||||||
|
query['party'] = getattr(self.start.party, 'id', None)
|
||||||
|
elif self.start.bookingtype in ['mvin', 'mvout']:
|
||||||
|
query['booktransf'] = self.start.booktransf.id
|
||||||
|
|
||||||
|
lines = Line.create([query])
|
||||||
|
if self.start.fixate:
|
||||||
|
Line.wfcheck(lines)
|
||||||
|
return 'end'
|
||||||
|
|
||||||
|
def transition_savenext_(self):
|
||||||
|
""" store booking & restart
|
||||||
|
"""
|
||||||
|
self.transition_save_()
|
||||||
|
return 'start'
|
||||||
|
|
||||||
|
# end EnterBookingWizard
|
21
wizard_booking.xml
Normal file
21
wizard_booking.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
|
The COPYRIGHT file at the top level of this repository contains the
|
||||||
|
full copyright notices and license terms. -->
|
||||||
|
<tryton>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="enterbooking_start_form">
|
||||||
|
<field name="model">cashbook.enterbooking.start</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="name">enterbooking_start_form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- enter booking -->
|
||||||
|
<record model="ir.action.wizard" id="act_enterbooking_wiz">
|
||||||
|
<field name="name">Enter Booking</field>
|
||||||
|
<field name="wiz_name">cashbook.enterbooking</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</tryton>
|
|
@ -1,24 +1,55 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# This file is part of the cashbook-module from m-ds for Tryton.
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
# 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 ModelView, fields
|
from trytond.model import ModelView, fields
|
||||||
from trytond.pyson import PYSONEncoder
|
from trytond.pyson import PYSONEncoder
|
||||||
from trytond.wizard import Wizard, StateView, StateTransition, StateAction, Button
|
from trytond.wizard import Wizard, StateView, StateTransition, \
|
||||||
|
StateAction, Button
|
||||||
from trytond.i18n import gettext
|
from trytond.i18n import gettext
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
|
from trytond.exceptions import UserError
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
|
|
||||||
|
|
||||||
|
class OLineMixin:
|
||||||
|
""" mixin to extend action-data
|
||||||
|
"""
|
||||||
|
def add_action_data(self, book):
|
||||||
|
""" add book and cfg
|
||||||
|
"""
|
||||||
|
Configuration = Pool().get('cashbook.configuration')
|
||||||
|
cfg1 = Configuration.get_singleton()
|
||||||
|
action = {
|
||||||
|
'pyson_context': PYSONEncoder().encode({
|
||||||
|
'cashbook': getattr(book, 'id', None),
|
||||||
|
'date_from': getattr(cfg1, 'date_from', None),
|
||||||
|
'date_to': getattr(cfg1, 'date_to', None),
|
||||||
|
'checked': getattr(cfg1, 'checked', None),
|
||||||
|
'done': getattr(cfg1, 'done', None),
|
||||||
|
}),
|
||||||
|
'name': '%(name)s: %(cashbook)s' % {
|
||||||
|
'name': gettext('cashbook.msg_name_cashbook'),
|
||||||
|
'cashbook': getattr(book, 'rec_name', '-/-'),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return action
|
||||||
|
|
||||||
|
# OLineMixin
|
||||||
|
|
||||||
|
|
||||||
class OpenCashBookStart(ModelView):
|
class OpenCashBookStart(ModelView):
|
||||||
'Open Cashbook'
|
'Open Cashbook'
|
||||||
__name__ = 'cashbook.open_lines.start'
|
__name__ = 'cashbook.open_lines.start'
|
||||||
|
|
||||||
cashbook = fields.Many2One(string='Cashbook', model_name='cashbook.book',
|
cashbook = fields.Many2One(
|
||||||
required=True)
|
string='Cashbook', model_name='cashbook.book',
|
||||||
checked = fields.Boolean(string='Checked', help="Show cashbook lines in Checked-state.")
|
required=True, domain=[('btype', '!=', None)])
|
||||||
done = fields.Boolean(string='Done', help="Show cashbook lines in Done-state")
|
checked = fields.Boolean(
|
||||||
|
string='Checked', help="Show cashbook lines in Checked-state.")
|
||||||
|
done = fields.Boolean(
|
||||||
|
string='Done', help="Show cashbook lines in Done-state")
|
||||||
date_from = fields.Date(string='Start Date')
|
date_from = fields.Date(string='Start Date')
|
||||||
date_to = fields.Date(string='End Date')
|
date_to = fields.Date(string='End Date')
|
||||||
|
|
||||||
|
@ -33,18 +64,19 @@ class OpenCashBookStart(ModelView):
|
||||||
# end OpenCashBookStart
|
# end OpenCashBookStart
|
||||||
|
|
||||||
|
|
||||||
class OpenCashBook(Wizard):
|
class OpenCashBook(OLineMixin, Wizard):
|
||||||
'Open Cashbook'
|
'Open Cashbook'
|
||||||
__name__ = 'cashbook.open_lines'
|
__name__ = 'cashbook.open_lines'
|
||||||
|
|
||||||
start_state = 'check'
|
start_state = 'check'
|
||||||
check = StateTransition()
|
check = StateTransition()
|
||||||
askuser = StateView('cashbook.open_lines.start',
|
askuser = StateView(
|
||||||
|
'cashbook.open_lines.start',
|
||||||
'cashbook.open_lines_view_form', [
|
'cashbook.open_lines_view_form', [
|
||||||
Button('Cancel', 'end', 'tryton-cancel'),
|
Button('Cancel', 'end', 'tryton-cancel'),
|
||||||
Button('Open', 'open_', 'tryton-ok', default=True),
|
Button('Open', 'open_', 'tryton-ok', default=True),
|
||||||
])
|
])
|
||||||
open_ = StateAction('cashbook.act_line_view')
|
open_ = StateAction('cashbook.act_line_view2')
|
||||||
|
|
||||||
def transition_check(self):
|
def transition_check(self):
|
||||||
""" dont ask and open cashbook if user has 1x only
|
""" dont ask and open cashbook if user has 1x only
|
||||||
|
@ -52,9 +84,8 @@ class OpenCashBook(Wizard):
|
||||||
Book = Pool().get('cashbook.book')
|
Book = Pool().get('cashbook.book')
|
||||||
|
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'_check_access': True,
|
'_check_access': True}):
|
||||||
}):
|
books = Book.search([('btype', '!=', None)])
|
||||||
books = Book.search([])
|
|
||||||
if len(books) == 1:
|
if len(books) == 1:
|
||||||
return 'open_'
|
return 'open_'
|
||||||
return 'askuser'
|
return 'askuser'
|
||||||
|
@ -88,38 +119,59 @@ class OpenCashBook(Wizard):
|
||||||
book = getattr(self.askuser, 'cashbook', None)
|
book = getattr(self.askuser, 'cashbook', None)
|
||||||
if book is None:
|
if book is None:
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'_check_access': True,
|
'_check_access': True}):
|
||||||
}):
|
books = Book.search([('btype', '!=', None)])
|
||||||
books = Book.search([])
|
|
||||||
if len(books) > 0:
|
if len(books) > 0:
|
||||||
book = books[0]
|
book = books[0]
|
||||||
|
|
||||||
date_from = getattr(self.askuser, 'date_from', None)
|
|
||||||
date_to = getattr(self.askuser, 'date_to', None)
|
|
||||||
checked = getattr(self.askuser, 'checked', True)
|
|
||||||
done = getattr(self.askuser, 'done', False)
|
|
||||||
|
|
||||||
# save settings
|
# save settings
|
||||||
cfg1.date_from = date_from
|
cfg1.date_from = getattr(self.askuser, 'date_from', None)
|
||||||
cfg1.date_to = date_to
|
cfg1.date_to = getattr(self.askuser, 'date_to', None)
|
||||||
cfg1.checked = checked
|
cfg1.checked = getattr(self.askuser, 'checked', True)
|
||||||
cfg1.done = done
|
cfg1.done = getattr(self.askuser, 'done', False)
|
||||||
cfg1.save()
|
cfg1.save()
|
||||||
|
action.update(self.add_action_data(book))
|
||||||
action['pyson_context'] = PYSONEncoder().encode({
|
|
||||||
'cashbook': getattr(book, 'id', None),
|
|
||||||
'date_from': date_from,
|
|
||||||
'date_to': date_to,
|
|
||||||
'checked': checked,
|
|
||||||
'done': done,
|
|
||||||
})
|
|
||||||
action['name'] = '%(name)s: %(cashbook)s' % {
|
|
||||||
'name': gettext('cashbook.msg_name_cashbook'),
|
|
||||||
'cashbook': getattr(book, 'rec_name', '-/-'),
|
|
||||||
}
|
|
||||||
return action, {}
|
return action, {}
|
||||||
|
|
||||||
def transition_open_(self):
|
def transition_open_(self):
|
||||||
return 'end'
|
return 'end'
|
||||||
|
|
||||||
# end OpenCashBook
|
# end OpenCashBook
|
||||||
|
|
||||||
|
|
||||||
|
class OpenCashBookTree(OLineMixin, Wizard):
|
||||||
|
'Open Cashbook2'
|
||||||
|
__name__ = 'cashbook.open_lines_tree'
|
||||||
|
|
||||||
|
start_state = 'open_'
|
||||||
|
open_ = StateAction('cashbook.act_line_view2')
|
||||||
|
|
||||||
|
def do_open_(self, action):
|
||||||
|
""" open view from doubleclick
|
||||||
|
"""
|
||||||
|
pool = Pool()
|
||||||
|
Book = pool.get('cashbook.book')
|
||||||
|
Configuration = pool.get('cashbook.configuration')
|
||||||
|
|
||||||
|
cfg1 = Configuration.get_singleton()
|
||||||
|
if cfg1 is None:
|
||||||
|
cfg1 = Configuration()
|
||||||
|
cfg1.save()
|
||||||
|
|
||||||
|
book = self.record
|
||||||
|
if book is None:
|
||||||
|
with Transaction().set_context({
|
||||||
|
'_check_access': True}):
|
||||||
|
books = Book.search([('btype', '!=', None)])
|
||||||
|
if len(books) > 0:
|
||||||
|
book = books[0]
|
||||||
|
else:
|
||||||
|
if book.btype is None:
|
||||||
|
raise UserError(gettext(
|
||||||
|
'cashbook.msg_book_no_type_noopen',
|
||||||
|
bookname=book.rec_name))
|
||||||
|
|
||||||
|
action.update(self.add_action_data(book))
|
||||||
|
return action, {}
|
||||||
|
|
||||||
|
# end OpenCashBookTree
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
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. -->
|
||||||
<tryton>
|
<tryton>
|
||||||
|
@ -17,5 +17,24 @@ full copyright notices and license terms. -->
|
||||||
<field name="wiz_name">cashbook.open_lines</field>
|
<field name="wiz_name">cashbook.open_lines</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- open line view by double click at cashbook -->
|
||||||
|
<record model="ir.action.wizard" id="act_open_tree_lines">
|
||||||
|
<field name="name">Open Cashbook</field>
|
||||||
|
<field name="wiz_name">cashbook.open_lines_tree</field>
|
||||||
|
<field name="model">cashbook.book</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.action.keyword" id="act_open_tree_lines_keyword2">
|
||||||
|
<field name="keyword">form_action</field>
|
||||||
|
<field name="model">cashbook.book,-1</field>
|
||||||
|
<field name="action" ref="act_open_tree_lines"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.action.keyword" id="act_open_tree_lines_keyword3">
|
||||||
|
<field name="keyword">tree_open</field>
|
||||||
|
<field name="model">cashbook.book,-1</field>
|
||||||
|
<field name="action" ref="act_open_tree_lines"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# This file is part of the cashbook-module from m-ds for Tryton.
|
# This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
# 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 ModelView, fields
|
from trytond.model import ModelView, fields
|
||||||
from trytond.pyson import PYSONEncoder
|
from trytond.wizard import Wizard, StateView, StateReport, Button
|
||||||
from trytond.wizard import Wizard, StateView, StateTransition, StateReport, Button
|
|
||||||
from trytond.i18n import gettext
|
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.pyson import Eval, Bool
|
from trytond.pyson import Eval, Bool
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
|
@ -16,17 +14,21 @@ class RunCbReportStart(ModelView):
|
||||||
'Cashbook Report'
|
'Cashbook Report'
|
||||||
__name__ = 'cashbook.runrepbook.start'
|
__name__ = 'cashbook.runrepbook.start'
|
||||||
|
|
||||||
cashbook = fields.Many2One(string='Cashbook', required=True,
|
cashbook = fields.Many2One(
|
||||||
|
string='Cashbook', required=True,
|
||||||
model_name='cashbook.book', depends=['cashbooks'],
|
model_name='cashbook.book', depends=['cashbooks'],
|
||||||
domain=[('id', 'in', Eval('cashbooks', []))])
|
domain=[('id', 'in', Eval('cashbooks', []))])
|
||||||
cashbooks = fields.One2Many(string='Cashbooks', model_name='cashbook.book',
|
cashbooks = fields.One2Many(
|
||||||
|
string='Cashbooks', model_name='cashbook.book',
|
||||||
field=None, readonly=True, states={'invisible': True})
|
field=None, readonly=True, states={'invisible': True})
|
||||||
reconciliation = fields.Many2One(string='Reconciliation', required=True,
|
reconciliation = fields.Many2One(
|
||||||
|
string='Reconciliation', required=True,
|
||||||
model_name='cashbook.recon', depends=['reconciliations'],
|
model_name='cashbook.recon', depends=['reconciliations'],
|
||||||
states={
|
states={
|
||||||
'readonly': ~Bool(Eval('reconciliations')),
|
'readonly': ~Bool(Eval('reconciliations')),
|
||||||
}, domain=[('id', 'in', Eval('reconciliations', []))])
|
}, domain=[('id', 'in', Eval('reconciliations', []))])
|
||||||
reconciliations = fields.Function(fields.One2Many(string='Reconciliations',
|
reconciliations = fields.Function(fields.One2Many(
|
||||||
|
string='Reconciliations',
|
||||||
model_name='cashbook.recon', field=None, readonly=True,
|
model_name='cashbook.recon', field=None, readonly=True,
|
||||||
states={'invisible': True}),
|
states={'invisible': True}),
|
||||||
'on_change_with_reconciliations')
|
'on_change_with_reconciliations')
|
||||||
|
@ -53,7 +55,7 @@ class RunCbReportStart(ModelView):
|
||||||
|
|
||||||
if self.cashbook:
|
if self.cashbook:
|
||||||
recons = Recon2.search([
|
recons = Recon2.search([
|
||||||
('cashbook.id', '=', self.cashbook.id),
|
('cashbook', '=', self.cashbook.id),
|
||||||
], order=[('date_from', 'DESC')])
|
], order=[('date_from', 'DESC')])
|
||||||
return [x.id for x in recons]
|
return [x.id for x in recons]
|
||||||
|
|
||||||
|
@ -65,14 +67,14 @@ class RunCbReport(Wizard):
|
||||||
__name__ = 'cashbook.runrepbook'
|
__name__ = 'cashbook.runrepbook'
|
||||||
|
|
||||||
start_state = 'selrecon'
|
start_state = 'selrecon'
|
||||||
selrecon = StateView('cashbook.runrepbook.start',
|
selrecon = StateView(
|
||||||
|
'cashbook.runrepbook.start',
|
||||||
'cashbook.runrepbook_view_form', [
|
'cashbook.runrepbook_view_form', [
|
||||||
Button(string='Cancel', state='end', icon='tryton-cancel'),
|
Button(string='Cancel', state='end', icon='tryton-cancel'),
|
||||||
Button(string='Report', state='report_', icon='tryton-ok', default=True,
|
Button(
|
||||||
states={
|
string='Report', state='report_', icon='tryton-ok',
|
||||||
'readonly': ~Bool(Eval('reconciliation')),
|
default=True,
|
||||||
}),
|
states={'readonly': ~Bool(Eval('reconciliation'))})])
|
||||||
])
|
|
||||||
report_ = StateReport('cashbook.reprecon')
|
report_ = StateReport('cashbook.reprecon')
|
||||||
|
|
||||||
def default_selrecon(self, fields):
|
def default_selrecon(self, fields):
|
||||||
|
@ -92,8 +94,7 @@ class RunCbReport(Wizard):
|
||||||
raise ValueError('invalid model')
|
raise ValueError('invalid model')
|
||||||
|
|
||||||
with Transaction().set_context({
|
with Transaction().set_context({
|
||||||
'_check_access': True,
|
'_check_access': True}):
|
||||||
}):
|
|
||||||
books = Book.search([])
|
books = Book.search([])
|
||||||
result['cashbooks'] = [x.id for x in books]
|
result['cashbooks'] = [x.id for x in books]
|
||||||
|
|
||||||
|
@ -102,7 +103,7 @@ class RunCbReport(Wizard):
|
||||||
result['cashbook'] = result['cashbooks'][0]
|
result['cashbook'] = result['cashbooks'][0]
|
||||||
|
|
||||||
recons = Recon2.search([
|
recons = Recon2.search([
|
||||||
('cashbook.id', '=', result['cashbook']),
|
('cashbook', '=', result['cashbook']),
|
||||||
], order=[('date_from', 'DESC')])
|
], order=[('date_from', 'DESC')])
|
||||||
if len(recons) > 0:
|
if len(recons) > 0:
|
||||||
result['reconciliations'] = [x.id for x in recons]
|
result['reconciliations'] = [x.id for x in recons]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!-- This file is part of the cashbook-module from m-ds for Tryton.
|
<!-- This file is part of the cashbook-module from m-ds.de for Tryton.
|
||||||
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. -->
|
||||||
<tryton>
|
<tryton>
|
||||||
|
|
Loading…
Reference in a new issue