Merge new root

This commit is contained in:
Cédric Krier
2022-12-16 21:09:17 +01:00
10636 changed files with 1623866 additions and 0 deletions
+78
View File
@@ -0,0 +1,78 @@
clone:
hg:
image: plugins/hg
environment:
- HG_SHARE_POOL=/root/.cache/hg
volumes:
- cache:/root/.cache
pipeline:
tox:
image: ${IMAGE}
environment:
- CFLAGS=-O0
- DB_CACHE=/cache
- TOX_TESTENV_PASSENV=CFLAGS DB_CACHE CI_BUILD_NUMBER CI_JOB_NUMBER CI_JOB_ID
- POSTGRESQL_URI=postgresql://postgres@postgresql:5432/
commands:
- echo "[extensions]" >> /root/.hgrc
- echo "hgext.share =" >> /root/.hgrc
- echo "[share]" >> /root/.hgrc
- echo "pool = /root/.cache/hg" >> /root/.hgrc
- pip install tox
- tox -e "${TOXENV}-${DATABASE}"
volumes:
- cache:/root/.cache
check_dist:
image: ${IMAGE}
commands:
- pip install twine
- python setup.py sdist
- twine check dist/*
volumes:
- cache:/root/.cache
check_doc:
image: ${IMAGE}
commands:
- pip install sphinx
- python -m sphinx -T -E -W -n -b html doc _build/html
- python -m sphinx -T -E -W -n -b linkcheck doc _build
volumes:
- cache:/root/.cache
services:
postgresql:
image: postgres
environment:
- POSTGRES_HOST_AUTH_METHOD=trust
command: "-c fsync=off -c synchronous_commit=off -c full_page_writes=off"
when:
matrix:
DATABASE: postgresql
matrix:
include:
- IMAGE: python:3.7
TOXENV: py37
DATABASE: sqlite
- IMAGE: python:3.7
TOXENV: py37
DATABASE: postgresql
- IMAGE: python:3.8
TOXENV: py38
DATABASE: sqlite
- IMAGE: python:3.8
TOXENV: py38
DATABASE: postgresql
- IMAGE: python:3.9
TOXENV: py39
DATABASE: sqlite
- IMAGE: python:3.9
TOXENV: py39
DATABASE: postgresql
- IMAGE: python:3.10
TOXENV: py310
DATABASE: sqlite
- IMAGE: python:3.10
TOXENV: py310
DATABASE: postgresql
+2
View File
@@ -0,0 +1,2 @@
[flake8]
ignore=E123,E124,E126,E128,E741,W503
+3
View File
@@ -0,0 +1,3 @@
[settings]
multi_line_output=4
known_first_party=trytond
+212
View File
@@ -0,0 +1,212 @@
Version 6.6.0 - 2022-10-31
--------------------------
* Bug fixes (see mercurial logs for details)
* Support alternative payees on invoice
Version 6.4.0 - 2022-05-02
--------------------------
* Bug fixes (see mercurial logs for details)
* Use invoice date to enforce sequence on customer invoice
* Prevent delete tax identifier used on invoice
* Raise a warning when validating supplier invoice with same reference
* Add support for Python 3.10
* Remove support for Python 3.6
Version 6.2.0 - 2021-11-01
--------------------------
* Bug fixes (see mercurial logs for details)
* Add warning to prevent posting invoices in the future
* Add wizard to reschedule lines to pay of invoices
* Create base tax line for manual taxes
Version 6.0.0 - 2021-05-03
--------------------------
* Bug fixes (see mercurial logs for details)
* Allow using debt accounts on supplier invoices
* Add deductible rate of taxes to supplier invoice
* Add method to post invoices by batch
* Add payment term date in invoice
* Raise warning on invoice with maturity dates on the past
* Remove foreign key for sequence of Invoice
* Add summary to invoice line list
* Add default customer payment term configuration
Version 5.8.0 - 2020-11-02
--------------------------
* Bug fixes (see mercurial logs for details)
* Remove support for Python 3.5
* Add domain to invoice's journal
* Add optional taxes date on invoice line
* Convert Invoice.update_taxes into dualmethod
* Rename invoice state from cancel to cancelled
Version 5.6.0 - 2020-05-04
--------------------------
* Bug fixes (see mercurial logs for details)
* Allow overpaying invoice
* Show lines to pay on invoice form
* Add invoice date on credit wizard
* Take lines without maturity date as payable
Version 5.4.0 - 2019-11-04
--------------------------
* Bug fixes (see mercurial logs for details)
* Prevent using same sequence on earlier customer invoice
* Update invoice sequence name in renew fiscal year
* Add option to cancel customer invoice
Version 5.2.0 - 2019-05-06
--------------------------
* Bug fixes (see mercurial logs for details)
* Show reconciliation lines as payment lines
* Fill in origin of move line
* Remove partial payment when cancel
* Set cancel state when credit with refund
Version 5.0.0 - 2018-10-01
--------------------------
* Bug fixes (see mercurial logs for details)
* Use accounting date to format invoice number
* Add invoice payment method
* Show number and reference in invoice rec_name
* Remove support for Python 2.7
* Use today as fallback for invoice date report
Version 4.8.0 - 2018-04-23
--------------------------
* Bug fixes (see mercurial logs for details)
* Show invoice payment on Move Line
* Remove payment lines which actually do not pay the Invoice
* Ensure payment lines are linked to only one Invoice
* Ensure payments on Invoice does not exceed invoice amount
* Add methods to add and remove payments on Invoice
* Check pending invoice to erase party
* Add invoice usage to party's contact mechanisms
* Show reconciled date on invoice
* Make description on invoice line optional
Version 4.6.0 - 2017-10-30
--------------------------
* Bug fixes (see mercurial logs for details)
* Use tax sequence as default value for invoice taxes sequence
* Add party tax identifier on invoice
Version 4.4.0 - 2017-05-01
--------------------------
* Bug fixes (see mercurial logs for details)
* Use Match pattern for invoice sequences
Version 4.2.0 - 2016-11-28
--------------------------
* Bug fixes (see mercurial logs for details)
* Add tax identifier on invoice
* Rename Invoice.create_move to get_move
* Rename InvoiceLine and InvoiceTax get_move_line to get_move_lines
* Change Invoice.set_number into classmethod
* Return original amount sign on fixed payment terms
* Add configuration option to store invoice report cache in filestore
* Manage readonly state on Invoice Line and Tax Line
* Rename account.invoice.payment_term.line.relativedelta
into account.invoice.payment_term.line.delta
* Make payment term not required
Version 4.0.0 - 2016-05-02
--------------------------
* Bug fixes (see mercurial logs for details)
* Merge invoice and credit note
* Inversed sign of tax report from credit note
* Move tax Rounding configuration to account
* Add Python3 support
* Change payment term percentage into ratio
Version 3.8.0 - 2015-11-02
--------------------------
* Bug fixes (see mercurial logs for details)
* Don't set default unit price on invoice line
* Allow to modify some fields of posted invoice line
Version 3.6.0 - 2015-04-20
--------------------------
* Bug fixes (see mercurial logs for details)
* Add support for PyPy
* Allow to define many relativedelta on payment term
* Add test wizard for payment term
* Use TaxableMixin
Version 3.4.0 - 2014-10-20
--------------------------
* Bug fixes (see mercurial logs for details)
* Add Tax rounding configuration
Version 3.2.0 - 2014-04-21
--------------------------
* Bug fixes (see mercurial logs for details)
* Use account of write-off journal as default
Version 3.0.0 - 2013-10-21
--------------------------
* Bug fixes (see mercurial logs for details)
* Use account move as cache
Version 2.8.0 - 2013-04-22
--------------------------
* Bug fixes (see mercurial logs for details)
* Add origin Reference on Invoice Line
* Prevent refund of supplier invoice/credit note
* Make period's invoice sequences optional and use fiscal year's ones if empty
* Cancel state delete or cancel existing move on Invoice
* Create draft move for Supplier Invoice when validated
* Rename Invoice Proforma state into Validated
* Rename Invoice Opened state into Posted
Version 2.6.0 - 2012-10-22
--------------------------
* Bug fixes (see mercurial logs for details)
Version 2.4.0 - 2012-04-23
--------------------------
* Bug fixes (see mercurial logs for details)
* Add divisor field to Payment Term Lines
* Allow setting months, weeks, days as well as month, weekday and day in
Payment Term Lines
* Rename field payment_term to customer_payment_term
Version 2.2.0 - 2011-10-24
--------------------------
* Bug fixes (see mercurial logs for details)
Version 2.0.0 - 2011-04-27
--------------------------
* Bug fixes (see mercurial logs for details)
* Add field currency_date to set the date for the rate calculation
* Change get_move_line on Invoice Line and Tax to return a list of values
instead of values
Version 1.8.0 - 2010-11-01
--------------------------
* Bug fixes (see mercurial logs for details)
Version 1.6.0 - 2010-05-13
--------------------------
* Bug fixes (see mercurial logs for details)
* Add default search value on invoice
* Remove egenix-mx-base and replace it by python-dateutil
Version 1.4.0 - 2009-10-19
--------------------------
* Bug fixes (see mercurial logs for details)
* Set invoice date when invoice is opened
* Add invoice number to report name
Version 1.2.0 - 2009-04-20
--------------------------
* Bug fixes (see mercurial logs for details)
* Add accounting date on invoice
* Use amount_to_pay if amount_to_pay_today is zero in pay invoice wizard
* Use reference to taxes for invoice line in invoice report
* Add mechanism for invoice line standalone
* Allow egg installation
Version 1.0.0 - 2008-11-17
--------------------------
* Initial release
+17
View File
@@ -0,0 +1,17 @@
Copyright (C) 2008-2022 Cédric Krier.
Copyright (C) 2008-2013 Bertrand Chenal.
Copyright (C) 2008-2022 B2CK SPRL.
Copyright (C) 2004-2008 Tiny SPRL.
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
View 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>.
+6
View File
@@ -0,0 +1,6 @@
include CHANGELOG
include COPYRIGHT
include LICENSE
include README.rst
include icons/LICENSE
graft doc
+1
View File
@@ -0,0 +1 @@
doc/index.rst
+57
View File
@@ -0,0 +1,57 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
from . import account, company, invoice, party, payment_term
def register():
Pool.register(
payment_term.PaymentTerm,
payment_term.PaymentTermLine,
payment_term.PaymentTermLineRelativeDelta,
payment_term.TestPaymentTermView,
payment_term.TestPaymentTermViewResult,
invoice.Invoice,
invoice.InvoiceAdditionalMove,
invoice.AlternativePayee,
invoice.InvoicePaymentLine,
invoice.InvoiceLine,
invoice.InvoiceLineTax,
invoice.InvoiceTax,
invoice.PayInvoiceStart,
invoice.PayInvoiceAsk,
invoice.CreditInvoiceStart,
party.Address,
party.ContactMechanism,
party.Party,
party.PartyPaymentTerm,
account.Configuration,
account.ConfigurationDefaultPaymentTerm,
account.InvoiceSequence,
# Match pattern migration fallbacks to Fiscalyear values so Period
# must be registered before Fiscalyear
account.Period,
account.FiscalYear,
account.Move,
account.MoveLine,
account.Reconciliation,
invoice.PaymentMethod,
company.Company,
module='account_invoice', type_='model')
Pool.register(
payment_term.TestPaymentTerm,
invoice.PayInvoice,
invoice.CreditInvoice,
invoice.RescheduleLinesToPay,
invoice.DelegateLinesToPay,
party.Replace,
party.Erase,
account.RenewFiscalYear,
account.RescheduleLines,
account.DelegateLines,
module='account_invoice', type_='wizard')
Pool.register(
invoice.InvoiceReport,
module='account_invoice', type_='report')
+463
View File
@@ -0,0 +1,463 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from collections import OrderedDict
from sql import Literal
from sql.conditionals import Coalesce
from trytond.i18n import gettext
from trytond.model import (
MatchMixin, ModelSQL, ModelView, Workflow, fields, sequence_ordered)
from trytond.modules.account.exceptions import ClosePeriodError
from trytond.modules.company.model import CompanyValueMixin
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Bool, Eval, Id, If
from trytond.tools import grouped_slice
from trytond.transaction import Transaction
class Configuration(metaclass=PoolMeta):
__name__ = 'account.configuration'
default_customer_payment_term = fields.MultiValue(
fields.Many2One(
'account.invoice.payment_term', "Default Customer Payment Term"))
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field in 'default_customer_payment_term':
return pool.get('account.configuration.default_payment_term')
return super().multivalue_model(field)
class ConfigurationDefaultPaymentTerm(ModelSQL, CompanyValueMixin):
"Account Configuration Default Payment Term"
__name__ = 'account.configuration.default_payment_term'
default_customer_payment_term = fields.Many2One(
'account.invoice.payment_term', "Default Customer Payment Term")
class FiscalYear(metaclass=PoolMeta):
__name__ = 'account.fiscalyear'
invoice_sequences = fields.One2Many(
'account.fiscalyear.invoice_sequence', 'fiscalyear',
"Invoice Sequences",
domain=[
('company', '=', Eval('company', -1)),
])
@classmethod
def __register__(cls, module_name):
pool = Pool()
Sequence = pool.get('account.fiscalyear.invoice_sequence')
sequence = Sequence.__table__()
sql_table = cls.__table__()
super(FiscalYear, cls).__register__(module_name)
cursor = Transaction().connection.cursor()
table = cls.__table_handler__(module_name)
# Migration from 4.2: Use Match pattern for sequences
if (table.column_exist('in_invoice_sequence')
and table.column_exist('in_credit_note_sequence')
and table.column_exist('out_invoice_sequence')
and table.column_exist('out_credit_note_sequence')):
cursor.execute(*sequence.insert(columns=[
sequence.sequence, sequence.fiscalyear,
sequence.company,
sequence.out_invoice_sequence,
sequence.out_credit_note_sequence,
sequence.in_invoice_sequence,
sequence.in_credit_note_sequence],
values=sql_table.select(
Literal(20), sql_table.id,
sql_table.company,
sql_table.out_invoice_sequence,
sql_table.out_credit_note_sequence,
sql_table.in_invoice_sequence,
sql_table.in_credit_note_sequence)))
table.drop_column('out_invoice_sequence')
table.drop_column('out_credit_note_sequence')
table.drop_column('in_invoice_sequence')
table.drop_column('in_credit_note_sequence')
@staticmethod
def default_invoice_sequences():
if Transaction().user == 0:
return []
return [{}]
class Period(metaclass=PoolMeta):
__name__ = 'account.period'
@classmethod
def __register__(cls, module_name):
pool = Pool()
Sequence = pool.get('account.fiscalyear.invoice_sequence')
FiscalYear = pool.get('account.fiscalyear')
sequence = Sequence.__table__()
fiscalyear = FiscalYear.__table__()
sql_table = cls.__table__()
super(Period, cls).__register__(module_name)
cursor = Transaction().connection.cursor()
table = cls.__table_handler__(module_name)
# Migration from 4.2: Use Match pattern for sequences
if (table.column_exist('in_invoice_sequence')
and table.column_exist('in_credit_note_sequence')
and table.column_exist('out_invoice_sequence')
and table.column_exist('out_credit_note_sequence')):
cursor.execute(*sequence.insert(columns=[
sequence.sequence, sequence.fiscalyear,
sequence.company, sequence.period,
sequence.out_invoice_sequence,
sequence.out_credit_note_sequence,
sequence.in_invoice_sequence,
sequence.in_credit_note_sequence],
values=sql_table.join(fiscalyear,
condition=(fiscalyear.id == sql_table.fiscalyear)
).select(
Literal(10), sql_table.fiscalyear,
fiscalyear.company, sql_table.id,
Coalesce(sql_table.out_invoice_sequence,
fiscalyear.out_invoice_sequence),
Coalesce(sql_table.out_credit_note_sequence,
fiscalyear.out_credit_note_sequence),
Coalesce(sql_table.in_invoice_sequence,
fiscalyear.in_invoice_sequence),
Coalesce(sql_table.in_credit_note_sequence,
fiscalyear.in_credit_note_sequence))))
table.drop_column('out_invoice_sequence')
table.drop_column('out_credit_note_sequence')
table.drop_column('in_invoice_sequence')
table.drop_column('in_credit_note_sequence')
@classmethod
@ModelView.button
@Workflow.transition('close')
def close(cls, periods):
pool = Pool()
Invoice = pool.get('account.invoice')
company_ids = list({p.company.id for p in periods})
invoices = Invoice.search([
('company', 'in', company_ids),
('state', '=', 'posted'),
('move', '=', None),
])
if invoices:
names = ', '.join(i.rec_name for i in invoices[:5])
if len(invoices) > 5:
names += '...'
raise ClosePeriodError(
gettext('account_invoice.msg_close_period_non_posted_invoices',
invoices=names))
super().close(periods)
class InvoiceSequence(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
'Invoice Sequence'
__name__ = 'account.fiscalyear.invoice_sequence'
company = fields.Many2One('company.company', "Company", required=True)
fiscalyear = fields.Many2One(
'account.fiscalyear', "Fiscal Year", required=True, ondelete='CASCADE',
domain=[
('company', '=', Eval('company', -1)),
])
period = fields.Many2One('account.period', 'Period',
domain=[
('fiscalyear', '=', Eval('fiscalyear')),
('type', '=', 'standard'),
])
in_invoice_sequence = fields.Many2One('ir.sequence.strict',
'Supplier Invoice Sequence', required=True,
domain=[
('sequence_type', '=',
Id('account_invoice', 'sequence_type_account_invoice')),
('company', '=', Eval('company')),
])
in_credit_note_sequence = fields.Many2One('ir.sequence.strict',
'Supplier Credit Note Sequence', required=True,
domain=[
('sequence_type', '=',
Id('account_invoice', 'sequence_type_account_invoice')),
('company', '=', Eval('company')),
])
out_invoice_sequence = fields.Many2One('ir.sequence.strict',
'Customer Invoice Sequence', required=True,
domain=[
('sequence_type', '=',
Id('account_invoice', 'sequence_type_account_invoice')),
('company', '=', Eval('company')),
])
out_credit_note_sequence = fields.Many2One('ir.sequence.strict',
'Customer Credit Note Sequence', required=True,
domain=[
('sequence_type', '=',
Id('account_invoice', 'sequence_type_account_invoice')),
('company', '=', Eval('company')),
])
@classmethod
def __setup__(cls):
super(InvoiceSequence, cls).__setup__()
cls._order.insert(0, ('fiscalyear', 'ASC'))
@classmethod
def default_company(cls):
return Transaction().context.get('company')
class Move(metaclass=PoolMeta):
__name__ = 'account.move'
@classmethod
def _get_origin(cls):
return super(Move, cls)._get_origin() + ['account.invoice']
class MoveLine(metaclass=PoolMeta):
__name__ = 'account.move.line'
invoice_payment = fields.Function(fields.Many2One(
'account.invoice', "Invoice Payment",
domain=[
('account', '=', Eval('account', -1)),
If(Bool(Eval('party')),
('party', '=', Eval('party')),
(),
),
],
states={
'invisible': Bool(Eval('reconciliation')),
}),
'get_invoice_payment',
setter='set_invoice_payment',
searcher='search_invoice_payment')
invoice_payments = fields.Many2Many(
'account.invoice-account.move.line', 'line', 'invoice',
"Invoice Payments", readonly=True)
@classmethod
def __setup__(cls):
super(MoveLine, cls).__setup__()
cls._check_modify_exclude.add('invoice_payment')
@classmethod
def _view_reconciliation_muted(cls):
pool = Pool()
ModelData = pool.get('ir.model.data')
muted = super()._view_reconciliation_muted()
muted.add(ModelData.get_id(
'account_invoice', 'move_line_view_list_to_pay'))
return muted
@classmethod
def _get_origin(cls):
return super()._get_origin() + [
'account.invoice.line', 'account.invoice.tax']
@classmethod
def copy(cls, lines, default=None):
default = {} if default is None else default.copy()
default.setdefault('invoice_payments', None)
return super().copy(lines, default=default)
@classmethod
def get_invoice_payment(cls, lines, name):
pool = Pool()
InvoicePaymentLine = pool.get('account.invoice-account.move.line')
ids = list(map(int, lines))
result = dict.fromkeys(ids, None)
for sub_ids in grouped_slice(ids):
payment_lines = InvoicePaymentLine.search([
('line', 'in', list(sub_ids)),
])
result.update({p.line.id: p.invoice.id for p in payment_lines})
return result
@classmethod
def set_invoice_payment(cls, lines, name, value):
pool = Pool()
Invoice = pool.get('account.invoice')
Invoice.remove_payment_lines(lines)
if value:
Invoice.add_payment_lines({Invoice(value): lines})
@classmethod
def search_invoice_payment(cls, name, domain):
return [('invoice_payments',) + tuple(domain[1:])]
@property
def product(self):
pool = Pool()
InvoiceLine = pool.get('account.invoice.line')
product = super().product
if (isinstance(self.origin, InvoiceLine)
and self.origin.product):
product = self.origin.product
return product
def _invoices_to_process(reconciliations):
pool = Pool()
Reconciliation = pool.get('account.move.reconciliation')
Invoice = pool.get('account.invoice')
move_ids = set()
others = set()
for reconciliation in reconciliations:
for line in reconciliation.lines:
move_ids.add(line.move.id)
others.update(line.reconciliations_delegated)
invoices = set()
for sub_ids in grouped_slice(move_ids):
sub_ids = list(sub_ids)
invoices.update(Invoice.search(['OR',
('move', 'in', sub_ids),
('additional_moves', 'in', sub_ids),
]))
if others:
invoices.update(_invoices_to_process(Reconciliation.browse(others)))
return invoices
class Reconciliation(metaclass=PoolMeta):
__name__ = 'account.move.reconciliation'
@classmethod
def create(cls, vlist):
Invoice = Pool().get('account.invoice')
transaction = Transaction()
context = transaction.context
reconciliations = super(Reconciliation, cls).create(vlist)
with transaction.set_context(
queue_batch=context.get('queue_batch', True)):
Invoice.__queue__.process(
list(_invoices_to_process(reconciliations)))
return reconciliations
@classmethod
def delete(cls, reconciliations):
Invoice = Pool().get('account.invoice')
transaction = Transaction()
context = transaction.context
invoices_to_process = _invoices_to_process(reconciliations)
super(Reconciliation, cls).delete(reconciliations)
with transaction.set_context(
queue_batch=context.get('queue_batch', True)):
Invoice.__queue__.process(list(invoices_to_process))
class RenewFiscalYear(metaclass=PoolMeta):
__name__ = 'account.fiscalyear.renew'
def fiscalyear_defaults(self):
defaults = super(RenewFiscalYear, self).fiscalyear_defaults()
defaults['invoice_sequences'] = None
return defaults
@property
def invoice_sequence_fields(self):
return ['out_invoice_sequence', 'out_credit_note_sequence',
'in_invoice_sequence', 'in_credit_note_sequence']
def create_fiscalyear(self):
pool = Pool()
Sequence = pool.get('ir.sequence.strict')
InvoiceSequence = pool.get('account.fiscalyear.invoice_sequence')
fiscalyear = super(RenewFiscalYear, self).create_fiscalyear()
def standard_period(period):
return period.type == 'standard'
period_mapping = {}
for previous, new in zip(
filter(
standard_period, self.start.previous_fiscalyear.periods),
filter(standard_period, fiscalyear.periods)):
period_mapping[previous] = new.id
InvoiceSequence.copy(
self.start.previous_fiscalyear.invoice_sequences,
default={
'fiscalyear': fiscalyear.id,
'period': lambda data: period_mapping.get(data['period']),
})
if not self.start.reset_sequences:
return fiscalyear
sequences = OrderedDict()
for invoice_sequence in fiscalyear.invoice_sequences:
for field in self.invoice_sequence_fields:
sequence = getattr(invoice_sequence, field, None)
sequences[sequence.id] = sequence
copies = Sequence.copy(list(sequences.values()), default={
'next_number': 1,
'name': lambda data: data['name'].replace(
self.start.previous_fiscalyear.name,
self.start.name)
})
mapping = {}
for previous_id, new_sequence in zip(sequences.keys(), copies):
mapping[previous_id] = new_sequence.id
to_write = []
for new_sequence, old_sequence in zip(
fiscalyear.invoice_sequences,
self.start.previous_fiscalyear.invoice_sequences):
values = {}
for field in self.invoice_sequence_fields:
sequence = getattr(old_sequence, field, None)
values[field] = mapping[sequence.id]
to_write.extend(([new_sequence], values))
if to_write:
InvoiceSequence.write(*to_write)
return fiscalyear
class RescheduleLines(metaclass=PoolMeta):
__name__ = 'account.move.line.reschedule'
@classmethod
def reschedule_lines(cls, lines, journal, terms):
pool = Pool()
Invoice = pool.get('account.invoice')
move, balance_line = super().reschedule_lines(lines, journal, terms)
move_ids = list({l.move.id for l in lines})
invoices = Invoice.search(['OR',
('move', 'in', move_ids),
('additional_moves', 'in', move_ids),
])
Invoice.write(invoices, {
'additional_moves': [('add', [move.id])],
})
return move, balance_line
class DelegateLines(metaclass=PoolMeta):
__name__ = 'account.move.line.delegate'
@classmethod
def delegate_lines(cls, lines, party, journal, date=None):
pool = Pool()
Invoice = pool.get('account.invoice')
move = super().delegate_lines(lines, party, journal, date=None)
move_ids = list({l.move.id for l in lines})
invoices = Invoice.search(['OR',
('move', 'in', move_ids),
('additional_moves', 'in', move_ids),
])
Invoice.write(invoices, {
'alternative_payees': [('add', [party.id])],
'additional_moves': [('add', [move.id])],
})
return move
+111
View File
@@ -0,0 +1,111 @@
<?xml version="1.0"?>
<!-- This file is part of 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.icon" id="invoice_icon">
<field name="name">tryton-invoice</field>
<field name="path">icons/tryton-invoice.svg</field>
</record>
<record model="ir.ui.view" id="configuration_view_form">
<field name="model">account.configuration</field>
<field name="inherit" ref="account.configuration_view_form"/>
<field name="name">configuration_form</field>
</record>
<record model="ir.ui.view" id="fiscalyear_view_form">
<field name="model">account.fiscalyear</field>
<field name="inherit" ref="account.fiscalyear_view_form"/>
<field name="name">fiscalyear_form</field>
</record>
<record model="ir.ui.view" id="move_line_view_form">
<field name="model">account.move.line</field>
<field name="inherit" ref="account.move_line_view_form"/>
<field name="name">move_line_form</field>
</record>
<record model="ir.ui.view" id="move_line_view_form_move">
<field name="model">account.move.line</field>
<field name="inherit" ref="account.move_line_view_form_move"/>
<field name="name">move_line_form</field>
</record>
<record model="ir.ui.view" id="move_line_view_list">
<field name="model">account.move.line</field>
<field name="inherit" ref="account.move_line_view_tree"/>
<field name="name">move_line_list</field>
</record>
<record model="ir.ui.view" id="move_line_view_list_move">
<field name="model">account.move.line</field>
<field name="inherit" ref="account.move_line_view_tree_move"/>
<field name="name">move_line_list</field>
</record>
<record model="ir.ui.view" id="move_line_view_list_payment">
<field name="model">account.move.line</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="name">move_line_list_payment</field>
</record>
<record model="ir.ui.view" id="move_line_view_list_to_pay">
<field name="model">account.move.line</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="name">move_line_list_to_pay</field>
</record>
<record model="ir.ui.view" id="invoice_sequence_view_form">
<field name="model">account.fiscalyear.invoice_sequence</field>
<field name="type">form</field>
<field name="name">invoice_sequence_form</field>
</record>
<record model="ir.ui.view" id="invoice_sequence_view_list">
<field name="model">account.fiscalyear.invoice_sequence</field>
<field name="type">tree</field>
<field name="name">invoice_sequence_list</field>
</record>
<record model="ir.ui.view" id="invoice_sequence_view_list_sequence">
<field name="model">account.fiscalyear.invoice_sequence</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="name">invoice_sequence_list_sequence</field>
</record>
<record model="ir.model.access" id="access_invoice_sequence">
<field name="model"
search="[('model', '=', 'account.fiscalyear.invoice_sequence')]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_invoice_sequence_admin">
<field name="model"
search="[('model', '=', 'account.fiscalyear.invoice_sequence')]"/>
<field name="group" ref="account.group_account_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.rule.group" id="rule_group_invoice_sequence_companies">
<field name="name">User in companies</field>
<field name="model"
search="[('model', '=', 'account.fiscalyear.invoice_sequence')]"/>
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_invoice_sequence_companies">
<field name="domain"
eval="[('company', 'in', Eval('companies', []))]"
pyson="1"/>
<field name="rule_group" ref="rule_group_invoice_sequence_companies"/>
</record>
</data>
</tryton>
+23
View File
@@ -0,0 +1,23 @@
# This file is part of 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.pool import PoolMeta
class Company(metaclass=PoolMeta):
__name__ = 'company.company'
purchase_taxes_expense = fields.Boolean(
"Purchase Taxes as Expense",
help="Check to book purchase taxes as expense.")
cancel_invoice_out = fields.Boolean(
"Cancel Customer Invoice",
help="Allow cancelling move of customer invoice.")
@classmethod
def default_purchase_taxes_expense(cls):
return False
@classmethod
def default_cancel_invoice_out(cls):
return False
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- This file is part of 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="company_view_form">
<field name="model">company.company</field>
<field name="inherit" ref="company.company_view_form"/>
<field name="name">company_form</field>
</record>
</data>
</tryton>
+61
View File
@@ -0,0 +1,61 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
modules_url = 'https://docs.tryton.org/projects/modules-{module}/en/{series}/'
trytond_url = 'https://docs.tryton.org/projects/server/en/{series}/'
def get_info():
import configparser
import os
import subprocess
import sys
module_dir = os.path.dirname(os.path.dirname(__file__))
config = configparser.ConfigParser()
config.read_file(open(os.path.join(module_dir, 'tryton.cfg')))
info = dict(config.items('tryton'))
result = subprocess.run(
[sys.executable, 'setup.py', '--name'],
stdout=subprocess.PIPE, check=True, cwd=module_dir)
info['name'] = result.stdout.decode('utf-8').strip()
result = subprocess.run(
[sys.executable, 'setup.py', '--version'],
stdout=subprocess.PIPE, check=True, cwd=module_dir)
version = result.stdout.decode('utf-8').strip()
if 'dev' in version:
info['series'] = 'latest'
else:
info['series'] = '.'.join(version.split('.', 2)[:2])
for key in {'depends', 'extras_depend'}:
info[key] = info.get(key, '').strip().splitlines()
info['modules'] = set(info['depends'] + info['extras_depend'])
info['modules'] -= {'ir', 'res'}
return info
info = get_info()
master_doc = 'index'
project = info['name']
release = version = info['series']
default_role = 'ref'
highlight_language = 'none'
extensions = [
'sphinx.ext.intersphinx',
]
intersphinx_mapping = {
'trytond': (trytond_url.format(series=version), None),
}
intersphinx_mapping.update({
m: (modules_url.format(
module=m.replace('_', '-'), series=version), None)
for m in info['modules']
})
del get_info, info, modules_url, trytond_url
@@ -0,0 +1,28 @@
*************
Configuration
*************
The *Account Invoice Module* uses some settings from the ``[account_invoice]``
section of the :doc:`configuration file <trytond:topics/configuration>`.
.. _config-account_invoice.filestore:
``filestore``
=============
This configuration value indicates whether the cached copy of the
`Customer Invoice Reports <report-account.invoice>` should be stored in the
:py:mod:`trytond:trytond.filestore` (``True``) or the database (``False``).
The default value is: ``False``
.. _config-account_invoice.store_prefix:
``store_prefix``
================
This is the prefix to use with the :py:mod:`trytond:trytond.filestore`.
This value is only used when the
`filestore <config-account_invoice.filestore>` setting is in use.
The default value is: ``None``
+208
View File
@@ -0,0 +1,208 @@
Design
******
The *Account Invoice Module* adds some new concepts and extends some existing
concepts.
.. _model-account.invoice:
Invoice
=======
The main concept introduced by the *Account Invoice Module* is the *Invoice*.
This contains details of a purchase, or sales, transaction between the
`Company <company:model-company.company>` and another
`Party <party:model-party.party>`.
Each invoice has a type that indicates whether it is an invoice from a
supplier, or to a customer.
Credit notes are represented by invoices with negative totals.
Additional information is also stored for each invoice, including things like
a unique `Sequence <model-account.fiscalyear.invoice_sequence>` number,
invoice, accounting and payment term dates,
`Payment Terms <model-account.invoice.payment_term>`,
`Tax Identifiers <party:model-party.identifier>`,
`Currency <currency:model-currency.currency>` information,
the customer's or supplier's invoice `Address <party:model-party.address>`,
and other descriptions and reference numbers.
An invoice is made up from one, or more, invoice lines.
Most lines normally contain information about the items that were bought or
sold, including information about the `Products <product:concept-product>`,
quantities, `Taxes <account:model-account.tax>` and prices that make up the
transaction.
There are also some types of line that add other information like titles,
descriptions or subtotals.
The taxes that are included on an invoice are calculated from the tax
amounts for each of the invoice's lines.
These amounts are rounded at either the line or invoice level depending on the
setting in the `Account Configuration <account:model-account.configuration>`.
Additional taxes can be manually added to the invoice when required.
It is also possible to change calculated tax amounts, although these changes
get overwritten if the invoice's tax amounts get recalculated.
For supplier invoice it is possible to define per line the deductible rate of
the taxes.
When an invoice is processed an `Account Move <account:model-account.move>` is
automatically created for it.
This account move records the transaction represented by the invoice and
places the total in the specified payable or receivable
`Account <account:model-account.account>`.
.. note::
For customer invoices the `Invoice Report <report-account.invoice>` is
generated and stored at the point when the invoice is posted.
.. seealso::
Customer invoices and credit notes can be seen by opening the main menu
item:
|Financial --> Invoices --> Customer Invoices|__
.. |Financial --> Invoices --> Customer Invoices| replace:: :menuselection:`Financial --> Invoices --> Customer Invoices`
__ https://demo.tryton.org/model/account.invoice;domain=[["type"%2C"%3D"%2C"out"]]
Supplier invoices and credit note are available from the main menu item:
|Financial --> Invoices --> Supplier Invoices|__
.. |Financial --> Invoices --> Supplier Invoices| replace:: :menuselection:`Financial --> Invoices --> Supplier Invoices`
__ https://demo.tryton.org/model/account.invoice;domain=[["type"%2C"%3D"%2C"in"]]
Wizards
-------
.. _wizard-account.invoice.pay:
Pay Invoice
^^^^^^^^^^^
The *Pay Invoice* wizard allows a cash payment for an invoice to be registered
against the invoice.
It uses the values from an
`Invoice Payment Method <model-account.invoice.payment.method>` when creating
the `Account Move <account:model-account.move>`.
The wizard supports partial payments, and can also be used to write-off some
of the invoice amount.
.. _wizard-account.invoice.credit:
Credit Invoice
^^^^^^^^^^^^^^
The *Credit Invoice* wizard enables a credit note to be raised for the
selected invoices.
For customer invoices that are posted, the wizard allows the invoice to be
credited with a refund.
When this is done the credit note is automatically posted and the invoice is
cancelled.
.. _wizard-account.invoice.lines_to_pay.reschedule:
Reschedule Lines to Pay
^^^^^^^^^^^^^^^^^^^^^^^
The *Reschedule Lines to Pay* wizard allows to modify the payment terms of the
remaining lines to pay using the `Reschedule Lines
<wizard-account.move.line.reschedule>` wizard.
Reports
-------
.. _report-account.invoice:
Invoice
^^^^^^^
The *Invoice* report is used to output a hard copy of the invoice or credit
note.
It includes all the information that is needed in order to send the document
to a customer or supplier.
.. _model-account.invoice.payment.method:
Invoice Payment Method
======================
The concept of an *Invoice Payment Method* brings together an
`Account Journal <account:model-account.journal>`,
a debit `Account <account:model-account.account>` and a credit account.
This is normally used during the `Pay Invoice <wizard-account.invoice.pay>`
wizard.
.. seealso::
Invoice payment methods can be found using the main menu item:
|Financial --> Configuration --> Journals --> Invoice Payment Methods|__
.. |Financial --> Configuration --> Journals --> Invoice Payment Methods| replace:: :menuselection:`Financial --> Configuration --> Journals --> Invoice Payment Methods`
__ https://demo.tryton.org/model/account.invoice.payment.method
.. _model-account.fiscalyear.invoice_sequence:
Fiscal Year Invoice Sequence
============================
The *Fiscal Year Invoice Sequence* concept allows a set of *Sequences* to be
defined for use with `Invoices <model-account.invoice>`.
It allows different sequences to be used for each of the different types of
invoices and credit notes.
It also allows the use of different sequences for each accounting
`Period <account:model-account.period>`.
.. seealso::
The fiscal year sequences are defined in the
`Fiscal Year <account:model-account.fiscalyear>`.
.. _model-account.invoice.payment_term:
Payment Term
============
The *Payment Term* stores the method that is used to calculate an
`Invoice's <model-account.invoice>` payment due dates.
An invoice may be due for payment in full on a particular day, or may become
due for payment over time in parts.
To allow for this each payment term is made up of one or more lines.
Each line defines an amount that should be paid, and when that payment is
expected.
The amounts can be defined as either fixed amounts, percentages, or a
remainder.
.. seealso::
Payment terms are create and managed from the main menu item:
|Financial --> Configuration --> Payment Terms --> Payment Terms|__
.. |Financial --> Configuration --> Payment Terms --> Payment Terms| replace:: :menuselection:`Financial --> Configuration --> Payment Terms --> Payment Terms`
__ https://demo.tryton.org/model/account.invoice.payment_term
Wizards
-------
.. _wizard-account.invoice.payment_term.test:
Test Payment Term
^^^^^^^^^^^^^^^^^
The *Test Payment Term* wizard shows how a specific invoice amount is
broken down for a particular
`Payment Term <model-account.invoice.payment_term>`.
It allows a date and an amount to be entered and then calculates the due dates
and amounts for each payment that will be required for that payment term.
.. seealso::
Payment terms can be tested out by opening the main menu item:
:menuselection:`Financial --> Configuration --> Payment Terms --> Test Payment Term`
+15
View File
@@ -0,0 +1,15 @@
######################
Account Invoice Module
######################
The *Account Invoice Module* adds the concept of invoicing to Tryton.
It allows the creation of customer and supplier invoices, and can handle the
payment terms related to the invoices and show when they have been paid.
.. toctree::
:maxdepth: 2
usage/index
configuration
design
releases
+7
View File
@@ -0,0 +1,7 @@
.. _releases-index:
=============
Release notes
=============
.. include:: ../CHANGELOG
@@ -0,0 +1,57 @@
.. _Correcting invoices:
Correcting invoices
===================
`Invoices <model-account.invoice>` can only be changed when they are in a
draft state.
Once an invoice has been posted you will need to
`credit it <Crediting customers and suppliers>`, and reissue it by creating
a new invoice with the correct information on.
.. tip::
If you need to create a new invoice that is almost the same as an existing
invoice you can use the :guilabel:`Duplicate` item from the form's menu to
copy the existing invoice.
The duplicate invoice will be created in a draft state, so you can change
anything that was incorrect.
.. _Cancelling invoices:
Cancelling invoices
===================
Most `Invoices <model-account.invoice>` can be cancelled up to the point they
are paid.
Once they are paid you need to credit them instead.
You do this by `creating a credit note <Crediting customers and suppliers>`
for them.
.. note::
Legislation may not allow you to cancel a posted customer invoice.
If this is the case, then you should instead create a credit note for it.
You can allow posted invoices to be credited by changing the setting in your
`Company <company:model-company.company>`.
Cancelling an invoice removes its effect on your accounts by either removing
its `Account Move <account:model-account.move>`, or negating it with a
cancelling move.
.. _Crediting customers and suppliers:
Crediting customers and suppliers
=================================
In Tryton you credit customers and suppliers by creating *Credit Notes*.
These are just `Invoices <model-account.invoice>` with negative totals.
You can create a credit note manually or create one based on an existing
invoice.
To credit existing invoices you must first select the invoices that need to
be credited.
Next you run the `Credit <wizard-account.invoice.credit>` invoice wizard from
the :guilabel:`Launch action` menu.
@@ -0,0 +1,13 @@
*****
Usage
*****
Customer and supplier invoices can be found under the
:menuselection:`Financial --> Invoices` menu item.
.. toctree::
:maxdepth: 1
prepare
process
amend
@@ -0,0 +1,105 @@
.. _Setting a party's invoice address:
Setting a party's invoice address
=================================
Tryton lets you mark which `Addresses <party:model-party.address>`, and
also `Contact Mechanisms <party:model-party.contact_mechanism>`, should be
used with `Invoices <model-account.invoice>`.
.. tip::
If you don't set an invoice addresses or contact mechanisms, then the
party's first address or contact mechanism is used.
.. _Setting default accounts:
Setting default accounts
========================
Receivable and payable
^^^^^^^^^^^^^^^^^^^^^^
You can set the default receivable and payable
`Accounts <account:model-account.account>` that are used for the invoice
totals, for customers and suppliers respectively, in the
`Account Configuration <account:model-account.configuration>`.
A `Party <party:model-party.party>` can override these default accounts
and normally allows you to set which accounts you want to use with that party.
Revenue and Expense
^^^^^^^^^^^^^^^^^^^
The default revenue and expense accounts for the
`Products <product:concept-product>` that appear on the invoice's lines are
also set in the *Account Configuration*.
These default accounts are used unless the product overrides them.
Normally this is done by setting the revenue and expense accounts in the
product's `Account Category <account_product:model-product.category>`.
Tax
^^^
The accounts that are used for any `Taxes <account:model-account.tax>` are set
on the taxes themselves.
.. _Creating payment terms:
Creating payment terms
======================
Any `Payment Term <model-account.invoice.payment_term>` that you want to use
must be created before you can use them.
You can do this at the point where you need to use them, or beforehand.
The payment term defines when payment for an `Invoice <model-account.invoice>`
is expected.
Each part of a payment term allows you specify an amount and a date by adding
months, weeks and days to the invoice date, and also setting a day of the
month, month of the year, or day of the week that the payment is due.
This calculation is done using |python-dateutil's relativedeltas|__.
.. |python-dateutil's relativedeltas| replace:: python-dateutil's ``relativedeltas``
__ https://dateutil.readthedocs.io/en/stable/relativedelta.html
One payment term that is sometimes used is "30 Days", this means you expect
payment 30 days after the date on the invoice.
In Tryton you would set this up by creating a payment term like this::
Name: 30 Days
Line 1:
Type: Remainder
Number of Days: 30
You may want to request payment at the end of the month that the invoice
was raised in, you can do this with::
Name: End Of Month
Line 1:
Type: Remainder
Day of Month: 31
You can also define payment terms in which the payment is expected in stages.
For example, to require a fixed amount of 100 immediately, then 50% of what
is left after 7 days and the remaining amount after 14 days you would use::
Name: Payment in Stages
Line 1:
Type: Fixed
Amount: 100
Number of Days: 0
Line 2:
Type: Percentage on Remainder
Ratio: 50%
Number of Days: 7
Line 3:
Type: Remainder
Number of Days: 14
.. tip::
For complex payment terms if you want to check what dates and amounts
it will generate you can try it out using the
`Test Payment Term <wizard-account.invoice.payment_term.test>` wizard.
@@ -0,0 +1,104 @@
.. _Invoicing customers:
Invoicing customers
===================
If your `Company <company:model-company.company>` has sold some things and
you want to issue an invoice to the customer, then in Tryton you need to
create a customer `Invoice <model-account.invoice>`.
.. tip::
Tryton provides additional modules that can be used to automatically create
customer invoices.
These modules normally create draft invoices for you with almost all the
data already filled in.
If you need to manually create a new customer `Invoice <model-account.invoice>`
you will need to enter in a few details such as the name of the
`Party <party:model-party.party>`, the
`Currency <currency:model-currency.currency>` and the lines that make up the
invoice.
Most of the other fields are optional or have sensible default values.
.. tip::
If the invoice you want to create is almost the same as an existing
invoice then you can use the :guilabel:`Duplicate` item from the form's
menu to avoid creating it from scratch.
You should post the invoice before you issue it to your customer.
Once the invoice has been posted the `Invoice report <report-account.invoice>`
can be printed out or saved, and sent to your customer.
.. tip::
The *Invoice report* generates a *Pro forma invoice* for invoices that are
validated, but not yet posted.
.. tip::
The *Invoice report* is saved for posted customer invoices.
This means that every time you print it you will get an identical copy
of it.
.. _Handling supplier invoices:
Handling supplier invoices
==========================
Supplier `Invoices <model-account.invoice>` are issued to your
`Company <company:model-company.company>` by a supplier for things that you
purchase.
For each invoice that you receive you need a new supplier invoice in Tryton.
.. tip::
Tryton provides additional modules that automatically create, or help
create, supplier invoices.
If you are using these modules then the supplier invoices or invoice lines
are often automatically created for you.
.. tip::
If the invoice you want to create is almost the same as an existing
invoice then you can use the :guilabel:`Duplicate` item from the form's
menu to avoid creating it from scratch.
Once you have created, or found, the supplier invoice on Tryton you should
check that it matches the one provided by the supplier.
If you see any differences due to the way the taxes have been calculated
then these can be fixed once all the lines are entered.
You can do this by manually changing the tax amounts on the supplier invoice
on Tryton.
When you are happy the supplier invoice is correct, and it matches the one
on Tryton you can post it.
.. _Paying an invoice:
Paying an invoice
=================
Each `Invoice <model-account.invoice>` tracks how much still needs to be paid.
Once an invoice has been fully paid it automatically updates its state to
indicate that it is now paid.
If you are manually registering payments against invoices, then you can use
the invoice's :guilabel:`Pay` button to run the
`Pay Invoice <wizard-account.invoice.pay>` wizard and register a cash payment
against the invoice.
When doing this you will need to have already setup an appropriate
`Invoice Payment Method <model-account.invoice.payment.method>`.
This then makes it easy to use consistent
`Journals <account:model-account.journal>` and
`Accounts <account:model-account.account>` when manually entering payments.
.. note::
Some of the other accounting modules allow you to automatically register
payments against invoices.
So, if you are using those modules you will not normally need to do this
manually.
+45
View File
@@ -0,0 +1,45 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.exceptions import UserError, UserWarning
from trytond.model.exceptions import ValidationError
class PaymentTermValidationError(ValidationError):
pass
class PaymentTermComputeError(UserError):
pass
class InvoiceTaxValidationError(ValidationError):
pass
class InvoiceNumberError(ValidationError):
pass
class InvoiceValidationError(ValidationError):
pass
class InvoiceLineValidationError(ValidationError):
pass
class PayInvoiceError(UserError):
pass
class InvoicePaymentTermDateWarning(UserWarning):
pass
class InvoiceFutureWarning(UserWarning):
pass
class InvoiceSimilarWarning(UserWarning):
pass
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24"><path d="M18 17H6v-2h12v2zm0-4H6v-2h12v2zm0-4H6V7h12v2zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2v20z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 356 B

+998
View File
@@ -0,0 +1,998 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta><meta:generator>LibreOffice/6.0.3.2$Linux_X86_64 LibreOffice_project/00m0$Build-2</meta:generator><meta:creation-date>2012-11-15T15:00:35</meta:creation-date><meta:editing-cycles>1</meta:editing-cycles><meta:editing-duration>P0D</meta:editing-duration><meta:document-statistic meta:table-count="5" meta:image-count="0" meta:object-count="0" meta:page-count="6" meta:paragraph-count="116" meta:word-count="308" meta:character-count="3548" meta:non-whitespace-character-count="3356"/><meta:user-defined meta:name="Info 1"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/><meta:user-defined meta:name="Info 4"/></office:meta>
<office:settings>
<config:config-item-set config:name="ooo:view-settings">
<config:config-item config:name="ViewAreaTop" config:type="long">27940</config:config-item>
<config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
<config:config-item config:name="ViewAreaWidth" config:type="long">54700</config:config-item>
<config:config-item config:name="ViewAreaHeight" config:type="long">27571</config:config-item>
<config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
<config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
<config:config-item-map-indexed config:name="Views">
<config:config-item-map-entry>
<config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
<config:config-item config:name="ViewLeft" config:type="long">23259</config:config-item>
<config:config-item config:name="ViewTop" config:type="long">35426</config:config-item>
<config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
<config:config-item config:name="VisibleTop" config:type="long">27940</config:config-item>
<config:config-item config:name="VisibleRight" config:type="long">54698</config:config-item>
<config:config-item config:name="VisibleBottom" config:type="long">55510</config:config-item>
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
<config:config-item config:name="ViewLayoutColumns" config:type="short">1</config:config-item>
<config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
<config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item>
<config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
<config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item>
</config:config-item-map-entry>
</config:config-item-map-indexed>
</config:config-item-set>
<config:config-item-set config:name="ooo:configuration-settings">
<config:config-item config:name="PrintProspect" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintLeftPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintPageBackground" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintControls" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintAnnotationMode" config:type="short">0</config:config-item>
<config:config-item config:name="PrintGraphics" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintRightPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintFaxName" config:type="string"/>
<config:config-item config:name="PrintPaperFromSetup" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintTextPlaceholder" config:type="boolean">false</config:config-item>
<config:config-item config:name="DisableOffPagePositioning" config:type="boolean">true</config:config-item>
<config:config-item config:name="ApplyParagraphMarkFormatToNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintReversed" config:type="boolean">false</config:config-item>
<config:config-item config:name="TabOverMargin" config:type="boolean">false</config:config-item>
<config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="SurroundTextWrapSmall" config:type="boolean">false</config:config-item>
<config:config-item config:name="BackgroundParaOverDrawings" config:type="boolean">false</config:config-item>
<config:config-item config:name="ClippedPictures" config:type="boolean">false</config:config-item>
<config:config-item config:name="FloattableNomargins" config:type="boolean">false</config:config-item>
<config:config-item config:name="UnbreakableNumberings" config:type="boolean">false</config:config-item>
<config:config-item config:name="EmbedSystemFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="TabOverflow" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintTables" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
<config:config-item config:name="SmallCapsPercentage66" config:type="boolean">true</config:config-item>
<config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item>
<config:config-item config:name="TreatSingleColumnBreakAsPageBreak" config:type="boolean">false</config:config-item>
<config:config-item config:name="MathBaselineAlignment" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
<config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrinterName" config:type="string"/>
<config:config-item config:name="OutlineLevelYieldsNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="MsWordCompTrailingBlanks" config:type="boolean">false</config:config-item>
<config:config-item config:name="IgnoreFirstLineIndentInNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrintBlackFonts" config:type="boolean">false</config:config-item>
<config:config-item config:name="TableRowKeep" config:type="boolean">false</config:config-item>
<config:config-item config:name="EmbeddedDatabaseName" config:type="string"/>
<config:config-item config:name="IgnoreTabsAndBlanksForLineCalculation" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseOldPrinterMetrics" config:type="boolean">false</config:config-item>
<config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
<config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
<config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
<config:config-item config:name="Rsid" config:type="int">2903384</config:config-item>
<config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="ApplyUserData" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintHiddenText" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddParaTableSpacingAtStart" config:type="boolean">true</config:config-item>
<config:config-item config:name="FieldAutoUpdate" config:type="boolean">true</config:config-item>
<config:config-item config:name="UseOldNumbering" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddParaTableSpacing" config:type="boolean">true</config:config-item>
<config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item>
<config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item>
<config:config-item config:name="ChartAutoUpdate" config:type="boolean">true</config:config-item>
<config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
<config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseFormerObjectPositioning" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddVerticalFrameOffsets" config:type="boolean">false</config:config-item>
<config:config-item config:name="SubtractFlysAnchoredAtFlys" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddParaSpacingToTableCells" config:type="boolean">true</config:config-item>
<config:config-item config:name="AddExternalLeading" config:type="boolean">true</config:config-item>
<config:config-item config:name="CurrentDatabaseDataSource" config:type="string"/>
<config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item>
<config:config-item config:name="ProtectForm" config:type="boolean">false</config:config-item>
<config:config-item config:name="UseFormerLineSpacing" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintDrawings" config:type="boolean">true</config:config-item>
<config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item>
<config:config-item config:name="UnxForceZeroExtLeading" config:type="boolean">false</config:config-item>
<config:config-item config:name="TabAtLeftIndentForParagraphsInList" config:type="boolean">false</config:config-item>
<config:config-item config:name="RedlineProtectionKey" config:type="base64Binary"/>
<config:config-item config:name="PropLineSpacingShrinksFirstLine" config:type="boolean">false</config:config-item>
<config:config-item config:name="ConsiderTextWrapOnObjPos" config:type="boolean">false</config:config-item>
<config:config-item config:name="RsidRoot" config:type="int">882034</config:config-item>
<config:config-item config:name="StylesNoDefault" config:type="boolean">false</config:config-item>
<config:config-item config:name="LinkUpdateMode" config:type="short">1</config:config-item>
<config:config-item config:name="AlignTabStopPosition" config:type="boolean">true</config:config-item>
<config:config-item config:name="DoNotJustifyLinesWithManualBreak" config:type="boolean">false</config:config-item>
<config:config-item config:name="DoNotResetParaAttrsForNumFont" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseCommandType" config:type="int">0</config:config-item>
<config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item>
<config:config-item config:name="DoNotCaptureDrawObjsOnPage" config:type="boolean">false</config:config-item>
<config:config-item config:name="CurrentDatabaseCommand" config:type="string"/>
<config:config-item config:name="PrinterSetup" config:type="base64Binary"/>
<config:config-item config:name="ClipAsCharacterAnchoredWriterFlyFrames" config:type="boolean">false</config:config-item>
</config:config-item-set>
</office:settings>
<office:scripts>
<office:script script:language="ooo:Basic">
<ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink">
<ooo:library-embedded ooo:name="Standard"/>
</ooo:libraries>
</office:script>
</office:scripts>
<office:font-face-decls>
<style:font-face style:name="StarSymbol" svg:font-family="StarSymbol"/>
<style:font-face style:name="Liberation Serif2" svg:font-family="&apos;Liberation Serif&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Liberation Serif1" svg:font-family="&apos;Liberation Serif&apos;" style:font-adornments="Bold" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Liberation Serif" svg:font-family="&apos;Liberation Serif&apos;" style:font-adornments="Regular" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Thorndale AMT" svg:font-family="&apos;Thorndale AMT&apos;" style:font-family-generic="roman" style:font-pitch="variable"/>
<style:font-face style:name="Liberation Sans1" svg:font-family="&apos;Liberation Sans&apos;" style:font-family-generic="swiss" style:font-pitch="variable"/>
<style:font-face style:name="Liberation Sans" svg:font-family="&apos;Liberation Sans&apos;" style:font-adornments="Regular" style:font-family-generic="swiss" style:font-pitch="variable"/>
<style:font-face style:name="Andale Sans UI" svg:font-family="&apos;Andale Sans UI&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
<style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu Sans&apos;" style:font-family-generic="system" style:font-pitch="variable"/>
</office:font-face-decls>
<office:styles>
<style:default-style style:family="graphic">
<style:graphic-properties svg:stroke-color="#000000" draw:fill-color="#99ccff" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.1181in" draw:shadow-offset-y="0.1181in" draw:start-line-spacing-horizontal="0.1114in" draw:start-line-spacing-vertical="0.1114in" draw:end-line-spacing-horizontal="0.1114in" draw:end-line-spacing-vertical="0.1114in" style:flow-with-text="false"/>
<style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:font-independent-line-spacing="false">
<style:tab-stops/>
</style:paragraph-properties>
<style:text-properties style:use-window-font-color="true" style:font-name="Thorndale AMT" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Andale Sans UI" style:font-size-asian="10.5pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Andale Sans UI" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none"/>
</style:default-style>
<style:default-style style:family="paragraph">
<style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="0.4925in" style:writing-mode="lr-tb"/>
<style:text-properties style:use-window-font-color="true" style:font-name="Thorndale AMT" fo:font-size="12pt" fo:language="en" fo:country="US" style:letter-kerning="true" style:font-name-asian="Andale Sans UI" style:font-size-asian="10.5pt" style:language-asian="zxx" style:country-asian="none" style:font-name-complex="Andale Sans UI" style:font-size-complex="12pt" style:language-complex="zxx" style:country-complex="none" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
</style:default-style>
<style:default-style style:family="table">
<style:table-properties table:border-model="collapsing"/>
</style:default-style>
<style:default-style style:family="table-row">
<style:table-row-properties fo:keep-together="auto"/>
</style:default-style>
<style:style style:name="Standard" style:family="paragraph" style:class="text">
<style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-style-name="Regular" style:font-family-generic="swiss" style:font-pitch="variable" style:font-size-asian="10.5pt"/>
</style:style>
<style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-top="0.1665in" fo:margin-bottom="0.0835in" loext:contextual-spacing="false" fo:keep-with-next="always"/>
<style:text-properties style:font-name="Liberation Serif" fo:font-family="&apos;Liberation Serif&apos;" style:font-style-name="Regular" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="16pt" style:font-name-asian="DejaVu Sans" style:font-family-asian="&apos;DejaVu Sans&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="14pt" style:font-name-complex="DejaVu Sans" style:font-family-complex="&apos;DejaVu Sans&apos;" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="14pt"/>
</style:style>
<style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
<style:paragraph-properties fo:margin-top="0in" fo:margin-bottom="0.0835in" loext:contextual-spacing="false"/>
<style:text-properties style:font-name="Liberation Sans" fo:font-family="&apos;Liberation Sans&apos;" style:font-style-name="Regular" style:font-family-generic="swiss" style:font-pitch="variable" style:font-size-asian="10.5pt"/>
</style:style>
<style:style style:name="List" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="list">
<style:text-properties style:font-size-asian="12pt"/>
</style:style>
<style:style style:name="Caption" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties fo:margin-top="0.0835in" fo:margin-bottom="0.0835in" loext:contextual-spacing="false" text:number-lines="false" text:line-number="0"/>
<style:text-properties fo:font-size="12pt" fo:font-style="italic" style:font-size-asian="12pt" style:font-style-asian="italic" style:font-size-complex="12pt" style:font-style-complex="italic"/>
</style:style>
<style:style style:name="Index" style:family="paragraph" style:parent-style-name="Standard" style:class="index">
<style:paragraph-properties text:number-lines="false" text:line-number="0"/>
<style:text-properties style:font-size-asian="12pt"/>
</style:style>
<style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text">
<style:text-properties fo:font-size="16pt" fo:font-weight="bold" style:font-size-asian="115%" style:font-weight-asian="bold" style:font-size-complex="115%" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties text:number-lines="false" text:line-number="0"/>
<style:text-properties style:font-size-asian="10.5pt"/>
</style:style>
<style:style style:name="Table_20_Heading" style:display-name="Table Heading" style:family="paragraph" style:parent-style-name="Table_20_Contents" style:class="extra" style:master-page-name="">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false" style:page-number="auto" text:number-lines="false" text:line-number="0"/>
<style:text-properties style:font-name="Liberation Serif1" fo:font-family="&apos;Liberation Serif&apos;" style:font-style-name="Bold" style:font-family-generic="roman" style:font-pitch="variable" fo:font-weight="bold" style:font-size-asian="10.5pt" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text">
<style:text-properties fo:font-size="14pt" fo:font-style="italic" fo:font-weight="bold" style:font-size-asian="14pt" style:font-style-asian="italic" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-style-complex="italic" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="text">
<style:text-properties fo:font-size="14pt" fo:font-weight="bold" style:font-size-asian="14pt" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Header" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties text:number-lines="false" text:line-number="0">
<style:tab-stops>
<style:tab-stop style:position="3.4626in" style:type="center"/>
<style:tab-stop style:position="6.9252in" style:type="right"/>
</style:tab-stops>
</style:paragraph-properties>
<style:text-properties fo:font-size="9pt" style:font-size-asian="10.5pt"/>
</style:style>
<style:style style:name="Footer" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
<style:paragraph-properties text:number-lines="false" text:line-number="0">
<style:tab-stops>
<style:tab-stop style:position="3.4626in" style:type="center"/>
<style:tab-stop style:position="6.9252in" style:type="right"/>
</style:tab-stops>
</style:paragraph-properties>
<style:text-properties fo:font-size="9pt" style:font-size-asian="10.5pt"/>
</style:style>
<style:style style:name="Text_20_body_20_indent" style:display-name="Text body indent" style:family="paragraph" style:parent-style-name="Text_20_body" style:class="text">
<style:paragraph-properties fo:margin-left="0.1965in" fo:margin-right="0in" fo:margin-top="0in" fo:margin-bottom="0in" loext:contextual-spacing="false" fo:text-indent="0in" style:auto-text-indent="false"/>
</style:style>
<style:style style:name="Text" style:family="paragraph" style:parent-style-name="Caption" style:class="extra"/>
<style:style style:name="Quotations" style:family="paragraph" style:parent-style-name="Standard" style:class="html">
<style:paragraph-properties fo:margin-left="0.3937in" fo:margin-right="0.3937in" fo:margin-top="0in" fo:margin-bottom="0.1965in" loext:contextual-spacing="false" fo:text-indent="0in" style:auto-text-indent="false"/>
</style:style>
<style:style style:name="Title" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="chapter">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
<style:text-properties fo:font-size="28pt" fo:font-weight="bold" style:font-size-asian="28pt" style:font-weight-asian="bold" style:font-size-complex="28pt" style:font-weight-complex="bold"/>
</style:style>
<style:style style:name="Subtitle" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:class="chapter">
<style:paragraph-properties fo:margin-top="0.0417in" fo:margin-bottom="0.0835in" loext:contextual-spacing="false" fo:text-align="center" style:justify-single-word="false"/>
<style:text-properties fo:font-size="18pt" style:font-size-asian="18pt" style:font-size-complex="18pt"/>
</style:style>
<style:style style:name="Placeholder" style:family="text">
<style:text-properties fo:font-variant="small-caps" fo:color="#008080" style:text-underline-style="dotted" style:text-underline-width="auto" style:text-underline-color="font-color"/>
</style:style>
<style:style style:name="Bullet_20_Symbols" style:display-name="Bullet Symbols" style:family="text">
<style:text-properties style:font-name="StarSymbol" fo:font-family="StarSymbol" fo:font-size="9pt" style:font-name-asian="StarSymbol" style:font-family-asian="StarSymbol" style:font-size-asian="9pt" style:font-name-complex="StarSymbol" style:font-family-complex="StarSymbol" style:font-size-complex="9pt"/>
</style:style>
<text:outline-style style:name="Outline">
<text:outline-level-style text:level="1" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
<text:outline-level-style text:level="2" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
<text:outline-level-style text:level="3" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
<text:outline-level-style text:level="4" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
<text:outline-level-style text:level="5" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
<text:outline-level-style text:level="6" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
<text:outline-level-style text:level="7" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
<text:outline-level-style text:level="8" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
<text:outline-level-style text:level="9" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
<text:outline-level-style text:level="10" style:num-format="">
<style:list-level-properties text:min-label-distance="0.15in"/>
</text:outline-level-style>
</text:outline-style>
<text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/>
<text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/>
<text:linenumbering-configuration text:number-lines="false" text:offset="0.1965in" style:num-format="1" text:number-position="left" text:increment="5"/>
</office:styles>
<office:automatic-styles>
<style:style style:name="Table1" style:family="table">
<style:table-properties style:width="6.9243in" table:align="left"/>
</style:style>
<style:style style:name="Table1.A" style:family="table-column">
<style:table-column-properties style:column-width="2.741in"/>
</style:style>
<style:style style:name="Table1.B" style:family="table-column">
<style:table-column-properties style:column-width="1.0458in"/>
</style:style>
<style:style style:name="Table1.A1" style:family="table-cell">
<style:table-cell-properties fo:background-color="#cccccc" fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="0.05pt solid #000000" fo:border-bottom="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table1.E1" style:family="table-cell">
<style:table-cell-properties fo:background-color="#cccccc" fo:padding="0.0382in" fo:border="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table1.A2" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A3" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A4" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A5" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.B5" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.C5" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.D5" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.E5" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A6" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A7" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A8" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.E8" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A9" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A10" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A11" style:family="table-cell">
<style:table-cell-properties fo:background-color="#e6e6e6" fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table1.A12" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A13" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A14" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A15" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A16" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table1.A17" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table2" style:family="table">
<style:table-properties style:width="6.925in" table:align="margins" style:may-break-between-rows="false"/>
</style:style>
<style:style style:name="Table2.A" style:family="table-column">
<style:table-column-properties style:column-width="3.4625in" style:rel-column-width="32767*"/>
</style:style>
<style:style style:name="Table2.B" style:family="table-column">
<style:table-column-properties style:column-width="3.4625in" style:rel-column-width="32768*"/>
</style:style>
<style:style style:name="Table3" style:family="table">
<style:table-properties style:width="2.7396in" table:align="left"/>
</style:style>
<style:style style:name="Table3.A" style:family="table-column">
<style:table-column-properties style:column-width="0.9132in"/>
</style:style>
<style:style style:name="Table3.A1" style:family="table-cell">
<style:table-cell-properties fo:background-color="#cccccc" fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="0.05pt solid #000000" fo:border-bottom="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table3.C1" style:family="table-cell">
<style:table-cell-properties fo:background-color="#cccccc" fo:padding="0.0382in" fo:border="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table3.A2" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table3.A3" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table3.B3" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table3.C3" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table3.A4" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table3.A5" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table3.A6" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table3.A7" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table4" style:family="table">
<style:table-properties style:width="3.1375in" table:align="right" style:may-break-between-rows="true"/>
</style:style>
<style:style style:name="Table4.A" style:family="table-column">
<style:table-column-properties style:column-width="2.0896in"/>
</style:style>
<style:style style:name="Table4.B" style:family="table-column">
<style:table-column-properties style:column-width="1.0479in"/>
</style:style>
<style:style style:name="Table4.A1" style:family="table-cell">
<style:table-cell-properties fo:background-color="#cccccc" fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="0.05pt solid #000000" fo:border-bottom="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table4.B1" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table4.A2" style:family="table-cell">
<style:table-cell-properties fo:background-color="#cccccc" fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table4.B2" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table4.B3" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table5" style:family="table">
<style:table-properties style:width="3.1375in" table:align="right" style:may-break-between-rows="false"/>
</style:style>
<style:style style:name="Table5.A" style:family="table-column">
<style:table-column-properties style:column-width="2.0896in"/>
</style:style>
<style:style style:name="Table5.B" style:family="table-column">
<style:table-column-properties style:column-width="1.0479in"/>
</style:style>
<style:style style:name="Table5.A1" style:family="table-cell">
<style:table-cell-properties fo:background-color="#cccccc" fo:padding="0.0382in" fo:border="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table5.A2" style:family="table-cell">
<style:table-cell-properties fo:background-color="#cccccc" fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table5.B2" style:family="table-cell">
<style:table-cell-properties fo:background-color="#cccccc" fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000">
<style:background-image/>
</style:table-cell-properties>
</style:style>
<style:style style:name="Table5.A3" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table5.A4" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="none" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table5.B4" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="Table5.A5" style:family="table-cell">
<style:table-cell-properties fo:padding="0.0382in" fo:border-left="0.05pt solid #000000" fo:border-right="0.05pt solid #000000" fo:border-top="none" fo:border-bottom="0.05pt solid #000000"/>
</style:style>
<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Header">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
<style:text-properties officeooo:paragraph-rsid="00124376"/>
</style:style>
<style:style style:name="P2" style:family="paragraph" style:parent-style-name="Footer">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
<style:text-properties officeooo:paragraph-rsid="00124376"/>
</style:style>
<style:style style:name="P3" style:family="paragraph" style:parent-style-name="Header">
<style:paragraph-properties fo:text-align="start" style:justify-single-word="false"/>
<style:text-properties fo:font-size="12pt" officeooo:paragraph-rsid="001973ce" style:font-size-asian="12pt" style:font-size-complex="12pt"/>
</style:style>
<style:style style:name="P4" style:family="paragraph" style:parent-style-name="Header">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
<style:text-properties officeooo:paragraph-rsid="00124376"/>
</style:style>
<style:style style:name="P5" style:family="paragraph" style:parent-style-name="Header">
<style:paragraph-properties fo:text-align="start" style:justify-single-word="false"/>
<style:text-properties fo:font-size="12pt" officeooo:paragraph-rsid="001973ce" style:font-size-asian="12pt" style:font-size-complex="12pt"/>
</style:style>
<style:style style:name="P6" style:family="paragraph" style:parent-style-name="Footer">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
<style:text-properties officeooo:paragraph-rsid="00124376"/>
</style:style>
<style:style style:name="P7" style:family="paragraph" style:parent-style-name="Table_20_Contents">
<style:text-properties style:font-name="Liberation Serif2"/>
</style:style>
<style:style style:name="P8" style:family="paragraph" style:parent-style-name="Table_20_Contents">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
</style:style>
<style:style style:name="P9" style:family="paragraph" style:parent-style-name="Table_20_Contents">
<style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/>
</style:style>
<style:style style:name="P10" style:family="paragraph" style:parent-style-name="Table_20_Contents">
<style:paragraph-properties fo:text-align="end" style:justify-single-word="false"/>
</style:style>
<style:style style:name="P11" style:family="paragraph" style:parent-style-name="Table_20_Contents">
<style:paragraph-properties fo:text-align="end" style:justify-single-word="false"/>
<style:text-properties officeooo:paragraph-rsid="001611c2"/>
</style:style>
<style:style style:name="P12" style:family="paragraph" style:parent-style-name="Table_20_Contents">
<style:text-properties officeooo:paragraph-rsid="00257920"/>
</style:style>
<style:style style:name="P13" style:family="paragraph" style:parent-style-name="Table_20_Heading">
<style:text-properties style:font-name="Liberation Serif2"/>
</style:style>
<style:style style:name="P14" style:family="paragraph" style:parent-style-name="Table_20_Heading">
<style:paragraph-properties fo:text-align="end" style:justify-single-word="false"/>
<style:text-properties style:font-name="Liberation Serif2"/>
</style:style>
<style:style style:name="P15" style:family="paragraph" style:parent-style-name="Text_20_body">
<style:text-properties style:font-name="Liberation Serif2"/>
</style:style>
<style:style style:name="P16" style:family="paragraph" style:parent-style-name="Text_20_body">
<style:text-properties officeooo:paragraph-rsid="000d7572"/>
</style:style>
<style:style style:name="P17" style:family="paragraph" style:parent-style-name="Text_20_body">
<style:text-properties officeooo:paragraph-rsid="0020411c"/>
</style:style>
<style:style style:name="P18" style:family="paragraph" style:parent-style-name="Heading_20_1">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
<style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/>
</style:style>
<style:style style:name="P19" style:family="paragraph" style:parent-style-name="Heading_20_1">
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false"/>
</style:style>
<style:style style:name="P20" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-left="4.4409in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false"/>
<style:text-properties style:font-name="Liberation Sans1"/>
</style:style>
<style:style style:name="P21" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-left="4.4409in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false"/>
<style:text-properties style:font-name="Liberation Sans1" officeooo:paragraph-rsid="001ba80b"/>
</style:style>
<style:style style:name="P22" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="">
<style:paragraph-properties fo:margin-left="4.4409in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" style:page-number="auto" fo:break-before="page"/>
<style:text-properties style:font-name="Liberation Sans1"/>
</style:style>
<style:style style:name="P23" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="">
<style:paragraph-properties fo:margin-left="4.4409in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" style:page-number="auto" fo:break-before="page"/>
<style:text-properties style:font-name="Liberation Sans1" officeooo:paragraph-rsid="001ba80b"/>
</style:style>
<style:style style:name="P24" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-left="4.4409in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:break-before="page"/>
</style:style>
<style:style style:name="P25" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-left="4.4409in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:break-before="page"/>
<style:text-properties officeooo:paragraph-rsid="0020411c"/>
</style:style>
<style:style style:name="P26" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-left="4.4409in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:break-before="page"/>
<style:text-properties style:font-name="Liberation Sans1" officeooo:paragraph-rsid="0020411c"/>
</style:style>
<style:style style:name="P27" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:break-before="page"/>
</style:style>
<style:style style:name="P28" style:family="paragraph" style:parent-style-name="Standard">
<style:text-properties officeooo:paragraph-rsid="00257920"/>
</style:style>
<style:style style:name="P29" style:family="paragraph" style:parent-style-name="Standard">
<style:text-properties officeooo:paragraph-rsid="00267ece"/>
</style:style>
<style:style style:name="T1" style:family="text">
<style:text-properties officeooo:rsid="000dd611"/>
</style:style>
<style:style style:name="T2" style:family="text">
<style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/>
</style:style>
<style:style style:name="T3" style:family="text">
<style:text-properties style:font-name="Liberation Sans1"/>
</style:style>
<style:page-layout style:name="pm1">
<style:page-layout-properties fo:page-width="8.5in" fo:page-height="11in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="44" style:layout-grid-base-height="0.2165in" style:layout-grid-ruby-height="0in" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="true" style:layout-grid-display="true" style:footnote-max-height="0in">
<style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:line-style="none" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
</style:page-layout-properties>
<style:header-style>
<style:header-footer-properties fo:min-height="0in" fo:margin-left="0in" fo:margin-right="0in" fo:margin-bottom="0.1965in"/>
</style:header-style>
<style:footer-style>
<style:header-footer-properties fo:min-height="0in" fo:margin-left="0in" fo:margin-right="0in" fo:margin-top="0.1965in"/>
</style:footer-style>
</style:page-layout>
</office:automatic-styles>
<office:master-styles>
<style:master-page style:name="Standard" style:page-layout-name="pm1">
<style:header>
<text:p text:style-name="P1"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.company.header&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P1"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in invoice.company.header.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P1"><text:placeholder text:placeholder-type="text">&lt;line&gt;</text:placeholder></text:p>
<text:p text:style-name="P1"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
<text:p text:style-name="P2"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="P3"><text:placeholder text:placeholder-type="text">&lt;invoice.company.rec_name&gt;</text:placeholder></text:p>
</style:header>
<style:footer>
<text:p text:style-name="P2"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.company.footer&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P2"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in invoice.company.footer.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P2"><text:placeholder text:placeholder-type="text">&lt;line&gt;</text:placeholder></text:p>
<text:p text:style-name="P2"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
<text:p text:style-name="P2"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
</style:footer>
</style:master-page>
</office:master-styles>
<office:body>
<office:text text:use-soft-page-breaks="true">
<office:forms form:automatic-focus="false" form:apply-design-mode="false"/>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
</text:sequence-decls>
<text:p text:style-name="P26"><text:placeholder text:placeholder-type="text">&lt;replace text:p=&quot;set_lang(invoice.party.lang)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;replace text:p=&quot;invoice.set_lang(invoice.party.lang)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P21"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in invoice.invoice_address.full_address.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P20"><text:placeholder text:placeholder-type="text">&lt;line&gt;</text:placeholder></text:p>
<text:p text:style-name="P20"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
<text:p text:style-name="P20"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.party_tax_identifier&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P20"><text:placeholder text:placeholder-type="text">&lt;invoice.party_tax_identifier.type_string&gt;</text:placeholder>: <text:placeholder text:placeholder-type="text">&lt;invoice.party_tax_identifier.code&gt;</text:placeholder></text:p>
<text:p text:style-name="P20"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.type == &apos;in&apos;&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P19"><text:span text:style-name="T2">Supplier Invoice N°:</text:span><text:span text:style-name="T2"><text:placeholder text:placeholder-type="text">&lt;invoice.number and &apos; &apos; + invoice.number or &apos;&apos;&gt;</text:placeholder></text:span></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.type == &apos;out&apos;&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;choose test=&quot;&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;when test=&quot;invoice.state == &apos;draft&apos;&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P18">Draft Invoice</text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;/when&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;when test=&quot;invoice.state == &apos;validated&apos;&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P18">Pro forma Invoice</text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;/when&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;otherwise test=&quot;&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P18">Invoice N°:<text:placeholder text:placeholder-type="text">&lt;invoice.number and &apos; &apos; + invoice.number or &apos;&apos;&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;/otherwise&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;/choose&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:soft-page-break/><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="P16">Description: <text:placeholder text:placeholder-type="text">&lt;invoice.description or &apos;&apos;&gt;</text:placeholder></text:p>
<text:p text:style-name="P16"><text:span text:style-name="T1">Reference</text:span>: <text:placeholder text:placeholder-type="text">&lt;invoice.origins or &apos;&apos;&gt;</text:placeholder><text:placeholder text:placeholder-type="text">&lt;&apos;, &apos; if (invoice.reference and invoice.origins) else &apos;&apos;&gt;</text:placeholder><text:placeholder text:placeholder-type="text">&lt;invoice.reference or &apos;&apos;&gt;</text:placeholder></text:p>
<text:p text:style-name="Text_20_body">Date: <text:placeholder text:placeholder-type="text">&lt;format_date(invoice.invoice_date or today, invoice.party.lang)&gt;</text:placeholder></text:p>
<text:p text:style-name="P17"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.tax_identifier&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Text_20_body"><text:placeholder text:placeholder-type="text">&lt;invoice.tax_identifier.type_string&gt;</text:placeholder>: <text:placeholder text:placeholder-type="text">&lt;invoice.tax_identifier.code&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<table:table table:name="Table1" table:style-name="Table1">
<table:table-column table:style-name="Table1.A"/>
<table:table-column table:style-name="Table1.B" table:number-columns-repeated="4"/>
<table:table-header-rows>
<table:table-row>
<table:table-cell table:style-name="Table1.A1" office:value-type="string">
<text:p text:style-name="P13">Description</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.A1" office:value-type="string">
<text:p text:style-name="P13">Quantity</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.A1" office:value-type="string">
<text:p text:style-name="P13">Unit Price</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.A1" office:value-type="string">
<text:p text:style-name="P13">Taxes</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.E1" office:value-type="string">
<text:p text:style-name="P13">Amount</text:p>
</table:table-cell>
</table:table-row>
</table:table-header-rows>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in invoice.lines&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;choose test=&quot;&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;when test=&quot;line.type == &apos;line&apos;&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;line.product&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;line.product.rec_name&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;line.description&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;description in line.description.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;description&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.D5" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;format_number_symbol(line.quantity, invoice.party.lang, line.unit, digits=line.unit.digits) if line.unit else format_number(line.quantity, invoice.party.lang)&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.D5" office:value-type="string">
<text:p text:style-name="P11"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.unit_price, invoice.party.lang, invoice.currency, digits=line.__class__.unit_price.digits[1])&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.D5" office:value-type="string">
<text:p text:style-name="P8"><text:placeholder text:placeholder-type="text">&lt;&apos;,&apos;.join(&apos;[&apos; + &apos;%s&apos; % x.sequence_number + &apos;]&apos; for x in line.invoice_taxes)&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.E8" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/when&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;when test=&quot;line.type == &apos;subtotal&apos;&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A8" table:number-columns-spanned="4" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;description in (line.description or &apos;&apos;).split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;description&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:table-cell table:style-name="Table1.E8" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;format_currency(line.amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell>
</table:table-row>
<text:soft-page-break/>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/when&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;when test=&quot;line.type == &apos;title&apos;&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A11" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;description in (line.description or &apos;&apos;).split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P9"><text:placeholder text:placeholder-type="text">&lt;description&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/when&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;otherwise test=&quot;&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;description in (line.description or &apos;&apos;).split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;description&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/otherwise&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/choose&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
</table:table>
<text:p text:style-name="P15"/>
<table:table table:name="Table2" table:style-name="Table2">
<table:table-column table:style-name="Table2.A"/>
<table:table-column table:style-name="Table2.B"/>
<text:soft-page-break/>
<table:table-row>
<table:table-cell office:value-type="string">
<table:table table:name="Table3" table:style-name="Table3">
<table:table-column table:style-name="Table3.A" table:number-columns-repeated="3"/>
<table:table-header-rows>
<table:table-row>
<table:table-cell table:style-name="Table3.A1" office:value-type="string">
<text:p text:style-name="P13">Tax</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table3.A1" office:value-type="string">
<text:p text:style-name="P13">Base</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table3.C1" office:value-type="string">
<text:p text:style-name="P13">Amount</text:p>
</table:table-cell>
</table:table-row>
</table:table-header-rows>
<table:table-row>
<table:table-cell table:style-name="Table3.A2" table:number-columns-spanned="3" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;tax in invoice.taxes&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table3.A3" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;&apos;[&apos; + &apos;%s&apos; % tax.sequence_number + &apos;]&apos;&gt;</text:placeholder><text:s/><text:placeholder text:placeholder-type="text">&lt;tax.description or &apos;&apos;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table3.B3" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;format_currency(tax.base, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table3.C3" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;format_currency(tax.amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table3.A4" table:number-columns-spanned="3" office:value-type="string">
<text:p text:style-name="P29"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;tax.legal_notice&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table3.A6" table:number-columns-spanned="3" office:value-type="string">
<text:p text:style-name="P28"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in tax.legal_notice.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P12"><text:placeholder text:placeholder-type="text">&lt;line&gt;</text:placeholder></text:p>
<text:p text:style-name="P12"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table3.A6" table:number-columns-spanned="3" office:value-type="string">
<text:p text:style-name="P29"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table3.A7" table:number-columns-spanned="3" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
<table:covered-table-cell/>
</table:table-row>
</table:table>
<text:p text:style-name="Table_20_Contents"/>
</table:table-cell>
<table:table-cell office:value-type="string">
<table:table table:name="Table4" table:style-name="Table4">
<table:table-column table:style-name="Table4.A"/>
<table:table-column table:style-name="Table4.B"/>
<table:table-row>
<table:table-cell table:style-name="Table4.A1" office:value-type="string">
<text:p text:style-name="P14">Total (excl. taxes):</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table4.B1" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;format_currency(invoice.untaxed_amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table4.A2" office:value-type="string">
<text:p text:style-name="P14">Taxes:</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table4.B3" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;format_currency(invoice.tax_amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table4.A2" office:value-type="string">
<text:p text:style-name="P14">Total:</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table4.B3" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;format_currency(invoice.total_amount, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell>
</table:table-row>
</table:table>
<text:p text:style-name="P7"/>
</table:table-cell>
</table:table-row>
</table:table>
<text:p text:style-name="Text_20_body"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.lines_to_pay&quot;&gt;</text:placeholder></text:p>
<table:table table:name="Table5" table:style-name="Table5">
<table:table-column table:style-name="Table5.A"/>
<table:table-column table:style-name="Table5.B"/>
<table:table-header-rows>
<text:soft-page-break/>
<table:table-row>
<table:table-cell table:style-name="Table5.A1" table:number-columns-spanned="2" office:value-type="string">
<text:p text:style-name="P13">Payment Term</text:p>
<text:p text:style-name="P15"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.payment_term and invoice.payment_term.description&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P15"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;description in (invoice.payment_term.description or &apos;&apos;).split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P15"><text:placeholder text:placeholder-type="text">&lt;description&gt;</text:placeholder></text:p>
<text:p text:style-name="P15"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
<text:p text:style-name="P15"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table5.A2" office:value-type="string">
<text:p text:style-name="P13">Date</text:p>
</table:table-cell>
<table:table-cell table:style-name="Table5.B2" office:value-type="string">
<text:p text:style-name="P13">Amount</text:p>
</table:table-cell>
</table:table-row>
</table:table-header-rows>
<table:table-row>
<table:table-cell table:style-name="Table5.A5" table:number-columns-spanned="2" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in invoice.lines_to_pay&quot;&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table5.A4" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;format_date(line.maturity_date, invoice.party.lang) if line.maturity_date else ''&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table5.B4" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;line.amount_second_currency and format_currency(line.amount_second_currency, invoice.party.lang, invoice.currency) or format_currency(line.debit - line.credit, invoice.party.lang, invoice.currency)&gt;</text:placeholder></text:p>
</table:table-cell>
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table5.A5" table:number-columns-spanned="2" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
<table:covered-table-cell/>
</table:table-row>
</table:table>
<text:p text:style-name="Text_20_body"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="Text_20_body"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;comment in (invoice.comment or &apos;&apos;).split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Text_20_body"><text:placeholder text:placeholder-type="text">&lt;comment&gt;</text:placeholder></text:p>
<text:p text:style-name="Text_20_body"><text:soft-page-break/><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</office:text>
</office:body>
</office:document>
File diff suppressed because it is too large Load Diff
+453
View File
@@ -0,0 +1,453 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<menuitem
name="Invoices"
parent="account.menu_account"
sequence="20"
id="menu_invoices"/>
<record model="ir.action.wizard" id="wizard_pay">
<field name="name">Pay Invoice</field>
<field name="wiz_name">account.invoice.pay</field>
<field name="model">account.invoice</field>
</record>
<record model="ir.ui.view" id="invoice_view_form">
<field name="model">account.invoice</field>
<field name="type">form</field>
<field name="name">invoice_form</field>
</record>
<record model="ir.ui.view" id="invoice_view_tree">
<field name="model">account.invoice</field>
<field name="type">tree</field>
<field name="name">invoice_tree</field>
</record>
<record model="ir.action.act_window" id="act_invoice_form">
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
</record>
<record model="ir.action.act_window.view" id="act_invoice_form_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="invoice_view_tree"/>
<field name="act_window" ref="act_invoice_form"/>
</record>
<record model="ir.action.act_window.view" id="act_invoice_form_view2">
<field name="sequence" eval="20"/>
<field name="view" ref="invoice_view_form"/>
<field name="act_window" ref="act_invoice_form"/>
</record>
<record model="ir.action.act_window" id="act_invoice_out_form">
<field name="name">Customer Invoices</field>
<field name="res_model">account.invoice</field>
<field name="domain" eval="[('type', '=', 'out')]" pyson="1"/>
<field name="context" eval="{'type': 'out'}" pyson="1"/>
<field name="search_value"></field>
</record>
<record model="ir.action.act_window.view" id="act_invoice_out_form_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="invoice_view_tree"/>
<field name="act_window" ref="act_invoice_out_form"/>
</record>
<record model="ir.action.act_window.view" id="act_invoice_out_form_view2">
<field name="sequence" eval="20"/>
<field name="view" ref="invoice_view_form"/>
<field name="act_window" ref="act_invoice_out_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_invoice_out_domain_draft">
<field name="name">Draft</field>
<field name="sequence" eval="10"/>
<field name="domain" eval="[('state', '=', 'draft')]" pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_invoice_out_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_invoice_out_domain_validated">
<field name="name">Validated</field>
<field name="sequence" eval="20"/>
<field name="domain" eval="[('state', '=', 'validated')]" pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_invoice_out_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_invoice_out_domain_posted">
<field name="name">Posted</field>
<field name="sequence" eval="30"/>
<field name="domain" eval="[('state', '=', 'posted')]" pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_invoice_out_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_invoice_out_domain_all">
<field name="name">All</field>
<field name="sequence" eval="9999"/>
<field name="domain"></field>
<field name="act_window" ref="act_invoice_out_form"/>
</record>
<menuitem
parent="menu_invoices"
action="act_invoice_out_form"
sequence="10"
id="menu_invoice_out_form"/>
<record model="ir.action.act_window" id="act_invoice_in_form">
<field name="name">Supplier Invoices</field>
<field name="res_model">account.invoice</field>
<field name="domain" eval="[('type', '=', 'in')]" pyson="1"/>
<field name="context" eval="{'type': 'in'}" pyson="1"/>
<field name="search_value"></field>
</record>
<record model="ir.action.act_window.view" id="act_invoice_in_form_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="invoice_view_tree"/>
<field name="act_window" ref="act_invoice_in_form"/>
</record>
<record model="ir.action.act_window.view" id="act_invoice_in_form_view2">
<field name="sequence" eval="20"/>
<field name="view" ref="invoice_view_form"/>
<field name="act_window" ref="act_invoice_in_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_invoice_in_domain_draft">
<field name="name">Draft</field>
<field name="sequence" eval="10"/>
<field name="domain" eval="[('state', '=', 'draft')]" pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_invoice_in_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_invoice_in_domain_validated">
<field name="name">Validated</field>
<field name="sequence" eval="20"/>
<field name="domain" eval="[('state', '=', 'validated')]" pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_invoice_in_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_invoice_in_domain_posted">
<field name="name">Posted</field>
<field name="sequence" eval="30"/>
<field name="domain" eval="[('state', '=', 'posted')]" pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_invoice_in_form"/>
</record>
<record model="ir.action.act_window.domain" id="act_invoice_in_domain_all">
<field name="name">All</field>
<field name="sequence" eval="9999"/>
<field name="domain"></field>
<field name="act_window" ref="act_invoice_in_form"/>
</record>
<menuitem
parent="menu_invoices"
action="act_invoice_in_form"
sequence="10"
id="menu_invoice_in_form"/>
<record model="ir.model.access" id="access_invoice">
<field name="model" search="[('model', '=', 'account.invoice')]"/>
<field name="perm_read" eval="False"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_invoice_account">
<field name="model" search="[('model', '=', 'account.invoice')]"/>
<field name="group" ref="account.group_account"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.button" id="invoice_cancel_button">
<field name="name">cancel</field>
<field name="string">Cancel</field>
<field name="confirm">Are you sure you want to cancel the invoices?</field>
<field name="help">Cancel the invoice</field>
<field name="model" search="[('model', '=', 'account.invoice')]"/>
</record>
<record model="ir.model.button-res.group"
id="invoice_cancel_button_group_account">
<field name="button" ref="invoice_cancel_button"/>
<field name="group" ref="account.group_account"/>
</record>
<record model="ir.model.button" id="invoice_draft_button">
<field name="name">draft</field>
<field name="string">Draft</field>
<field name="model" search="[('model', '=', 'account.invoice')]"/>
</record>
<record model="ir.model.button-res.group"
id="invoice_draft_button_group_account">
<field name="button" ref="invoice_draft_button"/>
<field name="group" ref="account.group_account"/>
</record>
<record model="ir.model.button" id="invoice_validate_button">
<field name="name">validate_invoice</field>
<field name="string">Validate</field>
<field name="help">Also known as Pro Forma</field>
<field name="model" search="[('model', '=', 'account.invoice')]"/>
</record>
<record model="ir.model.button-res.group"
id="invoice_validate_button_group_account">
<field name="button" ref="invoice_validate_button"/>
<field name="group" ref="account.group_account"/>
</record>
<record model="ir.model.button" id="invoice_post_button">
<field name="name">post</field>
<field name="string">Post</field>
<field name="confirm">Are you sure you want to post the invoices?</field>
<field name="model" search="[('model', '=', 'account.invoice')]"/>
</record>
<record model="ir.model.button-res.group"
id="invoice_post_button_group_account">
<field name="button" ref="invoice_post_button"/>
<field name="group" ref="account.group_account"/>
</record>
<record model="ir.model.button" id="invoice_pay_button">
<field name="name">pay</field>
<field name="string">Pay</field>
<field name="model" search="[('model', '=', 'account.invoice')]"/>
</record>
<record model="ir.model.button-res.group"
id="invoice_pay_button_group_account">
<field name="button" ref="invoice_pay_button"/>
<field name="group" ref="account.group_account"/>
</record>
<record model="ir.model.button" id="invoice_reschedule_lines_to_pay_button">
<field name="name">reschedule_lines_to_pay</field>
<field name="string">Reschedule</field>
<field name="model" search="[('model', '=', 'account.invoice')]"/>
</record>
<record model="ir.model.button-res.group"
id="invoice_reschedule_lines_to_pay_button_group_account">
<field name="button" ref="invoice_reschedule_lines_to_pay_button"/>
<field name="group" ref="account.group_account"/>
</record>
<record model="ir.model.button" id="invoice_delegate_lines_to_pay_button">
<field name="name">delegate_lines_to_pay</field>
<field name="string">Modify Payee</field>
<field name="model" search="[('model', '=', 'account.invoice')]"/>
</record>
<record model="ir.model.button-res.group"
id="invoice_delegate_lines_to_pay_button_group_account">
<field name="button" ref="invoice_delegate_lines_to_pay_button"/>
<field name="group" ref="account.group_account"/>
</record>
<record model="ir.model.button" id="invoice_process_button">
<field name="name">process</field>
<field name="string">Process</field>
<field name="model" search="[('model', '=', 'account.invoice')]"/>
</record>
<record model="ir.model.button-res.group" id="invoice_process_button_group_account_admin">
<field name="button" ref="invoice_process_button"/>
<field name="group" ref="account.group_account_admin"/>
</record>
<record model="ir.action.report" id="report_invoice">
<field name="name">Invoice</field>
<field name="model">account.invoice</field>
<field name="report_name">account.invoice</field>
<field name="report">account_invoice/invoice.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_invoice_keyword">
<field name="keyword">form_print</field>
<field name="model">account.invoice,-1</field>
<field name="action" ref="report_invoice"/>
</record>
<record model="ir.sequence.type" id="sequence_type_account_invoice">
<field name="name">Invoice</field>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_invoice_group_admin">
<field name="sequence_type" ref="sequence_type_account_invoice"/>
<field name="group" ref="res.group_admin"/>
</record>
<record model="ir.sequence.type-res.group"
id="sequence_type_account_invoice_group_account_admin">
<field name="sequence_type" ref="sequence_type_account_invoice"/>
<field name="group" ref="account.group_account_admin"/>
</record>
<record model="ir.ui.view" id="invoice_line_view_form">
<field name="model">account.invoice.line</field>
<field name="type">form</field>
<field name="name">invoice_line_form</field>
</record>
<record model="ir.ui.view" id="invoice_line_view_tree">
<field name="model">account.invoice.line</field>
<field name="type">tree</field>
<field name="priority" eval="10"/>
<field name="name">invoice_line_tree</field>
</record>
<record model="ir.ui.view" id="invoice_line_view_tree_sequence">
<field name="model">account.invoice.line</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="name">invoice_line_tree_sequence</field>
</record>
<record model="ir.model.access" id="access_invoice_line">
<field name="model" search="[('model', '=', 'account.invoice.line')]"/>
<field name="perm_read" eval="False"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_invoice_line_account">
<field name="model" search="[('model', '=', 'account.invoice.line')]"/>
<field name="group" ref="account.group_account"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="invoice_tax_view_form">
<field name="model">account.invoice.tax</field>
<field name="type">form</field>
<field name="name">invoice_tax_form</field>
</record>
<record model="ir.ui.view" id="invoice_tax_view_tree">
<field name="model">account.invoice.tax</field>
<field name="type">tree</field>
<field name="priority" eval="10"/>
<field name="name">invoice_tax_tree</field>
</record>
<record model="ir.ui.view" id="invoice_tax_view_tree_sequence">
<field name="model">account.invoice.tax</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="name">invoice_tax_tree_sequence</field>
</record>
<record model="ir.ui.view" id="pay_start_view_form">
<field name="model">account.invoice.pay.start</field>
<field name="type">form</field>
<field name="name">pay_start_form</field>
</record>
<record model="ir.ui.view" id="pay_ask_view_form">
<field name="model">account.invoice.pay.ask</field>
<field name="type">form</field>
<field name="name">pay_ask_form</field>
</record>
<record model="ir.ui.view" id="payment_method_view_form">
<field name="model">account.invoice.payment.method</field>
<field name="type">form</field>
<field name="name">payment_method_form</field>
</record>
<record model="ir.ui.view" id="payment_method_view_list">
<field name="model">account.invoice.payment.method</field>
<field name="type">tree</field>
<field name="name">payment_method_tree</field>
</record>
<record model="ir.action.act_window" id="act_payment_method_form">
<field name="name">Invoice Payment Methods</field>
<field name="res_model">account.invoice.payment.method</field>
</record>
<record model="ir.action.act_window.view" id="act_payment_method_form_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="payment_method_view_list"/>
<field name="act_window" ref="act_payment_method_form"/>
</record>
<record model="ir.action.act_window.view" id="act_payment_method_form_view2">
<field name="sequence" eval="20"/>
<field name="view" ref="payment_method_view_form"/>
<field name="act_window" ref="act_payment_method_form"/>
</record>
<menuitem
parent="account.menu_journal_configuration"
action="act_payment_method_form"
sequence="50"
id="menu_payment_method_form"/>
<record model="ir.rule.group" id="rule_group_payment_method_companies">
<field name="name">User in companies</field>
<field name="model" search="[('model', '=', 'account.invoice.payment.method')]"/>
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_payment_method_companies">
<field name="domain"
eval="[('company', 'in', Eval('companies', []))]"
pyson="1"/>
<field name="rule_group" ref="rule_group_payment_method_companies"/>
</record>
<record model="ir.model.access" id="access_payment_method">
<field name="model" search="[('model', '=', 'account.invoice.payment.method')]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_payment_method_account_admin">
<field name="model" search="[('model', '=', 'account.invoice.payment.method')]"/>
<field name="group" ref="account.group_account_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="credit_start_view_form">
<field name="model">account.invoice.credit.start</field>
<field name="type">form</field>
<field name="name">credit_start_form</field>
</record>
<record model="ir.action.wizard" id="credit">
<field name="name">Credit</field>
<field name="wiz_name">account.invoice.credit</field>
<field name="model">account.invoice</field>
</record>
<record model="ir.action.keyword" id="credit_keyword">
<field name="keyword">form_action</field>
<field name="model">account.invoice,-1</field>
<field name="action" ref="credit"/>
</record>
<record model="ir.rule.group" id="rule_group_invoice_companies">
<field name="name">User in companies</field>
<field name="model" search="[('model', '=', 'account.invoice')]"/>
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_invoice_companies">
<field name="domain"
eval="[('company', 'in', Eval('companies', []))]"
pyson="1"/>
<field name="rule_group" ref="rule_group_invoice_companies"/>
</record>
<record model="ir.rule.group" id="rule_group_invoice_line_companies">
<field name="name">User in companies</field>
<field name="model" search="[('model', '=', 'account.invoice.line')]"/>
<field name="global_p" eval="True"/>
</record>
<record model="ir.rule" id="rule_invoice_line_companies">
<field name="domain"
eval="[('company', 'in', Eval('companies', []))]"
pyson="1"/>
<field name="rule_group" ref="rule_group_invoice_line_companies"/>
</record>
<record model="ir.action.wizard" id="act_reschedule_lines_to_pay_wizard">
<field name="name">Reschedule Lines to Pay</field>
<field name="wiz_name">account.invoice.lines_to_pay.reschedule</field>
<field name="model">account.invoice</field>
</record>
<record model="ir.action.wizard" id="act_delegate_lines_to_pay_wizard">
<field name="name">Delegate Lines to Pay</field>
<field name="wiz_name">account.invoice.lines_to_pay.delegate</field>
<field name="model">account.invoice</field>
</record>
</data>
</tryton>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+89
View File
@@ -0,0 +1,89 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data grouped="1">
<record model="ir.message" id="msg_payment_term_missing_last_remainder">
<field name="text">To save payment term "%(payment_term)s", you must append a last remainder line.</field>
</record>
<record model="ir.message" id="msg_payment_term_missing_remainder">
<field name="text">To compute terms, you must append a remainder line on payment term "%(payment_term)s".</field>
</record>
<record model="ir.message" id="msg_payment_term_invalid_ratio_divisor">
<field name="text">The ratio and divisor are not consistent on line "%(line)s".</field>
</record>
<record model="ir.message" id="msg_erase_party_pending_invoice">
<field name="text">You cannot erase party "%(party)s" while they have pending invoices with company "%(company)s".</field>
</record>
<record model="ir.message" id="msg_invoice_tax_invalid">
<field name="text">The taxes on invoice "%(invoice)s" are not valid, you must save it again to force them to be recalculated.</field>
</record>
<record model="ir.message" id="msg_invoice_no_sequence">
<field name="text">To post invoice "%(invoice)s", you must define a sequence on fiscal year "%(fiscalyear)s".</field>
</record>
<record model="ir.message" id="msg_invoice_number_after">
<field name="text">To number the invoice "%(invoice)s", you must set an invoice date after "%(date)s" because the sequence "%(sequence)s" has already been used for invoice "%(after_invoice)s".</field>
</record>
<record model="ir.message" id="msg_invoice_modify">
<field name="text">You cannot modify invoice "%(invoice)s" because it is posted, paid or cancelled.</field>
</record>
<record model="ir.message" id="msg_invoice_same_account_line">
<field name="text">You cannot use the same account "%(account)s" on invoice "%(invoice)s" and on line "%(line)s".</field>
</record>
<record model="ir.message" id="msg_invoice_delete_cancel">
<field name="text">To delete invoice "%(invoice)s" you must cancel it.</field>
</record>
<record model="ir.message" id="msg_invoice_delete_numbered">
<field name="text">You cannot delete invoice "%(invoice)s" because it has a number.</field>
</record>
<record model="ir.message" id="msg_invoice_customer_cancel_move">
<field name="text">You cannot cancel customer invoice "%(invoice)s" because it is posted and company setup does not allow it.</field>
</record>
<record model="ir.message" id="msg_invoice_payment_lines_greater_amount">
<field name="text">Payment lines amount on invoice "%(invoice)s" can not be greater than the invoice amount.</field>
</record>
<record model="ir.message" id="msg_invoice_payment_lines_add_remove_paid">
<field name="text">You cannot add/remove payment lines on paid invoice "%(invoice)s".</field>
</record>
<record model="ir.message" id="msg_invoice_credit_refund_not_posted">
<field name="text">You cannot refund invoice "%(invoice)s" because it is not posted.</field>
</record>
<record model="ir.message" id="msg_invoice_line_modify">
<field name="text">You cannot modify line "%(line)s" because its invoice "%(invoice)s" is posted, paid or cancelled.</field>
</record>
<record model="ir.message" id="msg_invoice_line_create">
<field name="text">You cannot add a line to invoice "%(invoice)s" because it is posted, paid or cancelled.</field>
</record>
<record model="ir.message" id="msg_invoice_tax_modify">
<field name="text">You cannot modify tax "%(tax)s" because its invoice "%(invoice)s" is posted, paid or cancelled.</field>
</record>
<record model="ir.message" id="msg_invoice_tax_create">
<field name="text">You cannot add a tax to invoice "%(invoice)s" because it is posted, paid or cancelled.</field>
</record>
<record model="ir.message" id="msg_invoice_line_tax_unique">
<field name="text">A tax can be added only once to an invoice line.</field>
</record>
<record model="ir.message" id="msg_invoice_pay_amount_greater_amount_to_pay">
<field name="text">You cannot add a partial payment on invoice "%(invoice)s" with an amount greater than the amount to pay "%(amount_to_pay)s".</field>
</record>
<record model="ir.message" id="msg_invoice_overpay_paid">
<field name="text">You cannot overpay invoice "%(invoice)s" because there is no more left to pay.</field>
</record>
<record model="ir.message" id="msg_invoice_payment_line_unique">
<field name="text">A payment line can be linked to only one invoice.</field>
</record>
<record model="ir.message" id="msg_invoice_payment_term_date_past">
<field name="text">The invoice "%(invoice)s" generates a payment date "%(date)s" in the past.</field>
</record>
<record model="ir.message" id="msg_close_period_non_posted_invoices">
<field name="text">To close the periods you must post the invoices "%(invoices)s".</field>
</record>
<record model="ir.message" id="msg_invoice_date_future">
<field name="text">The invoices "%(invoices)s" have an invoice date in the future.</field>
</record>
<record model="ir.message" id="msg_invoice_similar">
<field name="text">The invoice "%(invoice)s" is similar to invoice "%(similar)s".</field>
</record>
</data>
</tryton>
+115
View File
@@ -0,0 +1,115 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond import backend
from trytond.i18n import gettext
from trytond.model import ModelSQL, ValueMixin, fields
from trytond.modules.party.exceptions import EraseError
from trytond.pool import Pool, PoolMeta
from trytond.tools.multivalue import migrate_property
customer_payment_term = fields.Many2One(
'account.invoice.payment_term', "Customer Payment Term")
supplier_payment_term = fields.Many2One(
'account.invoice.payment_term', "Supplier Payment Term")
class Address(metaclass=PoolMeta):
__name__ = 'party.address'
invoice = fields.Boolean('Invoice')
class ContactMechanism(metaclass=PoolMeta):
__name__ = 'party.contact_mechanism'
invoice = fields.Boolean('Invoice')
@classmethod
def usages(cls, _fields=None):
if _fields is None:
_fields = []
_fields.append('invoice')
return super(ContactMechanism, cls).usages(_fields=_fields)
class Party(metaclass=PoolMeta):
__name__ = 'party.party'
customer_payment_term = fields.MultiValue(customer_payment_term)
supplier_payment_term = fields.MultiValue(supplier_payment_term)
payment_terms = fields.One2Many(
'party.party.payment_term', 'party', "Payment Terms")
@classmethod
def multivalue_model(cls, field):
pool = Pool()
if field in {'customer_payment_term', 'supplier_payment_term'}:
return pool.get('party.party.payment_term')
return super(Party, cls).multivalue_model(field)
@classmethod
def default_customer_payment_term(cls, **pattern):
pool = Pool()
Configuration = pool.get('account.configuration')
config = Configuration(1)
payment_term = config.get_multivalue(
'default_customer_payment_term', **pattern)
return payment_term.id if payment_term else None
class PartyPaymentTerm(ModelSQL, ValueMixin):
"Party Payment Term"
__name__ = 'party.party.payment_term'
party = fields.Many2One(
'party.party', "Party", ondelete='CASCADE')
customer_payment_term = customer_payment_term
supplier_payment_term = supplier_payment_term
@classmethod
def __register__(cls, module_name):
exist = backend.TableHandler.table_exist(cls._table)
super(PartyPaymentTerm, cls).__register__(module_name)
if not exist:
cls._migrate_property([], [], [])
@classmethod
def _migrate_property(cls, field_names, value_names, fields):
field_names.extend(['customer_payment_term', 'supplier_payment_term'])
value_names.extend(['customer_payment_term', 'supplier_payment_term'])
migrate_property(
'party.party', field_names, cls, value_names,
parent='party', fields=fields)
class Replace(metaclass=PoolMeta):
__name__ = 'party.replace'
@classmethod
def fields_to_replace(cls):
return super().fields_to_replace() + [
('account.invoice', 'party'),
('account.invoice.line', 'party'),
('account.invoice.alternative_payee', 'party'),
]
class Erase(metaclass=PoolMeta):
__name__ = 'party.erase'
def check_erase_company(self, party, company):
pool = Pool()
Invoice = pool.get('account.invoice')
super().check_erase_company(party, company)
invoices = Invoice.search([
['OR',
('party', '=', party.id),
('alternative_payees', '=', party.id),
],
('company', '=', company.id),
('state', 'not in', ['paid', 'cancelled']),
])
if invoices:
raise EraseError(
gettext('account_invoice.msg_erase_party_pending_invoice',
party=party.rec_name,
company=company.rec_name))
+72
View File
@@ -0,0 +1,72 @@
<?xml version="1.0"?>
<!-- This file is part of 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="address_view_tree">
<field name="model">party.address</field>
<field name="inherit" ref="party.address_view_tree"/>
<field name="name">address_tree</field>
</record>
<record model="ir.ui.view" id="address_view_form">
<field name="model">party.address</field>
<field name="inherit" ref="party.address_view_form"/>
<field name="name">address_form</field>
</record>
<record model="ir.ui.view" id="address_view_form_simple">
<field name="model">party.address</field>
<field name="inherit" ref="party.address_view_form_simple"/>
<field name="name">address_form</field>
</record>
<record model="ir.ui.view" id="address_view_tree_sequence">
<field name="model">party.address</field>
<field name="inherit" ref="party.address_view_tree_sequence"/>
<field name="name">address_tree_sequence</field>
</record>
<record model="ir.ui.view" id="contact_mechanism_view_tree">
<field name="model">party.contact_mechanism</field>
<field name="inherit" ref="party.contact_mechanism_view_tree"/>
<field name="name">contact_mechanism_tree</field>
</record>
<record model="ir.ui.view" id="contact_mechanism_view_form">
<field name="model">party.contact_mechanism</field>
<field name="inherit" ref="party.contact_mechanism_view_form"/>
<field name="name">contact_mechanism_form</field>
</record>
<record model="ir.ui.view" id="contact_mechanism_view_tree_sequence">
<field name="model">party.contact_mechanism</field>
<field name="inherit" ref="party.contact_mechanism_view_tree_sequence"/>
<field name="name">contact_mechanism_tree_sequence</field>
</record>
<record model="ir.ui.view" id="party_view_form">
<field name="model">party.party</field>
<field name="inherit" ref="party.party_view_form"/>
<field name="name">party_form</field>
</record>
<record model="ir.action.act_window" id="act_invoice_form2">
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
<field name="domain"
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('party', '=', Eval('active_id')), ('party', 'in', Eval('active_ids')))]"
pyson="1"/>
<field name="search_value" eval="[('state', 'not in', ['paid', 'cancelled'])]" pyson="1"/>
</record>
<record model="ir.action.keyword"
id="act_open_invoice_keyword1">
<field name="keyword">form_relate</field>
<field name="model">party.party,-1</field>
<field name="action" ref="act_invoice_form2"/>
</record>
<record model="ir.action-res.group"
id="act_invoice_form2-group_sale">
<field name="action" ref="act_invoice_form2"/>
<field name="group" ref="account.group_account"/>
</record>
</data>
</tryton>
+398
View File
@@ -0,0 +1,398 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from decimal import Decimal
from dateutil.relativedelta import relativedelta
from sql import Column
from trytond import backend
from trytond.config import config
from trytond.i18n import gettext
from trytond.model import (
DeactivableMixin, ModelSQL, ModelView, fields, sequence_ordered)
from trytond.modules.currency.fields import Monetary
from trytond.pool import Pool
from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.wizard import Button, StateView, Wizard
from .exceptions import PaymentTermComputeError, PaymentTermValidationError
class PaymentTerm(DeactivableMixin, ModelSQL, ModelView):
'Payment Term'
__name__ = 'account.invoice.payment_term'
name = fields.Char('Name', size=None, required=True, translate=True)
description = fields.Text('Description', translate=True)
lines = fields.One2Many('account.invoice.payment_term.line', 'payment',
'Lines')
@classmethod
def __setup__(cls):
super(PaymentTerm, cls).__setup__()
cls._order.insert(0, ('name', 'ASC'))
@classmethod
def validate_fields(cls, terms, field_names):
super().validate_fields(terms, field_names)
cls.check_remainder(terms, field_names)
@classmethod
def check_remainder(cls, terms, field_names=None):
if field_names and 'lines' not in field_names:
return
for term in terms:
if not term.lines or not term.lines[-1].type == 'remainder':
raise PaymentTermValidationError(gettext(
'account_invoice'
'.msg_payment_term_missing_last_remainder',
payment_term=term.rec_name))
def compute(self, amount, currency, date):
"""Calculate payment terms and return a list of tuples
with (date, amount) for each payment term line.
amount must be a Decimal used for the calculation.
"""
# TODO implement business_days
# http://pypi.python.org/pypi/BusinessHours/
sign = 1 if amount >= Decimal('0.0') else -1
res = []
remainder = amount
for line in self.lines:
value = line.get_value(remainder, amount, currency)
value_date = line.get_date(date)
if value is None or not value_date:
continue
if ((remainder - value) * sign) < Decimal('0.0'):
res.append((value_date, remainder))
break
if value:
res.append((value_date, value))
remainder -= value
else:
# Enforce to have at least one term
if not res:
res.append((date, Decimal(0)))
if not currency.is_zero(remainder):
raise PaymentTermComputeError(
gettext('account_invoice.msg_payment_term_missing_remainder',
payment_term=self.rec_name))
return res
class PaymentTermLine(sequence_ordered(), ModelSQL, ModelView):
'Payment Term Line'
__name__ = 'account.invoice.payment_term.line'
payment = fields.Many2One('account.invoice.payment_term', 'Payment Term',
required=True, ondelete="CASCADE")
type = fields.Selection([
('fixed', 'Fixed'),
('percent', 'Percentage on Remainder'),
('percent_on_total', 'Percentage on Total'),
('remainder', 'Remainder'),
], 'Type', required=True)
ratio = fields.Numeric('Ratio', digits=(14, 10),
states={
'invisible': ~Eval('type').in_(['percent', 'percent_on_total']),
'required': Eval('type').in_(['percent', 'percent_on_total']),
})
divisor = fields.Numeric('Divisor', digits=(10, 14),
states={
'invisible': ~Eval('type').in_(['percent', 'percent_on_total']),
'required': Eval('type').in_(['percent', 'percent_on_total']),
})
amount = Monetary(
"Amount", currency='currency', digits='currency',
states={
'invisible': Eval('type') != 'fixed',
'required': Eval('type') == 'fixed',
})
currency = fields.Many2One('currency.currency', 'Currency',
states={
'invisible': Eval('type') != 'fixed',
'required': Eval('type') == 'fixed',
})
relativedeltas = fields.One2Many(
'account.invoice.payment_term.line.delta', 'line', 'Deltas')
@classmethod
def __setup__(cls):
super().__setup__()
cls.__access__.add('payment')
@classmethod
def __register__(cls, module_name):
sql_table = cls.__table__()
super(PaymentTermLine, cls).__register__(module_name)
cursor = Transaction().connection.cursor()
table = cls.__table_handler__(module_name)
# Migration from 3.8: rename percentage into ratio
if table.column_exist('percentage'):
cursor.execute(*sql_table.update(
columns=[sql_table.ratio],
values=[sql_table.percentage / 100]))
table.drop_column('percentage')
@staticmethod
def default_type():
return 'remainder'
@classmethod
def default_relativedeltas(cls):
if Transaction().user == 0:
return []
return [{}]
@fields.depends('type')
def on_change_type(self):
if self.type != 'fixed':
self.amount = Decimal('0.0')
self.currency = None
if self.type not in ('percent', 'percent_on_total'):
self.ratio = Decimal('0.0')
self.divisor = Decimal('0.0')
@fields.depends('ratio')
def on_change_ratio(self):
if not self.ratio:
self.divisor = Decimal('0.0')
else:
self.divisor = self.round(1 / self.ratio,
self.__class__.divisor.digits[1])
@fields.depends('divisor')
def on_change_divisor(self):
if not self.divisor:
self.ratio = Decimal('0.0')
else:
self.ratio = self.round(1 / self.divisor,
self.__class__.ratio.digits[1])
def get_date(self, date):
for relativedelta_ in self.relativedeltas:
date += relativedelta_.get()
return date
def get_value(self, remainder, amount, currency):
Currency = Pool().get('currency.currency')
if self.type == 'fixed':
fixed = Currency.compute(self.currency, self.amount, currency)
return fixed.copy_sign(amount)
elif self.type == 'percent':
return currency.round(remainder * self.ratio)
elif self.type == 'percent_on_total':
return currency.round(amount * self.ratio)
elif self.type == 'remainder':
return currency.round(remainder)
return None
@staticmethod
def round(number, digits):
quantize = Decimal(10) ** -Decimal(digits)
return Decimal(number).quantize(quantize)
@classmethod
def validate_fields(cls, lines, field_names):
super().validate_fields(lines, field_names)
cls.check_ratio_and_divisor(lines, field_names)
@classmethod
def check_ratio_and_divisor(cls, lines, field_names=None):
"Check consistency between ratio and divisor"
if field_names and not (field_names & {'type', 'ratio', 'divisor'}):
return
for line in lines:
if line.type not in ('percent', 'percent_on_total'):
continue
if line.ratio is None or line.divisor is None:
raise PaymentTermValidationError(
gettext('account_invoice'
'.msg_payment_term_invalid_ratio_divisor',
line=line.rec_name))
if (line.ratio != round(
1 / line.divisor, cls.ratio.digits[1])
and line.divisor != round(
1 / line.ratio, cls.divisor.digits[1])):
raise PaymentTermValidationError(
gettext('account_invoice'
'.msg_payment_term_invalid_ratio_divisor',
line=line.rec_name))
class PaymentTermLineRelativeDelta(sequence_ordered(), ModelSQL, ModelView):
'Payment Term Line Relative Delta'
__name__ = 'account.invoice.payment_term.line.delta'
line = fields.Many2One('account.invoice.payment_term.line',
'Payment Term Line', required=True, ondelete='CASCADE')
day = fields.Integer('Day of Month',
domain=['OR',
('day', '=', None),
[('day', '>=', 1), ('day', '<=', 31)],
])
month = fields.Many2One('ir.calendar.month', "Month")
weekday = fields.Many2One('ir.calendar.day', "Day of Week")
months = fields.Integer('Number of Months', required=True)
weeks = fields.Integer('Number of Weeks', required=True)
days = fields.Integer('Number of Days', required=True)
@classmethod
def __setup__(cls):
super().__setup__()
cls.__access__.add('line')
@classmethod
def __register__(cls, module_name):
transaction = Transaction()
cursor = transaction.connection.cursor()
pool = Pool()
Line = pool.get('account.invoice.payment_term.line')
Month = pool.get('ir.calendar.month')
Day = pool.get('ir.calendar.day')
sql_table = cls.__table__()
line = Line.__table__()
month = Month.__table__()
day = Day.__table__()
table_h = cls.__table_handler__(module_name)
# Migration from 4.0: rename long table
old_model_name = 'account.invoice.payment_term.line.relativedelta'
old_table = config.get(
'table', old_model_name, default=old_model_name.replace('.', '_'))
if backend.TableHandler.table_exist(old_table):
backend.TableHandler.table_rename(old_table, cls._table)
# Migration from 5.0: use ir.calendar
migrate_calendar = False
if (backend.TableHandler.table_exist(cls._table)
and table_h.column_exist('month')
and table_h.column_exist('weekday')):
migrate_calendar = (
table_h.column_is_type('month', 'VARCHAR')
or table_h.column_is_type('weekday', 'VARCHAR'))
if migrate_calendar:
table_h.column_rename('month', '_temp_month')
table_h.column_rename('weekday', '_temp_weekday')
super(PaymentTermLineRelativeDelta, cls).__register__(module_name)
table_h = cls.__table_handler__(module_name)
line_table = Line.__table_handler__(module_name)
# Migration from 3.4
fields = ['day', 'month', 'weekday', 'months', 'weeks', 'days']
if any(line_table.column_exist(f) for f in fields):
columns = ([line.id.as_('line')]
+ [Column(line, f) for f in fields])
cursor.execute(*sql_table.insert(
columns=[sql_table.line]
+ [Column(sql_table, f) for f in fields],
values=line.select(*columns)))
for field in fields:
line_table.drop_column(field)
# Migration from 5.0: use ir.calendar
if migrate_calendar:
update = transaction.connection.cursor()
cursor.execute(*month.select(month.id, month.index))
for month_id, index in cursor:
update.execute(*sql_table.update(
[sql_table.month], [month_id],
where=sql_table._temp_month == str(index)))
table_h.drop_column('_temp_month')
cursor.execute(*day.select(day.id, day.index))
for day_id, index in cursor:
update.execute(*sql_table.update(
[sql_table.weekday], [day_id],
where=sql_table._temp_weekday == str(index)))
table_h.drop_column('_temp_weekday')
@staticmethod
def default_months():
return 0
@staticmethod
def default_weeks():
return 0
@staticmethod
def default_days():
return 0
def get(self):
"Return the relativedelta"
return relativedelta(
day=self.day,
month=int(self.month.index) if self.month else None,
days=self.days,
weeks=self.weeks,
months=self.months,
weekday=int(self.weekday.index) if self.weekday else None,
)
class TestPaymentTerm(Wizard):
'Test Payment Term'
__name__ = 'account.invoice.payment_term.test'
start_state = 'test'
test = StateView('account.invoice.payment_term.test',
'account_invoice.payment_term_test_view_form',
[Button('Close', 'end', 'tryton-close', default=True)])
def default_test(self, fields):
default = {}
if (self.model
and self.model.__name__ == 'account.invoice.payment_term'):
default['payment_term'] = self.record.id if self.record else None
return default
class TestPaymentTermView(ModelView):
'Test Payment Term'
__name__ = 'account.invoice.payment_term.test'
payment_term = fields.Many2One('account.invoice.payment_term',
'Payment Term', required=True)
date = fields.Date("Date", required=True)
amount = Monetary(
"Amount", currency='currency', digits='currency', required=True)
currency = fields.Many2One('currency.currency', 'Currency', required=True)
result = fields.One2Many('account.invoice.payment_term.test.result',
None, 'Result', readonly=True)
@classmethod
def default_date(cls):
return Pool().get('ir.date').today()
@staticmethod
def default_currency():
pool = Pool()
Company = pool.get('company.company')
company = Transaction().context.get('company')
if company:
return Company(company).currency.id
@fields.depends('payment_term', 'date', 'amount', 'currency', 'result')
def on_change_with_result(self):
pool = Pool()
Result = pool.get('account.invoice.payment_term.test.result')
result = []
if (self.payment_term and self.amount and self.currency and self.date):
for date, amount in self.payment_term.compute(
self.amount, self.currency, self.date):
result.append(Result(
date=date,
amount=amount,
currency=self.currency))
self.result = result
return self._changed_values.get('result', [])
class TestPaymentTermViewResult(ModelView):
'Test Payment Term'
__name__ = 'account.invoice.payment_term.test.result'
date = fields.Date('Date', readonly=True)
amount = Monetary(
"Amount", currency='currency', digits='currency', readonly=True)
currency = fields.Many2One('currency.currency', "Currency")
+125
View File
@@ -0,0 +1,125 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<menuitem
name="Payment Terms"
parent="account.menu_account_configuration"
sequence="50"
id="menu_payment_terms_configuration"/>
<record model="ir.ui.view" id="payment_term_view_form">
<field name="model">account.invoice.payment_term</field>
<field name="type">form</field>
<field name="name">payment_term_form</field>
</record>
<record model="ir.ui.view" id="payment_term_view_tree">
<field name="model">account.invoice.payment_term</field>
<field name="type">tree</field>
<field name="name">payment_term_tree</field>
</record>
<record model="ir.action.act_window" id="act_payment_term_form">
<field name="name">Payment Terms</field>
<field name="res_model">account.invoice.payment_term</field>
</record>
<record model="ir.action.act_window.view" id="act_payment_term_form_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="payment_term_view_tree"/>
<field name="act_window" ref="act_payment_term_form"/>
</record>
<record model="ir.action.act_window.view" id="act_payment_term_form_view2">
<field name="sequence" eval="20"/>
<field name="view" ref="payment_term_view_form"/>
<field name="act_window" ref="act_payment_term_form"/>
</record>
<menuitem
parent="menu_payment_terms_configuration"
action="act_payment_term_form"
sequence="10"
id="menu_payment_term_form"/>
<record model="ir.model.access" id="access_payment_term">
<field name="model" search="[('model', '=', 'account.invoice.payment_term')]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_payment_term_account_admin">
<field name="model" search="[('model', '=', 'account.invoice.payment_term')]"/>
<field name="group" ref="account.group_account_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.ui.view" id="payment_term_line_view_list">
<field name="model">account.invoice.payment_term.line</field>
<field name="type">tree</field>
<field name="priority" eval="10"/>
<field name="name">payment_term_line_list</field>
</record>
<record model="ir.ui.view" id="payment_term_line_view_list_sequence">
<field name="model">account.invoice.payment_term.line</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="name">payment_term_line_list_sequence</field>
</record>
<record model="ir.ui.view" id="payment_term_line_view_form">
<field name="model">account.invoice.payment_term.line</field>
<field name="type">form</field>
<field name="name">payment_term_line_form</field>
</record>
<record model="ir.ui.view"
id="payment_term_line_relativedelta_view_list">
<field name="model">account.invoice.payment_term.line.delta</field>
<field name="type">tree</field>
<field name="priority" eval="10"/>
<field name="name">payment_term_line_relativedelta_list</field>
</record>
<record model="ir.ui.view"
id="payment_term_line_relativedelta_view_list_sequence">
<field name="model">account.invoice.payment_term.line.delta</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="name">payment_term_line_relativedelta_list_sequence</field>
</record>
<record model="ir.ui.view" id="payment_term_line_relativedelta_view_form">
<field name="model">account.invoice.payment_term.line.delta</field>
<field name="type">form</field>
<field name="name">payment_term_line_relativedelta_form</field>
</record>
<record model="ir.action.wizard" id="wizard_payment_term_test">
<field name="name">Test Payment Term</field>
<field name="wiz_name">account.invoice.payment_term.test</field>
</record>
<record model="ir.action.keyword"
id="wizard_payment_term_test_keyword1">
<field name="keyword">form_action</field>
<field name="model">account.invoice.payment_term,-1</field>
<field name="action" ref="wizard_payment_term_test"/>
</record>
<menuitem
parent="menu_payment_terms_configuration"
action="wizard_payment_term_test"
sequence="90"
id="menu_payment_term_test"/>
<record model="ir.ui.view" id="payment_term_test_view_form">
<field name="model">account.invoice.payment_term.test</field>
<field name="type">form</field>
<field name="name">payment_term_test_form</field>
</record>
<record model="ir.ui.view" id="payment_term_test_result_view_list">
<field name="model">account.invoice.payment_term.test.result</field>
<field name="type">tree</field>
<field name="name">payment_term_test_result_list</field>
</record>
</data>
</tryton>
+155
View File
@@ -0,0 +1,155 @@
#!/usr/bin/env python3
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import io
import os
import re
from configparser import ConfigParser
from setuptools import find_packages, setup
def read(fname):
content = io.open(
os.path.join(os.path.dirname(__file__), fname),
'r', encoding='utf-8').read()
content = re.sub(
r'(?m)^\.\. toctree::\r?\n((^$|^\s.*$)\r?\n)*', '', content)
return content
def get_require_version(name):
if minor_version % 2:
require = '%s >= %s.%s.dev0, < %s.%s'
else:
require = '%s >= %s.%s, < %s.%s'
require %= (name, major_version, minor_version,
major_version, minor_version + 1)
return require
config = ConfigParser()
config.read_file(open(os.path.join(os.path.dirname(__file__), 'tryton.cfg')))
info = dict(config.items('tryton'))
for key in ('depends', 'extras_depend', 'xml'):
if key in info:
info[key] = info[key].strip().splitlines()
version = info.get('version', '0.0.1')
major_version, minor_version, _ = version.split('.', 2)
major_version = int(major_version)
minor_version = int(minor_version)
name = 'trytond_account_invoice'
download_url = 'http://downloads.tryton.org/%s.%s/' % (
major_version, minor_version)
if minor_version % 2:
version = '%s.%s.dev0' % (major_version, minor_version)
download_url = (
'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % (
name[8:], name, version))
local_version = []
if os.environ.get('CI_JOB_ID'):
local_version.append(os.environ['CI_JOB_ID'])
else:
for build in ['CI_BUILD_NUMBER', 'CI_JOB_NUMBER']:
if os.environ.get(build):
local_version.append(os.environ[build])
else:
local_version = []
break
if local_version:
version += '+' + '.'.join(local_version)
requires = ['python-dateutil', 'python-sql >= 0.4']
for dep in info.get('depends', []):
if not re.match(r'(ir|res)(\W|$)', dep):
requires.append(get_require_version('trytond_%s' % dep))
requires.append(get_require_version('trytond'))
tests_require = [get_require_version('proteus')]
dependency_links = []
if minor_version % 2:
dependency_links.append(
'https://trydevpi.tryton.org/?local_version='
+ '.'.join(local_version))
setup(name=name,
version=version,
description='Tryton module for invoicing',
long_description=read('README.rst'),
author='Tryton',
author_email='bugs@tryton.org',
url='http://www.tryton.org/',
download_url=download_url,
project_urls={
"Bug Tracker": 'https://bugs.tryton.org/',
"Documentation":
'https://docs.tryton.org/projects/modules-account-invoice/',
"Forum": 'https://www.tryton.org/forum',
"Source Code": 'https://hg.tryton.org/modules/account_invoice',
},
keywords='tryton account invoice',
package_dir={'trytond.modules.account_invoice': '.'},
packages=(
['trytond.modules.account_invoice']
+ ['trytond.modules.account_invoice.%s' % p for p in find_packages()]
),
package_data={
'trytond.modules.account_invoice': (info.get('xml', [])
+ ['tryton.cfg', 'view/*.xml', 'locale/*.po', '*.fodt',
'icons/*.svg', 'tests/*.rst']),
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Plugins',
'Framework :: Tryton',
'Intended Audience :: Developers',
'Intended Audience :: Financial and Insurance Industry',
'Intended Audience :: Legal Industry',
'License :: OSI Approved :: '
'GNU General Public License v3 or later (GPLv3+)',
'Natural Language :: Bulgarian',
'Natural Language :: Catalan',
'Natural Language :: Chinese (Simplified)',
'Natural Language :: Czech',
'Natural Language :: Dutch',
'Natural Language :: English',
'Natural Language :: Finnish',
'Natural Language :: French',
'Natural Language :: German',
'Natural Language :: Hungarian',
'Natural Language :: Indonesian',
'Natural Language :: Italian',
'Natural Language :: Persian',
'Natural Language :: Polish',
'Natural Language :: Portuguese (Brazilian)',
'Natural Language :: Romanian',
'Natural Language :: Russian',
'Natural Language :: Slovenian',
'Natural Language :: Spanish',
'Natural Language :: Turkish',
'Natural Language :: Ukrainian',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Office/Business',
'Topic :: Office/Business :: Financial :: Accounting',
],
license='GPL-3',
python_requires='>=3.7',
install_requires=requires,
extras_require={
'test': tests_require,
},
dependency_links=dependency_links,
zip_safe=False,
entry_points="""
[trytond.modules]
account_invoice = trytond.modules.account_invoice
""",
)
@@ -0,0 +1,6 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from .test_module import set_invoice_sequences
__all__ = ['set_invoice_sequences']
@@ -0,0 +1,141 @@
====================
Credit Note Scenario
====================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts, create_tax
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> receivable = accounts['receivable']
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
>>> account_cash = accounts['cash']
Create tax::
>>> TaxCode = Model.get('account.tax.code')
>>> tax = create_tax(Decimal('.10'))
>>> tax.save()
Create payment method::
>>> Journal = Model.get('account.journal')
>>> PaymentMethod = Model.get('account.invoice.payment.method')
>>> Sequence = Model.get('ir.sequence')
>>> journal_cash, = Journal.find([('type', '=', 'cash')])
>>> payment_method = PaymentMethod()
>>> payment_method.name = 'Cash'
>>> payment_method.journal = journal_cash
>>> payment_method.credit_account = account_cash
>>> payment_method.debit_account = account_cash
>>> payment_method.save()
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create account category::
>>> ProductCategory = Model.get('product.category')
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = expense
>>> account_category.account_revenue = revenue
>>> account_category.customer_taxes.append(tax)
>>> account_category.save()
Create product::
>>> ProductUom = Model.get('product.uom')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'service'
>>> template.list_price = Decimal('40')
>>> template.account_category = account_category
>>> template.save()
>>> product, = template.products
Create credit note::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice()
>>> invoice.party = party
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = -5
>>> line.unit_price = Decimal('40')
>>> invoice.total_amount
Decimal('-220.00')
>>> invoice.save()
Post credit note::
>>> invoice.click('post')
>>> invoice.state
'posted'
Pay credit note::
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount
Decimal('-220.00')
>>> pay.form.amount = Decimal('-120.00')
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> pay.form.type = 'partial'
>>> pay.form.amount
Decimal('-120.00')
>>> len(pay.form.lines_to_pay)
1
>>> len(pay.form.payment_lines)
0
>>> len(pay.form.lines)
1
>>> pay.form.amount_writeoff
Decimal('-100.00')
>>> pay.execute('pay')
>>> pay.state
'end'
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount
Decimal('-100.00')
>>> pay.form.amount = Decimal('-100.00')
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> invoice.state
'paid'
>>> sorted(l.debit for l in invoice.reconciliation_lines)
[Decimal('100.00'), Decimal('120.00')]
@@ -0,0 +1,403 @@
================
Invoice Scenario
================
Imports::
>>> import datetime
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
>>> from operator import attrgetter
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts, create_tax, create_tax_code
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
>>> today = datetime.date.today()
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
>>> tax_identifier = company.party.identifiers.new()
>>> tax_identifier.type = 'eu_vat'
>>> tax_identifier.code = 'BE0897290877'
>>> company.party.save()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
>>> period = fiscalyear.periods[0]
>>> period_ids = [p.id for p in fiscalyear.periods]
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> receivable = accounts['receivable']
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
>>> account_tax = accounts['tax']
>>> account_cash = accounts['cash']
Create tax::
>>> TaxCode = Model.get('account.tax.code')
>>> tax = create_tax(Decimal('.10'))
>>> tax.save()
>>> invoice_base_code = create_tax_code(tax, 'base', 'invoice')
>>> invoice_base_code.save()
>>> invoice_tax_code = create_tax_code(tax, 'tax', 'invoice')
>>> invoice_tax_code.save()
>>> credit_note_base_code = create_tax_code(tax, 'base', 'credit')
>>> credit_note_base_code.save()
>>> credit_note_tax_code = create_tax_code(tax, 'tax', 'credit')
>>> credit_note_tax_code.save()
Create payment method::
>>> Journal = Model.get('account.journal')
>>> PaymentMethod = Model.get('account.invoice.payment.method')
>>> Sequence = Model.get('ir.sequence')
>>> journal_cash, = Journal.find([('type', '=', 'cash')])
>>> payment_method = PaymentMethod()
>>> payment_method.name = 'Cash'
>>> payment_method.journal = journal_cash
>>> payment_method.credit_account = account_cash
>>> payment_method.debit_account = account_cash
>>> payment_method.save()
Create Write Off method::
>>> WriteOff = Model.get('account.move.reconcile.write_off')
>>> sequence_journal, = Sequence.find(
... [('sequence_type.name', '=', "Account Journal")], limit=1)
>>> journal_writeoff = Journal(name='Write-Off', type='write-off',
... sequence=sequence_journal)
>>> journal_writeoff.save()
>>> writeoff_method = WriteOff()
>>> writeoff_method.name = 'Rate loss'
>>> writeoff_method.journal = journal_writeoff
>>> writeoff_method.credit_account = expense
>>> writeoff_method.debit_account = expense
>>> writeoff_method.save()
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create account category::
>>> ProductCategory = Model.get('product.category')
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = expense
>>> account_category.account_revenue = revenue
>>> account_category.customer_taxes.append(tax)
>>> account_category.save()
Create product::
>>> ProductUom = Model.get('product.uom')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'service'
>>> template.list_price = Decimal('40')
>>> template.account_category = account_category
>>> template.save()
>>> product, = template.products
Create payment term::
>>> PaymentTerm = Model.get('account.invoice.payment_term')
>>> payment_term = PaymentTerm(name='Term')
>>> line = payment_term.lines.new(type='percent', ratio=Decimal('.5'))
>>> delta, = line.relativedeltas
>>> delta.days = 20
>>> line = payment_term.lines.new(type='remainder')
>>> delta = line.relativedeltas.new(days=40)
>>> payment_term.save()
Create invoice::
>>> Invoice = Model.get('account.invoice')
>>> InvoiceLine = Model.get('account.invoice.line')
>>> invoice = Invoice()
>>> invoice.party = party
>>> invoice.payment_term = payment_term
>>> line = InvoiceLine()
>>> invoice.lines.append(line)
>>> line.product = product
>>> line.quantity = 5
>>> line.unit_price = Decimal('40')
>>> line = InvoiceLine()
>>> invoice.lines.append(line)
>>> line.account = revenue
>>> line.description = 'Test'
>>> line.quantity = 1
>>> line.unit_price = Decimal(20)
>>> invoice.untaxed_amount
Decimal('220.00')
>>> invoice.tax_amount
Decimal('20.00')
>>> invoice.total_amount
Decimal('240.00')
>>> invoice.save()
Test change tax::
>>> tax_line, = invoice.taxes
>>> tax_line.tax == tax
True
>>> tax_line.tax = None
>>> tax_line.tax = tax
Post invoice::
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> invoice.tax_identifier.code
'BE0897290877'
>>> invoice.untaxed_amount
Decimal('220.00')
>>> invoice.tax_amount
Decimal('20.00')
>>> invoice.total_amount
Decimal('240.00')
>>> receivable.reload()
>>> receivable.debit
Decimal('240.00')
>>> receivable.credit
Decimal('0.00')
>>> revenue.reload()
>>> revenue.debit
Decimal('0.00')
>>> revenue.credit
Decimal('220.00')
>>> account_tax.reload()
>>> account_tax.debit
Decimal('0.00')
>>> account_tax.credit
Decimal('20.00')
>>> with config.set_context(periods=period_ids):
... invoice_base_code = TaxCode(invoice_base_code.id)
... invoice_base_code.amount
Decimal('200.00')
>>> with config.set_context(periods=period_ids):
... invoice_tax_code = TaxCode(invoice_tax_code.id)
... invoice_tax_code.amount
Decimal('20.00')
>>> with config.set_context(periods=period_ids):
... credit_note_base_code = TaxCode(credit_note_base_code.id)
... credit_note_base_code.amount
Decimal('0.00')
>>> with config.set_context(periods=period_ids):
... credit_note_tax_code = TaxCode(credit_note_tax_code.id)
... credit_note_tax_code.amount
Decimal('0.00')
Credit invoice with refund::
>>> credit = Wizard('account.invoice.credit', [invoice])
>>> credit.form.with_refund = True
>>> credit.form.invoice_date = invoice.invoice_date
>>> credit.execute('credit')
>>> invoice.reload()
>>> invoice.state
'cancelled'
>>> invoice.reconciled == today
True
>>> credit_note, = Invoice.find([
... ('type', '=', 'out'), ('id', '!=', invoice.id)])
>>> credit_note.state
'paid'
>>> all(line.taxes_date == today for line in credit_note.lines)
True
>>> receivable.reload()
>>> receivable.debit
Decimal('240.00')
>>> receivable.credit
Decimal('240.00')
>>> revenue.reload()
>>> revenue.debit
Decimal('220.00')
>>> revenue.credit
Decimal('220.00')
>>> account_tax.reload()
>>> account_tax.debit
Decimal('20.00')
>>> account_tax.credit
Decimal('20.00')
>>> with config.set_context(periods=period_ids):
... invoice_base_code = TaxCode(invoice_base_code.id)
... invoice_base_code.amount
Decimal('200.00')
>>> with config.set_context(periods=period_ids):
... invoice_tax_code = TaxCode(invoice_tax_code.id)
... invoice_tax_code.amount
Decimal('20.00')
>>> with config.set_context(periods=period_ids):
... credit_note_base_code = TaxCode(credit_note_base_code.id)
... credit_note_base_code.amount
Decimal('200.00')
>>> with config.set_context(periods=period_ids):
... credit_note_tax_code = TaxCode(credit_note_tax_code.id)
... credit_note_tax_code.amount
Decimal('20.00')
Pay invoice::
>>> invoice, = invoice.duplicate()
>>> invoice.click('post')
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount
Decimal('240.00')
>>> pay.form.amount = Decimal('120.00')
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> pay.state
'end'
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount
Decimal('120.00')
>>> pay.form.amount = Decimal('20.00')
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> pay.form.type = 'partial'
>>> pay.form.amount
Decimal('20.00')
>>> len(pay.form.lines_to_pay)
1
>>> len(pay.form.payment_lines)
0
>>> len(pay.form.lines)
1
>>> pay.form.amount_writeoff
Decimal('100.00')
>>> pay.execute('pay')
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount
Decimal('-20.00')
>>> pay.form.amount = Decimal('99.00')
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> pay.form.type = 'writeoff'
>>> pay.form.writeoff = writeoff_method
>>> pay.form.amount
Decimal('99.00')
>>> len(pay.form.lines_to_pay)
1
>>> len(pay.form.payment_lines)
1
>>> len(pay.form.lines)
1
>>> pay.form.amount_writeoff
Decimal('1.00')
>>> pay.execute('pay')
>>> invoice.state
'paid'
>>> sorted(l.credit for l in invoice.reconciliation_lines)
[Decimal('1.00'), Decimal('20.00'), Decimal('99.00'), Decimal('120.00')]
Create empty invoice::
>>> invoice = Invoice()
>>> invoice.party = party
>>> invoice.payment_term = payment_term
>>> invoice.click('post')
>>> invoice.state
'paid'
Create some complex invoice and test its taxes base rounding::
>>> invoice = Invoice()
>>> invoice.party = party
>>> invoice.payment_term = payment_term
>>> invoice.invoice_date = today
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 1
>>> line.unit_price = Decimal('0.0035')
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 1
>>> line.unit_price = Decimal('0.0035')
>>> invoice.save()
>>> invoice.untaxed_amount
Decimal('0.00')
>>> invoice.taxes[0].base == invoice.untaxed_amount
True
>>> found_invoice, = Invoice.find([('untaxed_amount', '=', Decimal(0))])
>>> found_invoice.id == invoice.id
True
>>> found_invoice, = Invoice.find([('total_amount', '=', Decimal(0))])
>>> found_invoice.id == invoice.id
True
Clear company tax_identifier::
>>> tax_identifier, = company.party.identifiers
>>> tax_identifier.type = None
>>> tax_identifier.save()
Create a paid invoice::
>>> invoice = Invoice()
>>> invoice.party = party
>>> invoice.payment_term = payment_term
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 5
>>> line.unit_price = Decimal('40')
>>> invoice.click('post')
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> pay.state
'end'
>>> invoice.tax_identifier
>>> invoice.state
'paid'
The invoice is posted when the reconciliation is deleted::
>>> invoice.payment_lines[0].reconciliation.delete()
>>> invoice.reload()
>>> invoice.state
'posted'
>>> invoice.tax_identifier
Credit invoice with non line lines::
>>> invoice = Invoice()
>>> invoice.party = party
>>> invoice.payment_term = payment_term
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 5
>>> line.unit_price = Decimal('40')
>>> line = invoice.lines.new()
>>> line.type = 'comment'
>>> line.description = 'Comment'
>>> invoice.click('post')
>>> credit = Wizard('account.invoice.credit', [invoice])
>>> credit.form.with_refund = True
>>> credit.execute('credit')
@@ -0,0 +1,215 @@
===================================
Invoice Scenario Alternate Currency
===================================
Imports::
>>> import datetime
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
>>> from operator import attrgetter
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.currency.tests.tools import get_currency
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts, create_tax
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
>>> today = datetime.date.today()
>>> tomorrow = today + relativedelta(days=1)
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> currency = get_currency('USD')
>>> eur = get_currency('EUR')
>>> _ = create_company(currency=currency)
>>> company = get_company()
Set alternate currency rates::
>>> rate = eur.rates.new()
>>> rate.date = today
>>> rate.rate = eur.rates[0].rate
>>> rate = eur.rates.new()
>>> rate.date = tomorrow
>>> rate.rate = eur.rates[0].rate + Decimal('0.5')
>>> eur.save()
Create fiscal years::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company, today=today))
>>> fiscalyear.click('create_period')
>>> next_fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company, today=today + relativedelta(years=1)))
>>> next_fiscalyear.click('create_period')
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
>>> account_tax = accounts['tax']
>>> account_cash = accounts['cash']
Create tax::
>>> tax = create_tax(Decimal('.10'))
>>> tax.save()
Create payment method::
>>> Journal = Model.get('account.journal')
>>> PaymentMethod = Model.get('account.invoice.payment.method')
>>> Sequence = Model.get('ir.sequence')
>>> journal_cash, = Journal.find([('type', '=', 'cash')])
>>> payment_method = PaymentMethod()
>>> payment_method.name = 'Cash'
>>> payment_method.journal = journal_cash
>>> payment_method.credit_account = account_cash
>>> payment_method.debit_account = account_cash
>>> payment_method.save()
Create writeoff method::
>>> WriteOff = Model.get('account.move.reconcile.write_off')
>>> sequence_journal, = Sequence.find(
... [('sequence_type.name', '=', "Account Journal")])
>>> journal_writeoff = Journal(name='Write-Off', type='write-off',
... sequence=sequence_journal)
>>> journal_writeoff.save()
>>> writeoff = WriteOff()
>>> writeoff.name = 'Rate loss'
>>> writeoff.journal = journal_writeoff
>>> writeoff.credit_account = expense
>>> writeoff.debit_account = expense
>>> writeoff.save()
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create account category::
>>> ProductCategory = Model.get('product.category')
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = expense
>>> account_category.account_revenue = revenue
>>> account_category.customer_taxes.append(tax)
>>> account_category.save()
Create product::
>>> ProductUom = Model.get('product.uom')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'service'
>>> template.list_price = Decimal('40')
>>> template.account_category = account_category
>>> template.save()
>>> product, = template.products
Create invoice with alternate currency::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice()
>>> invoice.party = party
>>> invoice.currency = eur
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 5
>>> line.unit_price = Decimal('80')
>>> line.amount
Decimal('400.00')
>>> line = invoice.lines.new()
>>> line.account = revenue
>>> line.description = 'Test'
>>> line.quantity = 1
>>> line.unit_price = Decimal(20)
>>> line.amount
Decimal('20.00')
>>> invoice.untaxed_amount
Decimal('420.00')
>>> invoice.tax_amount
Decimal('40.00')
>>> invoice.total_amount
Decimal('460.00')
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> invoice.untaxed_amount
Decimal('420.00')
>>> invoice.tax_amount
Decimal('40.00')
>>> invoice.total_amount
Decimal('460.00')
Pay the invoice with rate change::
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount
Decimal('460.00')
>>> pay.form.payment_method = payment_method
>>> pay.form.date = tomorrow
>>> pay.execute('choice')
>>> pay.form.type = 'writeoff'
>>> pay.form.writeoff = writeoff
>>> pay.form.amount
Decimal('460.00')
>>> pay.form.currency == eur
True
>>> pay.form.amount_writeoff
Decimal('46.00')
>>> pay.form.currency_writeoff == currency
True
>>> pay.execute('pay')
>>> invoice.state
'paid'
Create negative tax::
>>> negative_tax = create_tax(Decimal('-.10'))
>>> negative_tax.save()
Create invoice with alternate currency and negative taxes::
>>> invoice = Invoice()
>>> invoice.party = party
>>> invoice.currency = eur
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 5
>>> line.unit_price = Decimal('80')
>>> _ = line.taxes.pop(0)
>>> line.taxes.append(negative_tax)
>>> line.amount
Decimal('400.00')
>>> invoice.untaxed_amount
Decimal('400.00')
>>> invoice.tax_amount
Decimal('-40.00')
>>> invoice.total_amount
Decimal('360.00')
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> invoice.untaxed_amount
Decimal('400.00')
>>> invoice.tax_amount
Decimal('-40.00')
>>> invoice.total_amount
Decimal('360.00')
@@ -0,0 +1,98 @@
==============================================
Invoice Scenario Alternate Currency Lower Rate
==============================================
Imports::
>>> import datetime
>>> from decimal import Decimal
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.currency.tests.tools import get_currency
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
>>> today = datetime.date.today()
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> currency = get_currency('USD')
>>> eur = get_currency('EUR')
>>> _ = create_company(currency=currency)
>>> company = get_company()
Set alternate currency rates::
>>> rate = eur.rates.new()
>>> rate.date = today
>>> rate.rate = Decimal('0.5')
>>> eur.save()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
Create payment method::
>>> Journal = Model.get('account.journal')
>>> PaymentMethod = Model.get('account.invoice.payment.method')
>>> Sequence = Model.get('ir.sequence')
>>> journal_cash, = Journal.find([('type', '=', 'cash')])
>>> payment_method = PaymentMethod()
>>> payment_method.name = 'Cash'
>>> payment_method.journal = journal_cash
>>> payment_method.credit_account = accounts['cash']
>>> payment_method.debit_account = accounts['cash']
>>> payment_method.save()
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create invoice with alternate currency::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice()
>>> invoice.party = party
>>> invoice.currency = eur
>>> line = invoice.lines.new()
>>> line.description = "Line"
>>> line.account = accounts['revenue']
>>> line.quantity = 5
>>> line.unit_price = Decimal('80')
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> invoice.total_amount
Decimal('400.00')
Pay the invoice::
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount
Decimal('400.00')
>>> pay.form.currency == eur
True
>>> pay.form.payment_method = payment_method
>>> pay.form.date = today
>>> pay.execute('choice')
>>> pay.state
'end'
>>> invoice.state
'paid'
@@ -0,0 +1,131 @@
==================================
Invoice Alternative Payee Scenario
==================================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import (
... create_company, get_company)
>>> from trytond.modules.account.tests.tools import (
... create_fiscalyear, create_chart, get_accounts)
>>> from trytond.modules.account_invoice.tests.tools import (
... set_fiscalyear_invoice_sequences)
Activate modules::
>>> config = activate_modules('account_invoice')
>>> Invoice = Model.get('account.invoice')
>>> Journal = Model.get('account.journal')
>>> PaymentMethod = Model.get('account.invoice.payment.method')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
>>> period = fiscalyear.periods[0]
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> journal_cash, = Journal.find([
... ('code', '=', 'CASH'),
... ])
>>> payment_method = PaymentMethod()
>>> payment_method.name = "Cash"
>>> payment_method.journal = journal_cash
>>> payment_method.credit_account = accounts['cash']
>>> payment_method.debit_account = accounts['cash']
>>> payment_method.save()
Create parties::
>>> Party = Model.get('party.party')
>>> party1 = Party(name="Party 1")
>>> party1.save()
>>> party2 = Party(name="Party 2")
>>> party2.save()
>>> party3 = Party(name="Party 3")
>>> party3.save()
Post customer invoice::
>>> invoice = Invoice()
>>> invoice.party = party1
>>> invoice.alternative_payees.append(Party(party2.id))
>>> line = invoice.lines.new()
>>> line.account = accounts['revenue']
>>> line.quantity = 1
>>> line.unit_price = Decimal(10)
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> len(invoice.lines_to_pay)
1
>>> invoice.amount_to_pay
Decimal('10.00')
>>> party1.reload()
>>> party1.receivable
Decimal('0.0')
>>> party2.reload()
>>> party2.receivable
Decimal('10.00')
>>> party3.reload()
>>> party3.receivable
Decimal('0.0')
Set another payee::
>>> delegate = Wizard(
... 'account.invoice.lines_to_pay.delegate', [invoice])
>>> delegate_lines, = delegate.actions
>>> delegate_lines.form.party = party3
>>> delegate_lines.execute('delegate')
>>> invoice.reload()
>>> invoice.state
'posted'
>>> len(invoice.lines_to_pay)
3
>>> invoice.amount_to_pay
Decimal('10.00')
>>> party1.reload()
>>> party1.receivable
Decimal('0.0')
>>> party2.reload()
>>> party2.receivable
Decimal('0.0')
>>> party3.reload()
>>> party3.receivable
Decimal('10.00')
Pay the invoice::
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.payee = party3
>>> pay.form.amount = Decimal('10.00')
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> pay.state
'end'
>>> invoice.state
'paid'
>>> len(invoice.payment_lines)
1
>>> len(invoice.reconciliation_lines)
1
@@ -0,0 +1,91 @@
===========================
Customer Invoice Sequential
===========================
Imports::
>>> from decimal import Decimal
>>> import datetime as dt
>>> from dateutil.relativedelta import relativedelta
>>> from proteus import Model
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
>>> today = dt.date.today()
>>> past_year = today - relativedelta(years=1)
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal years::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company, today=past_year))
>>> fiscalyear.click('create_period')
>>> next_fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company, today=today))
>>> next_fiscalyear.click('create_period')
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create invoice invoice second period and next year::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice(type='out')
>>> invoice.party = party
>>> invoice.invoice_date = fiscalyear.periods[1].start_date
>>> line = invoice.lines.new()
>>> line.quantity = 1
>>> line.unit_price = Decimal('10')
>>> line.account = accounts['revenue']
>>> invoice.click('post')
>>> invoice = Invoice(type='out')
>>> invoice.party = party
>>> invoice.invoice_date = next_fiscalyear.periods[0].start_date
>>> line = invoice.lines.new()
>>> line.quantity = 1
>>> line.unit_price = Decimal('20')
>>> line.account = accounts['revenue']
>>> invoice.click('post')
Try to post invoice on first period::
>>> invoice = Invoice(type='out')
>>> invoice.party = party
>>> invoice.invoice_date = fiscalyear.periods[0].start_date
>>> line = invoice.lines.new()
>>> line.quantity = 1
>>> line.unit_price = Decimal('5')
>>> line.account = accounts['revenue']
>>> invoice.save()
>>> invoice.click('post') # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
InvoiceNumberError: ...
Post invoice on the third period::
>>> invoice.invoice_date = fiscalyear.periods[2].start_date
>>> invoice.click('post')
@@ -0,0 +1,155 @@
================
Invoice Scenario
================
Imports::
>>> import datetime
>>> from decimal import Decimal
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
>>> period = fiscalyear.periods[0]
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> receivable = accounts['receivable']
>>> payable = accounts['payable']
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
>>> account_cash = accounts['cash']
>>> Journal = Model.get('account.journal')
>>> journal_cash, = Journal.find([
... ('code', '=', 'CASH'),
... ])
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Post customer invoice::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice()
>>> invoice.party = party
>>> line = invoice.lines.new()
>>> line.account = revenue
>>> line.quantity = 1
>>> line.unit_price = Decimal(10)
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> invoice.amount_to_pay
Decimal('10.00')
Post supplier invoice::
>>> supplier_invoice = Invoice(type='in')
>>> supplier_invoice.party = party
>>> supplier_invoice.invoice_date = period.start_date
>>> line = supplier_invoice.lines.new()
>>> line.account = expense
>>> line.quantity = 1
>>> line.unit_price = Decimal(5)
>>> supplier_invoice.click('post')
>>> supplier_invoice.state
'posted'
>>> supplier_invoice.amount_to_pay
Decimal('5.00')
Group lines::
>>> Line = Model.get('account.move.line')
>>> lines = Line.find([('account', 'in', [payable.id, receivable.id])])
>>> len(lines)
2
>>> group = Wizard('account.move.line.group', lines)
>>> group.form.journal = journal_cash
>>> group.execute('group')
>>> invoice.reload()
>>> invoice.state
'posted'
>>> invoice.amount_to_pay
Decimal('0')
>>> supplier_invoice.reload()
>>> supplier_invoice.state
'posted'
>>> supplier_invoice.amount_to_pay
Decimal('0')
Receive remaining line::
>>> Move = Model.get('account.move')
>>> move = Move()
>>> move.journal = journal_cash
>>> move.date = period.start_date
>>> line = move.lines.new()
>>> line.account = account_cash
>>> line.debit = Decimal(5)
>>> line = move.lines.new()
>>> line.account = receivable
>>> line.party = party
>>> line.credit = Decimal(5)
>>> move.click('post')
>>> lines = Line.find([
... ('account', '=', receivable.id),
... ('reconciliation', '=', None),
... ])
>>> reconcile_lines = Wizard('account.move.reconcile_lines', lines)
>>> reconcile_lines.state == 'end'
True
>>> invoice.reload()
>>> invoice.state
'paid'
>>> invoice.amount_to_pay
Decimal('0')
>>> supplier_invoice.reload()
>>> supplier_invoice.state
'paid'
>>> supplier_invoice.amount_to_pay
Decimal('0')
Remove the created reconciliation::
>>> Reconciliation = Model.get('account.move.reconciliation')
>>> reconciliation, = Reconciliation.find([('lines', '=', lines[0].id)])
>>> Reconciliation.delete([reconciliation])
>>> invoice.reload()
>>> invoice.state
'posted'
>>> invoice.amount_to_pay
Decimal('0')
>>> supplier_invoice.reload()
>>> supplier_invoice.state
'posted'
>>> supplier_invoice.amount_to_pay
Decimal('0')
@@ -0,0 +1,71 @@
=================
Invoice in Future
=================
Imports::
>>> import datetime
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import (create_company,
... get_company)
>>> from trytond.modules.account.tests.tools import (create_fiscalyear,
... create_chart, get_accounts)
>>> from trytond.modules.account_invoice.tests.tools import (
... set_fiscalyear_invoice_sequences)
>>> today = datetime.date.today()
>>> tomorrow = today + datetime.timedelta(days=1)
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> revenue = accounts['revenue']
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create invoice::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice()
>>> invoice.party = party
>>> line = invoice.lines.new()
>>> line.account = revenue
>>> line.description = 'Test'
>>> line.quantity = 1
>>> line.unit_price = Decimal(20)
Posting an invoice in the future raises a warning::
>>> invoice.invoice_date = tomorrow
>>> invoice.click('post') # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
InvoiceFutureWarning: ...
Post invoice::
>>> invoice.invoice_date = today
>>> invoice.click('post')
>>> invoice.state
'posted'
@@ -0,0 +1,87 @@
==================
Invoice Manual Tax
==================
Imports::
>>> import datetime as dt
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import (
... create_company, get_company)
>>> from trytond.modules.account.tests.tools import (
... create_fiscalyear, create_chart, get_accounts, create_tax,
... create_tax_code)
>>> from trytond.modules.account_invoice.tests.tools import (
... set_fiscalyear_invoice_sequences)
>>> today = dt.date.today()
Activate modules::
>>> config = activate_modules('account_invoice')
>>> Invoice = Model.get('account.invoice')
>>> Party = Model.get('party.party')
>>> TaxCode = Model.get('account.tax.code')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
>>> period_ids = [p.id for p in fiscalyear.periods]
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
Create tax::
>>> tax = create_tax(Decimal('.10'))
>>> tax.save()
>>> invoice_base_code = create_tax_code(tax, 'base', 'invoice')
>>> invoice_base_code.save()
>>> invoice_tax_code = create_tax_code(tax, 'tax', 'invoice')
>>> invoice_tax_code.save()
Create party::
>>> party = Party(name="Party")
>>> party.save()
Post a supplier invoice with manual taxes::
>>> invoice = Invoice(type='in')
>>> invoice.party = party
>>> invoice.invoice_date = today
>>> tax_line = invoice.taxes.new()
>>> bool(tax_line.manual)
True
>>> tax_line.tax = tax
>>> tax_line.base = Decimal('100')
>>> tax_line.amount
Decimal('10.00')
>>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount
(Decimal('0.00'), Decimal('10.00'), Decimal('10.00'))
Post invoice and check tax codes::
>>> invoice.click('post')
>>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount
(Decimal('0.00'), Decimal('10.00'), Decimal('10.00'))
>>> with config.set_context(periods=period_ids):
... invoice_base_code = TaxCode(invoice_base_code.id)
... invoice_base_code.amount
Decimal('100.00')
>>> with config.set_context(periods=period_ids):
... invoice_tax_code = TaxCode(invoice_tax_code.id)
... invoice_tax_code.amount
Decimal('10.00')
@@ -0,0 +1,119 @@
============================
Invoice Overpayment Scenario
============================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal years::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
Create payment method::
>>> Journal = Model.get('account.journal')
>>> PaymentMethod = Model.get('account.invoice.payment.method')
>>> Sequence = Model.get('ir.sequence')
>>> journal_cash, = Journal.find([('type', '=', 'cash')])
>>> payment_method = PaymentMethod()
>>> payment_method.name = 'Cash'
>>> payment_method.journal = journal_cash
>>> payment_method.credit_account = accounts['cash']
>>> payment_method.debit_account = accounts['cash']
>>> payment_method.save()
Create write-off method::
>>> WriteOff = Model.get('account.move.reconcile.write_off')
>>> sequence_journal, = Sequence.find(
... [('sequence_type.name', '=', "Account Journal")], limit=1)
>>> journal_writeoff = Journal(
... name='Write-Off', type='write-off', sequence=sequence_journal)
>>> journal_writeoff.save()
>>> writeoff = WriteOff()
>>> writeoff.name = 'Write-off'
>>> writeoff.journal = journal_writeoff
>>> writeoff.credit_account = accounts['expense']
>>> writeoff.debit_account = accounts['expense']
>>> writeoff.save()
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create an invoice::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice(party=party)
>>> line = invoice.lines.new()
>>> line.account = accounts['revenue']
>>> line.quantity = 1
>>> line.unit_price = Decimal('100')
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> invoice.total_amount
Decimal('100.00')
Overpay the invoice with write-off::
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount = Decimal('110.00')
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> pay.form.type = 'writeoff'
>>> pay.form.writeoff = writeoff
>>> pay.form.amount_writeoff
Decimal('-10.00')
>>> pay.execute('pay')
>>> invoice.state
'paid'
>>> accounts['receivable'].reload()
>>> accounts['receivable'].balance
Decimal('0.00')
Overpay the invoice without write-off::
>>> invoice, = invoice.duplicate()
>>> invoice.click('post')
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount = Decimal('110.00')
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> pay.form.type = 'overpayment'
>>> pay.execute('pay')
>>> invoice.state
'paid'
>>> accounts['receivable'].reload()
>>> accounts['receivable'].balance
Decimal('-10.00')
@@ -0,0 +1,109 @@
=================================
Invoice Reschedule Lines Scenario
=================================
Imports::
>>> from decimal import Decimal
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import (
... create_company, get_company)
>>> from trytond.modules.account.tests.tools import (
... create_fiscalyear, create_chart, get_accounts)
>>> from trytond.modules.account_invoice.tests.tools import (
... set_fiscalyear_invoice_sequences)
Activate modules::
>>> config = activate_modules('account_invoice')
>>> Invoice = Model.get('account.invoice')
>>> Journal = Model.get('account.journal')
>>> PaymentMethod = Model.get('account.invoice.payment.method')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
>>> period = fiscalyear.periods[0]
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> journal_cash, = Journal.find([
... ('code', '=', 'CASH'),
... ])
>>> payment_method = PaymentMethod()
>>> payment_method.name = "Cash"
>>> payment_method.journal = journal_cash
>>> payment_method.credit_account = accounts['cash']
>>> payment_method.debit_account = accounts['cash']
>>> payment_method.save()
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Post customer invoice::
>>> invoice = Invoice()
>>> invoice.party = party
>>> line = invoice.lines.new()
>>> line.account = accounts['revenue']
>>> line.quantity = 1
>>> line.unit_price = Decimal(10)
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> len(invoice.lines_to_pay)
1
>>> invoice.amount_to_pay
Decimal('10.00')
Reschedule line::
>>> reschedule = Wizard(
... 'account.invoice.lines_to_pay.reschedule', [invoice])
>>> reschedule_lines, = reschedule.actions
>>> reschedule_lines.form.total_amount
Decimal('10.00')
>>> reschedule_lines.form.start_date = period.end_date
>>> reschedule_lines.form.frequency ='monthly'
>>> reschedule_lines.form.number = 2
>>> reschedule_lines.execute('preview')
>>> reschedule_lines.execute('reschedule')
>>> invoice.reload()
>>> invoice.state
'posted'
>>> len(invoice.lines_to_pay)
4
>>> len([l for l in invoice.lines_to_pay if not l.reconciliation])
2
>>> invoice.amount_to_pay
Decimal('10.00')
Pay the invoice::
>>> pay = Wizard('account.invoice.pay', [invoice])
>>> pay.form.amount = Decimal('10.00')
>>> pay.form.payment_method = payment_method
>>> pay.execute('choice')
>>> pay.state
'end'
>>> invoice.state
'paid'
>>> len(invoice.reconciliation_lines)
1
@@ -0,0 +1,247 @@
=========================
Invoice Supplier Scenario
=========================
Imports::
>>> import datetime
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
>>> from operator import attrgetter
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts, create_tax, create_tax_code
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
>>> today = datetime.date.today()
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
>>> period_ids = [p.id for p in fiscalyear.periods]
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> payable = accounts['payable']
>>> revenue = accounts['revenue']
>>> expense = accounts['expense']
>>> account_tax = accounts['tax']
Create tax::
>>> TaxCode = Model.get('account.tax.code')
>>> tax = create_tax(Decimal('.10'))
>>> tax.save()
>>> invoice_base_code = create_tax_code(tax, 'base', 'invoice')
>>> invoice_base_code.save()
>>> invoice_tax_code = create_tax_code(tax, 'tax', 'invoice')
>>> invoice_tax_code.save()
>>> credit_note_base_code = create_tax_code(tax, 'base', 'credit')
>>> credit_note_base_code.save()
>>> credit_note_tax_code = create_tax_code(tax, 'tax', 'credit')
>>> credit_note_tax_code.save()
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create account category::
>>> ProductCategory = Model.get('product.category')
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = expense
>>> account_category.account_revenue = revenue
>>> account_category.supplier_taxes.append(tax)
>>> account_category.save()
Create product::
>>> ProductUom = Model.get('product.uom')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'service'
>>> template.list_price = Decimal('40')
>>> template.account_category = account_category
>>> template.save()
>>> product, = template.products
Create payment term::
>>> PaymentTerm = Model.get('account.invoice.payment_term')
>>> payment_term = PaymentTerm(name='Term')
>>> line = payment_term.lines.new(type='remainder')
>>> payment_term.save()
Create invoice::
>>> Invoice = Model.get('account.invoice')
>>> InvoiceLine = Model.get('account.invoice.line')
>>> invoice = Invoice()
>>> invoice.type = 'in'
>>> invoice.party = party
>>> invoice.payment_term = payment_term
>>> invoice.invoice_date = today
>>> invoice.reference = 'FAC001'
>>> line = InvoiceLine()
>>> invoice.lines.append(line)
>>> line.product = product
>>> line.quantity = 5
>>> line.unit_price = Decimal('20')
>>> line = InvoiceLine()
>>> invoice.lines.append(line)
>>> line.account = expense
>>> line.description = 'Test'
>>> line.quantity = 1
>>> line.unit_price = Decimal(10)
>>> invoice.untaxed_amount
Decimal('110.00')
>>> invoice.tax_amount
Decimal('10.00')
>>> invoice.total_amount
Decimal('120.00')
>>> invoice.save()
>>> invoice.state
'draft'
>>> bool(invoice.move)
False
>>> invoice.click('validate_invoice')
>>> invoice.state
'validated'
>>> bool(invoice.move)
True
>>> invoice.move.state
'draft'
>>> invoice.click('post')
>>> invoice.state
'posted'
>>> bool(invoice.move)
True
>>> invoice.move.state
'posted'
>>> invoice.untaxed_amount
Decimal('110.00')
>>> invoice.tax_amount
Decimal('10.00')
>>> invoice.total_amount
Decimal('120.00')
>>> payable.reload()
>>> payable.debit
Decimal('0.00')
>>> payable.credit
Decimal('120.00')
>>> expense.reload()
>>> expense.debit
Decimal('110.00')
>>> expense.credit
Decimal('0.00')
>>> account_tax.reload()
>>> account_tax.debit
Decimal('10.00')
>>> account_tax.credit
Decimal('0.00')
>>> with config.set_context(periods=period_ids):
... invoice_base_code = TaxCode(invoice_base_code.id)
... invoice_base_code.amount
Decimal('100.00')
>>> with config.set_context(periods=period_ids):
... invoice_tax_code = TaxCode(invoice_tax_code.id)
... invoice_tax_code.amount
Decimal('10.00')
>>> with config.set_context(periods=period_ids):
... credit_note_base_code = TaxCode(credit_note_base_code.id)
... credit_note_base_code.amount
Decimal('0.00')
>>> with config.set_context(periods=period_ids):
... credit_note_tax_code = TaxCode(credit_note_tax_code.id)
... credit_note_tax_code.amount
Decimal('0.00')
Credit invoice::
>>> credit = Wizard('account.invoice.credit', [invoice])
>>> credit.form.with_refund = False
>>> credit.execute('credit')
>>> credit_note, = Invoice.find(
... [('type', '=', 'in'), ('id', '!=', invoice.id)])
>>> credit_note.state
'draft'
>>> credit_note.untaxed_amount == -invoice.untaxed_amount
True
>>> credit_note.tax_amount == -invoice.tax_amount
True
>>> credit_note.total_amount == -invoice.total_amount
True
A warning is raised when creating an invoice with same reference::
>>> invoice = Invoice()
>>> invoice.type = 'in'
>>> invoice.party = party
>>> invoice.invoice_date = today
>>> invoice.reference = 'FAC001'
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 1
>>> line.unit_price = Decimal('20')
>>> invoice.click('post') # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
InvoiceSimilarWarning: ...
>>> invoice.reference = 'FAC002'
>>> invoice.click('post')
>>> invoice.state
'posted'
Create a posted and a draft invoice to cancel::
>>> invoice = Invoice()
>>> invoice.type = 'in'
>>> invoice.party = party
>>> invoice.payment_term = payment_term
>>> invoice.invoice_date = today
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 1
>>> line.unit_price = Decimal('20')
>>> invoice.click('post')
>>> invoice_draft, = Invoice.duplicate([invoice])
Cancel draft invoice::
>>> invoice_draft.click('cancel')
>>> invoice_draft.state
'cancelled'
>>> invoice_draft.move
>>> invoice_draft.reconciled
Cancel posted invoice::
>>> invoice.click('cancel')
>>> invoice.state
'cancelled'
>>> invoice.cancel_move is not None
True
>>> invoice.reconciled == today
True
@@ -0,0 +1,123 @@
==========================
Invoice Supplier Post Paid
==========================
Imports::
>>> import datetime
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
>>> from operator import attrgetter
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
>>> today = datetime.date.today()
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
>>> period = fiscalyear.periods[0]
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
>>> payable = accounts['payable']
>>> expense = accounts['expense']
>>> cash = accounts['cash']
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create account category::
>>> ProductCategory = Model.get('product.category')
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = expense
>>> account_category.save()
Create product::
>>> ProductUom = Model.get('product.uom')
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> ProductTemplate = Model.get('product.template')
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'service'
>>> template.list_price = Decimal('40')
>>> template.account_category = account_category
>>> template.save()
>>> product, = template.products
Create validated invoice::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice()
>>> invoice.type = 'in'
>>> invoice.party = party
>>> invoice.invoice_date = today
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 5
>>> line.unit_price = Decimal('20')
>>> invoice.click('validate_invoice')
>>> invoice.state
'validated'
Pay invoice::
>>> Move = Model.get('account.move')
>>> Journal = Model.get('account.journal')
>>> journal_cash, = Journal.find([
... ('code', '=', 'CASH'),
... ])
>>> move = Move()
>>> move.period = period
>>> move.journal = journal_cash
>>> move.date = period.start_date
>>> line = move.lines.new()
>>> line.account = payable
>>> line.debit = Decimal('100')
>>> line.party = party
>>> line = move.lines.new()
>>> line.account = cash
>>> line.credit = Decimal('100')
>>> move.save()
>>> Line = Model.get('account.move.line')
>>> lines = Line.find([('account', '=', payable.id)])
>>> reconcile = Wizard('account.move.reconcile_lines', lines)
Check invoice::
>>> invoice.reload()
>>> invoice.state
'validated'
>>> bool(invoice.reconciled)
True
Post invoice::
>>> invoice.click('post')
>>> invoice.state
'paid'
@@ -0,0 +1,115 @@
======================
Invoice Tax Deductible
======================
Imports::
>>> import datetime as dt
>>> from decimal import Decimal
>>> from proteus import Model
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import (
... create_company, get_company)
>>> from trytond.modules.account.tests.tools import (
... create_fiscalyear, create_chart, get_accounts, create_tax)
>>> from trytond.modules.account_invoice.tests.tools import (
... set_fiscalyear_invoice_sequences)
>>> today = dt.date.today()
Activate modules::
>>> config = activate_modules('account_invoice')
>>> Invoice = Model.get('account.invoice')
>>> Party = Model.get('party.party')
>>> ProductCategory = Model.get('product.category')
>>> ProductTemplate = Model.get('product.template')
>>> ProductUom = Model.get('product.uom')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
Create tax::
>>> tax = create_tax(Decimal('.10'))
>>> tax.save()
Create party::
>>> party = Party(name="Party")
>>> party.save()
Create account category::
>>> account_category = ProductCategory(name="Account Category")
>>> account_category.accounting = True
>>> account_category.account_expense = accounts['expense']
>>> account_category.supplier_taxes_deductible_rate = Decimal('.5')
>>> account_category.supplier_taxes.append(tax)
>>> account_category.save()
Create product::
>>> unit, = ProductUom.find([('name', '=', 'Unit')])
>>> template = ProductTemplate()
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'service'
>>> template.list_price = Decimal('100')
>>> template.account_category = account_category
>>> template.save()
>>> product, = template.products
Post a supplier invoice with 0% deductible::
>>> invoice = Invoice(type='in')
>>> invoice.party = party
>>> invoice.invoice_date = today
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 10
>>> line.unit_price = Decimal('50')
>>> line.taxes_deductible_rate
Decimal('0.5')
>>> line.taxes_deductible_rate = Decimal(0)
>>> line.amount
Decimal('550.00')
>>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount
(Decimal('550.00'), Decimal('0.00'), Decimal('550.00'))
>>> invoice.click('post')
>>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount
(Decimal('550.00'), Decimal('0'), Decimal('550.00'))
>>> len(invoice.taxes)
0
Post a supplier invoice with 50% deductible rate::
>>> invoice = Invoice(type='in')
>>> invoice.party = party
>>> invoice.invoice_date = today
>>> line = invoice.lines.new()
>>> line.product = product
>>> line.quantity = 10
>>> line.unit_price = Decimal('50')
>>> line.amount
Decimal('525.00')
>>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount
(Decimal('525.00'), Decimal('25.00'), Decimal('550.00'))
>>> invoice.click('post')
>>> invoice.untaxed_amount, invoice.tax_amount, invoice.total_amount
(Decimal('525.00'), Decimal('25.00'), Decimal('550.00'))
>>> len(invoice.taxes)
1
@@ -0,0 +1,110 @@
============================
Invoice with credit Scenario
============================
Imports::
>>> import datetime
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
>>> from operator import attrgetter
>>> from proteus import Model, Wizard
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear, \
... create_chart, get_accounts, create_tax, create_tax_code
>>> from trytond.modules.account_invoice.tests.tools import \
... set_fiscalyear_invoice_sequences
>>> today = datetime.date.today()
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> fiscalyear = set_fiscalyear_invoice_sequences(
... create_fiscalyear(company))
>>> fiscalyear.click('create_period')
>>> period_ids = [p.id for p in fiscalyear.periods]
Create chart of accounts::
>>> _ = create_chart(company)
>>> accounts = get_accounts(company)
Create tax::
>>> TaxCode = Model.get('account.tax.code')
>>> Tax = Model.get('account.tax')
>>> tax = create_tax(Decimal('.10'))
>>> tax.save()
>>> invoice_base_code = create_tax_code(tax, 'base', 'invoice')
>>> invoice_base_code.save()
>>> invoice_tax_code = create_tax_code(tax, 'tax', 'invoice')
>>> invoice_tax_code.save()
>>> credit_note_base_code = create_tax_code(tax, 'base', 'credit')
>>> credit_note_base_code.save()
>>> credit_note_tax_code = create_tax_code(tax, 'tax', 'credit')
>>> credit_note_tax_code.save()
Create party::
>>> Party = Model.get('party.party')
>>> party = Party(name='Party')
>>> party.save()
Create invoice::
>>> Invoice = Model.get('account.invoice')
>>> invoice = Invoice()
>>> invoice.party = party
>>> line = invoice.lines.new()
>>> line.account = accounts['revenue']
>>> line.quantity = 5
>>> line.unit_price = Decimal('10.0000')
>>> line.taxes.append(Tax(tax.id))
>>> line = invoice.lines.new()
>>> line.account = accounts['revenue']
>>> line.quantity = -2
>>> line.unit_price = Decimal('5.0000')
>>> line.taxes.append(Tax(tax.id))
>>> invoice.click('post')
>>> invoice.untaxed_amount
Decimal('40.00')
>>> invoice.tax_amount
Decimal('4.00')
>>> invoice.total_amount
Decimal('44.00')
Test taxes::
>>> len(invoice.taxes)
2
>>> accounts['tax'].reload()
>>> accounts['tax'].debit, accounts['tax'].credit
(Decimal('1.00'), Decimal('5.00'))
>>> with config.set_context(periods=period_ids):
... invoice_base_code = TaxCode(invoice_base_code.id)
... invoice_base_code.amount
Decimal('50.00')
>>> with config.set_context(periods=period_ids):
... invoice_tax_code = TaxCode(invoice_tax_code.id)
... invoice_tax_code.amount
Decimal('5.00')
>>> with config.set_context(periods=period_ids):
... credit_note_base_code = TaxCode(credit_note_base_code.id)
... credit_note_base_code.amount
Decimal('10.00')
>>> with config.set_context(periods=period_ids):
... credit_note_tax_code = TaxCode(credit_note_tax_code.id)
... credit_note_tax_code.amount
Decimal('1.00')
@@ -0,0 +1,106 @@
=========================
Renew Fiscalyear Scenario
=========================
Imports::
>>> import datetime
>>> from dateutil.relativedelta import relativedelta
>>> from decimal import Decimal
>>> from proteus import Model, Wizard, Report
>>> from trytond.tests.tools import activate_modules
>>> from trytond.modules.company.tests.tools import create_company, \
... get_company
>>> from trytond.modules.account.tests.tools import create_fiscalyear
>>> from trytond.modules.account_invoice.tests.tools \
... import set_fiscalyear_invoice_sequences
>>> today = datetime.date.today()
>>> end_year = today + relativedelta(month=12, day=31)
Activate modules::
>>> config = activate_modules('account_invoice')
Create company::
>>> _ = create_company()
>>> company = get_company()
Create fiscal year::
>>> InvoiceSequence = Model.get('account.fiscalyear.invoice_sequence')
>>> fiscalyear = create_fiscalyear(company)
>>> fiscalyear = set_fiscalyear_invoice_sequences(fiscalyear)
>>> fiscalyear.click('create_period')
>>> inv_seq, = fiscalyear.invoice_sequences
>>> seq = inv_seq.out_invoice_sequence
>>> for period in fiscalyear.periods:
... seq, = seq.duplicate()
... _ = inv_seq.duplicate(default={
... 'period': period.id,
... 'out_invoice_sequence': seq.id,
... 'in_invoice_sequence': seq.id,
... 'out_credit_note_sequence': seq.id,
... 'in_credit_note_sequence': seq.id,
... })
>>> period = fiscalyear.periods.new()
>>> period.name = 'Adjustment'
>>> period.start_date = end_year
>>> period.end_date = end_year
>>> period.type = 'adjustment'
>>> fiscalyear.save()
Set the sequence number::
>>> sequence = fiscalyear.post_move_sequence
>>> sequence.number_next = 10
>>> sequence.save()
>>> for i, seq in enumerate(fiscalyear.invoice_sequences):
... seq.out_invoice_sequence.number_next = i
... seq.out_invoice_sequence.save()
Renew fiscal year using the wizard::
>>> renew_fiscalyear = Wizard('account.fiscalyear.renew')
>>> renew_fiscalyear.form.reset_sequences = False
>>> renew_fiscalyear.execute('create_')
>>> new_fiscalyear, = renew_fiscalyear.actions[0]
>>> len(new_fiscalyear.periods)
12
>>> int(new_fiscalyear.post_move_sequence.number_next)
10
>>> [int(seq.out_invoice_sequence.number_next)
... for seq in fiscalyear.invoice_sequences]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
Renew fiscal year resetting sequences::
>>> renew_fiscalyear = Wizard('account.fiscalyear.renew')
>>> renew_fiscalyear.form.reset_sequences = True
>>> renew_fiscalyear.execute('create_')
>>> new_fiscalyear, = renew_fiscalyear.actions[0]
>>> int(new_fiscalyear.post_move_sequence.number_next)
1
>>> [int(seq.out_invoice_sequence.number_next)
... for seq in new_fiscalyear.invoice_sequences]
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
Set the sequence name::
>>> for seq in new_fiscalyear.invoice_sequences:
... seq.out_invoice_sequence.name = ('Sequence %s' %
... new_fiscalyear.start_date.strftime('%Y'))
... seq.out_invoice_sequence.save()
Renew fiscalyear and test sequence name is updated::
>>> renew_fiscalyear = Wizard('account.fiscalyear.renew')
>>> renew_fiscalyear.form.reset_sequences = True
>>> renew_fiscalyear.execute('create_')
>>> new_fiscalyear, = renew_fiscalyear.actions[0]
>>> all(seq.out_invoice_sequence.name ==
... 'Sequence %s' % new_fiscalyear.start_date.strftime('%Y')
... for seq in new_fiscalyear.invoice_sequences)
True
@@ -0,0 +1,255 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import datetime
from decimal import Decimal
from trytond.modules.account_invoice.exceptions import (
PaymentTermValidationError)
from trytond.modules.company.tests import (
CompanyTestMixin, PartyCompanyCheckEraseMixin)
from trytond.modules.currency.tests import create_currency
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
def set_invoice_sequences(fiscalyear):
pool = Pool()
Sequence = pool.get('ir.sequence.strict')
SequenceType = pool.get('ir.sequence.type')
InvoiceSequence = pool.get('account.fiscalyear.invoice_sequence')
sequence_type, = SequenceType.search([
('name', '=', "Invoice"),
], limit=1)
sequence = Sequence(name=fiscalyear.name, sequence_type=sequence_type)
sequence.company = fiscalyear.company
sequence.save()
fiscalyear.invoice_sequences = []
invoice_sequence = InvoiceSequence()
invoice_sequence.fiscalyear = fiscalyear
invoice_sequence.in_invoice_sequence = sequence
invoice_sequence.in_credit_note_sequence = sequence
invoice_sequence.out_invoice_sequence = sequence
invoice_sequence.out_credit_note_sequence = sequence
invoice_sequence.save()
return fiscalyear
class AccountInvoiceTestCase(
PartyCompanyCheckEraseMixin, CompanyTestMixin, ModuleTestCase):
'Test AccountInvoice module'
module = 'account_invoice'
@with_transaction()
def test_payment_term(self):
'Test payment_term'
pool = Pool()
PaymentTerm = pool.get('account.invoice.payment_term')
cu1 = create_currency('cu1')
term, = PaymentTerm.create([{
'name': '30 days, 1 month, 1 month + 15 days',
'lines': [
('create', [{
'sequence': 0,
'type': 'percent',
'divisor': 4,
'ratio': Decimal('.25'),
'relativedeltas': [('create', [{
'days': 30,
},
]),
],
}, {
'sequence': 1,
'type': 'percent_on_total',
'divisor': 4,
'ratio': Decimal('.25'),
'relativedeltas': [('create', [{
'months': 1,
},
]),
],
}, {
'sequence': 2,
'type': 'fixed',
'amount': Decimal('396.84'),
'currency': cu1.id,
'relativedeltas': [('create', [{
'months': 1,
'days': 30,
},
]),
],
}, {
'sequence': 3,
'type': 'remainder',
'relativedeltas': [('create', [{
'months': 2,
'days': 30,
'day': 15,
},
]),
],
}])]
}])
terms = term.compute(Decimal('1587.35'), cu1,
date=datetime.date(2011, 10, 1))
self.assertEqual(terms, [
(datetime.date(2011, 10, 31), Decimal('396.84')),
(datetime.date(2011, 11, 1), Decimal('396.84')),
(datetime.date(2011, 12, 1), Decimal('396.84')),
(datetime.date(2012, 1, 14), Decimal('396.83')),
])
@with_transaction()
def test_payment_term_with_repeating_decimal(self):
"Test payment_term with repeating decimal"
pool = Pool()
PaymentTerm = pool.get('account.invoice.payment_term')
PaymentTerm.create([{
'name': "Repeating Decimal",
'lines': [
('create', [{
'type': 'percent',
'divisor': Decimal(3),
'ratio': Decimal('0.3333333333'),
}, {
'type': 'remainder',
}]),
],
}])
@with_transaction()
def test_payment_term_with_invalid_ratio_divisor(self):
"Test payment_term with invalid ratio and divisor"
pool = Pool()
PaymentTerm = pool.get('account.invoice.payment_term')
with self.assertRaises(PaymentTermValidationError):
PaymentTerm.create([{
'name': "Invalid ratio and divisor",
'lines': [
('create', [{
'type': 'percent',
'divisor': Decimal(2),
'ratio': Decimal('0.4'),
}, {
'type': 'remainder',
}]),
],
}])
@with_transaction()
def test_payment_term_with_empty_value(self):
'Test payment_term with empty'
pool = Pool()
PaymentTerm = pool.get('account.invoice.payment_term')
cu1 = create_currency('cu1')
remainder_term, percent_term = PaymentTerm.create([{
'name': 'Remainder',
'lines': [
('create', [{'type': 'remainder',
'relativedeltas': [('create', [{
'months': 1,
},
]),
],
}])]
}, {
'name': '25% tomorrow, remainder un month later ',
'lines': [
('create', [{'type': 'percent',
'divisor': 4,
'ratio': Decimal('.25'),
'relativedeltas': [('create', [{
'days': 1,
},
]),
],
}, {'type': 'remainder',
'relativedeltas': [('create', [{
'months': 1,
},
]),
],
}])]
}])
terms = remainder_term.compute(Decimal('0.0'), cu1,
date=datetime.date(2016, 5, 17))
self.assertEqual(terms, [
(datetime.date(2016, 5, 17), Decimal('0.0')),
])
terms = percent_term.compute(Decimal('0.0'), cu1,
date=datetime.date(2016, 5, 17))
self.assertEqual(terms, [
(datetime.date(2016, 5, 17), Decimal('0.0')),
])
@with_transaction()
def test_negative_amount(self):
'Test payment term with negative amount'
pool = Pool()
PaymentTerm = pool.get('account.invoice.payment_term')
cu1 = create_currency('cu1')
term, = PaymentTerm.create([{
'name': '30 days, 1 month, 1 month + 15 days',
'lines': [
('create', [{
'sequence': 0,
'type': 'percent',
'divisor': 4,
'ratio': Decimal('.25'),
'relativedeltas': [('create', [{
'days': 30,
},
]),
],
}, {
'sequence': 1,
'type': 'percent_on_total',
'divisor': 4,
'ratio': Decimal('.25'),
'relativedeltas': [('create', [{
'months': 1,
},
]),
],
}, {
'sequence': 2,
'type': 'fixed',
'amount': Decimal('4.0'),
'currency': cu1.id,
'relativedeltas': [('create', [{
'months': 1,
'days': 30,
},
]),
],
}, {
'sequence': 3,
'type': 'remainder',
'relativedeltas': [('create', [{
'months': 2,
'days': 30,
'day': 15,
},
]),
],
}])]
}])
terms = term.compute(Decimal('-10.00'), cu1,
date=datetime.date(2011, 10, 1))
self.assertListEqual(terms, [
(datetime.date(2011, 10, 31), Decimal('-2.5')),
(datetime.date(2011, 11, 1), Decimal('-2.5')),
(datetime.date(2011, 12, 1), Decimal('-4.0')),
(datetime.date(2012, 1, 14), Decimal('-1.0')),
])
del ModuleTestCase
@@ -0,0 +1,8 @@
# This file is part of 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 load_doc_tests
def load_tests(*args, **kwargs):
return load_doc_tests(__name__, __file__, *args, **kwargs)
+35
View File
@@ -0,0 +1,35 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from proteus import Model
__all__ = ['set_fiscalyear_invoice_sequences']
def set_fiscalyear_invoice_sequences(fiscalyear, config=None):
"Set invoice sequences to fiscalyear"
SequenceStrict = Model.get('ir.sequence.strict', config=config)
SequenceType = Model.get('ir.sequence.type', config=config)
sequence_type, = SequenceType.find([
('name', '=', "Invoice"),
], limit=1)
invoice_seq = SequenceStrict(
name=fiscalyear.name,
sequence_type=sequence_type,
company=fiscalyear.company)
invoice_seq.save()
seq, = fiscalyear.invoice_sequences
seq.out_invoice_sequence = invoice_seq
seq.in_invoice_sequence = invoice_seq
seq.out_credit_note_sequence = invoice_seq
seq.in_credit_note_sequence = invoice_seq
return fiscalyear
def create_payment_term(config=None):
"Create a direct payment term"
PaymentTerm = Model.get('account.invoice.payment_term', config=config)
payment_term = PaymentTerm(name='Direct')
payment_term.lines.new(type='remainder')
return payment_term
+17
View File
@@ -0,0 +1,17 @@
[tox]
envlist = {py37,py38,py39,py310}-{sqlite,postgresql}
[testenv]
extras = test
commands =
coverage run --include=./**/account_invoice/* -m unittest discover -s tests
coverage report --include=./**/account_invoice/* --omit=*/tests/*
deps =
coverage
postgresql: psycopg2 >= 2.7.0
setenv =
sqlite: TRYTOND_DATABASE_URI={env:SQLITE_URI:sqlite://}
postgresql: TRYTOND_DATABASE_URI={env:POSTGRESQL_URI:postgresql://}
sqlite: DB_NAME={env:SQLITE_NAME::memory:}
postgresql: DB_NAME={env:POSTGRESQL_NAME:test}
install_command = pip install --pre --find-links https://trydevpi.tryton.org/?local_version={env:CI_JOB_ID:{env:CI_BUILD_NUMBER:}.{env:CI_JOB_NUMBER:}} {opts} {packages}
+18
View File
@@ -0,0 +1,18 @@
[tryton]
version=6.7.0
depends:
account
account_product
company
currency
ir
party
product
res
xml:
invoice.xml
payment_term.xml
party.xml
account.xml
company.xml
message.xml
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath
expr="//group[@id='checkboxes']/field[@name='active']"
position="after">
<label name="invoice"/>
<field name="invoice" xexpand="0" width="25"/>
</xpath>
</data>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath
expr="/tree/field[@name='subdivision']" position="after">
<field name="invoice" optional="1"/>
</xpath>
</data>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath
expr="/tree/field[@name='subdivision']" position="after">
<field name="invoice" optional="1"/>
</xpath>
</data>
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/notebook" position="inside">
<page string="Invoice" id="invoice">
<label name="purchase_taxes_expense"/>
<field name="purchase_taxes_expense"/>
<label name="cancel_invoice_out"/>
<field name="cancel_invoice_out"/>
</page>
</xpath>
</data>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="//field[@name='default_account_payable']" position="after">
<label name="default_customer_payment_term"/>
<field name="default_customer_payment_term"/>
<newline/>
</xpath>
</data>
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/group[@id='checkboxes']/field[@name='active']" position="after">
<label name="invoice"/>
<field name="invoice" xexpand="0" width="25"/>
</xpath>
</data>
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='party']" position="after">
<field name="invoice" optional="1"/>
</xpath>
</data>
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='party']" position="after">
<field name="invoice" optional="1"/>
</xpath>
</data>
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form col="2">
<image name="tryton-warning" xexpand="0" xfill="0"/>
<group col="2" id="credit_refund">
<label
string="Are you sure to credit these/this invoice(s)?"
id="credit" colspan="2"
yalign="0.0" xalign="0.0" xexpand="1"/>
<label name="with_refund"/>
<field name="with_refund"/>
<label name="invoice_date"/>
<field name="invoice_date"/>
</group>
</form>
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
<xpath
expr="/form/notebook/page[@id='sequences']/field[@name='post_move_sequence']"
position="after">
<field name="invoice_sequences" colspan="4" mode="form,tree"
view_ids="account_invoice.invoice_sequence_view_form,account_invoice.invoice_sequence_view_list_sequence"/>
</xpath>
</data>
@@ -0,0 +1,98 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form col="6" cursor="party">
<label name="type"/>
<field name="type"/>
<label name="journal"/>
<field name="journal"/>
<label name="number"/>
<field name="number"/>
<label name="party"/>
<field name="party"/>
<label name="invoice_address"/>
<field name="invoice_address"/>
<label name="party_tax_identifier" string="Tax Identifier:"/>
<field name="party_tax_identifier"/>
<label name="description"/>
<field name="description" colspan="3"/>
<label name="reference"/>
<field name="reference"/>
<notebook colspan="6">
<page string="Invoice" id="invoice" col="6">
<label name="invoice_date"/>
<field name="invoice_date"/>
<label name="payment_term"/>
<field name="payment_term"/>
<label name="currency"/>
<field name="currency"/>
<field name="lines" colspan="6"
view_ids="account_invoice.invoice_line_view_tree_sequence"/>
<group col="2" colspan="6" id="taxes_amount_state">
<field name="taxes"
view_ids="account_invoice.invoice_tax_view_tree_sequence"/>
<group col="4" colspan="1" id="amount_state" yfill="1">
<group col="2" colspan="2" id="reconciled_state" yfill="1">
<label name="reconciled"/>
<field name="reconciled"/>
<label name="state"/>
<field name="state"/>
</group>
<group col="2" colspan="2" id="amount" yfill="1">
<label name="untaxed_amount" xalign="1.0" xexpand="1"/>
<field name="untaxed_amount" xalign="1.0" xexpand="0"/>
<label name="tax_amount" xalign="1.0" xexpand="1"/>
<field name="tax_amount" xalign="1.0" xexpand="0"/>
<label name="total_amount" xalign="1.0" xexpand="1"/>
<field name="total_amount" xalign="1.0" xexpand="0"/>
</group>
</group>
</group>
</page>
<page string="Other Info" id="info">
<label name="company"/>
<field name="company"/>
<label name="tax_identifier"/>
<field name="tax_identifier"/>
<label name="account"/>
<field name="account"/>
<label name="accounting_date"/>
<field name="accounting_date"/>
<field name="alternative_payees" colspan="4"/>
<label name="move"/>
<field name="move"/>
<label name="cancel_move"/>
<field name="cancel_move"/>
<field name="additional_moves" colspan="4"/>
<separator name="comment" colspan="4"/>
<field name="comment" colspan="4"/>
</page>
<page string="Payment" id="payment">
<label name="payment_term_date"/>
<field name="payment_term_date"/>
<newline/>
<label name="amount_to_pay_today"/>
<field name="amount_to_pay_today"/>
<label name="amount_to_pay"/>
<field name="amount_to_pay"/>
<field name="lines_to_pay" colspan="4" view_ids="account_invoice.move_line_view_list_to_pay"/>
<group id="lines_to_pay_buttons" colspan="4" col="-1">
<button name="reschedule_lines_to_pay"/>
<button name="delegate_lines_to_pay"/>
</group>
<field name="payment_lines" colspan="4"
view_ids="account_invoice.move_line_view_list_payment"/>
<field name="reconciliation_lines" colspan="4" view_ids="account_invoice.move_line_view_list_payment"/>
</page>
</notebook>
<label id="empty" colspan="3"/>
<group col="-1" colspan="3" id="buttons">
<button name="cancel" icon="tryton-cancel"/>
<button name="draft" icon="tryton-back"/>
<button name="validate_invoice" icon="tryton-forward"/>
<button name="post" icon="tryton-ok"/>
<button name="pay" icon="tryton-forward"/>
<button name="process" icon="tryton-refresh"/>
</group>
<field name="party_lang" invisible="1" colspan="6"/>
</form>
@@ -0,0 +1,47 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form cursor="product">
<label name="invoice"/>
<field name="invoice" colspan="3"/>
<label name="type"/>
<field name="type"/>
<label name="sequence"/>
<field name="sequence"/>
<notebook colspan="4">
<page string="General" id="general">
<label name="product"/>
<field name="product"/>
<label name="account"/>
<field name="account"/>
<label name="quantity"/>
<field name="quantity"/>
<label name="unit"/>
<field name="unit"/>
<label name="unit_price"/>
<field name="unit_price"/>
<label name="amount"/>
<field name="amount"/>
<label name="taxes_date"/>
<field name="taxes_date"/>
<label name="taxes_deductible_rate"/>
<group col="2" id="taxes_deductible_rate">
<field name="taxes_deductible_rate" factor="100" xexpand="0"/>
<label name="taxes_deductible_rate" string="%" xalign="0.0" xexpand="1"/>
</group>
<field name="taxes" colspan="4"/>
<label name="origin"/>
<field name="origin" colspan="3"/>
</page>
<page name="description">
<separator name="description" colspan="4"/>
<field name="description" colspan="4"/>
</page>
<page string="Notes" id="notes">
<separator name="note" colspan="4"/>
<field name="note" colspan="4"/>
</page>
</notebook>
<field name="party_lang" invisible="1" colspan="4"/>
</form>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="invoice" expand="1"/>
<field name="type" optional="1"/>
<field name="product" expand="1" optional="0"/>
<field name="summary" expand="1" optional="1"/>
<field name="account" expand="1" optional="0"/>
<field name="quantity" symbol="unit"/>
<field name="unit_price"/>
<field name="taxes" optional="0"/>
<field name="amount"/>
</tree>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree sequence="sequence">
<field name="invoice" expand="1"/>
<field name="type" optional="1"/>
<field name="product" expand="1" optional="0"/>
<field name="summary" expand="1" optional="1"/>
<field name="account" expand="1" optional="0"/>
<field name="quantity" symbol="unit"/>
<field name="unit_price"/>
<field name="taxes" optional="0"/>
<field name="amount"/>
</tree>
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form>
<label name="company"/>
<field name="company"/>
<label name="sequence"/>
<field name="sequence"/>
<label name="fiscalyear"/>
<field name="fiscalyear"/>
<separator id="pattern" colspan="4"/>
<label name="period"/>
<field name="period"/>
<separator id="sequences" colspan="4"/>
<label name="in_invoice_sequence"/>
<field name="in_invoice_sequence"/>
<label name="in_credit_note_sequence"/>
<field name="in_credit_note_sequence"/>
<label name="out_invoice_sequence"/>
<field name="out_invoice_sequence"/>
<label name="out_credit_note_sequence"/>
<field name="out_credit_note_sequence"/>
</form>
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="company"/>
<field name="fiscalyear"/>
<field name="period"/>
<field name="in_invoice_sequence"/>
<field name="in_credit_note_sequence"/>
<field name="out_invoice_sequence"/>
<field name="out_credit_note_sequence"/>
</tree>
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree sequence="sequence">
<field name="company"/>
<field name="fiscalyear"/>
<field name="period"/>
<field name="in_invoice_sequence"/>
<field name="in_credit_note_sequence"/>
<field name="out_invoice_sequence"/>
<field name="out_credit_note_sequence"/>
</tree>
@@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form>
<label name="invoice"/>
<field name="invoice" colspan="3"/>
<label name="tax"/>
<field name="tax" colspan="3"/>
<label name="description"/>
<field name="description"/>
<label name="sequence"/>
<field name="sequence"/>
<label name="account"/>
<field name="account"/>
<label name="manual"/>
<field name="manual"/>
<label name="base"/>
<field name="base"/>
<label name="amount"/>
<field name="amount"/>
<separator name="legal_notice" colspan="4"/>
<field name="legal_notice" colspan="4"/>
</form>
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree>
<field name="invoice" expand="1"/>
<field name="tax" expand="1"/>
<field name="description" expand="1"/>
<field name="account" expand="1"/>
<field name="manual"/>
<field name="base"/>
<field name="amount"/>
</tree>
@@ -0,0 +1,13 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tree sequence="sequence">
<field name="description" expand="1"/>
<field name="base"/>
<field name="amount"/>
<field name="sequence" tree_invisible="1"/>
<field name="manual" tree_invisible="1"/>
<field name="account" tree_invisible="1"/>
<field name="tax" tree_invisible="1"/>
<field name="legal_notice" tree_invisible="1"/>
</tree>

Some files were not shown because too many files have changed in this diff Show More