mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Merge branch '16.0' into 16.0-test
This commit is contained in:
15
COPYRIGHT
Normal file
15
COPYRIGHT
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
Most of the files are
|
||||||
|
|
||||||
|
Copyright (c) 2016-2022 Hibou Corp.
|
||||||
|
|
||||||
|
Many files also contain contributions from third
|
||||||
|
parties. In this case the original copyright of
|
||||||
|
the contributions can be traced through the
|
||||||
|
history of the source version control system.
|
||||||
|
|
||||||
|
When that is not the case, the files contain a prominent
|
||||||
|
notice stating the original copyright and applicable
|
||||||
|
license, or come with their own dedicated COPYRIGHT
|
||||||
|
and/or LICENSE file.
|
||||||
|
|
||||||
329
LICENSE
329
LICENSE
@@ -1,5 +1,188 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 19 November 2007
|
For copyright information, please see the COPYRIGHT file.
|
||||||
|
|
||||||
|
Hibou Odoo Suite (and Odoo) is published under the GNU LESSER GENERAL
|
||||||
|
PUBLIC LICENSE, Version 3 (LGPLv3), as included below.
|
||||||
|
Because the LGPL is a set of additional permissions on top of the GPL,
|
||||||
|
the text of the GPL is included at the bottom as well.
|
||||||
|
|
||||||
|
Some external libraries and contributions bundled with Hibou Odoo Suite
|
||||||
|
may be published under other GPL-compatible licenses. For these, please
|
||||||
|
refer to the relevant source files and/or license files,
|
||||||
|
in the source code tree.
|
||||||
|
|
||||||
|
**************************************************************************
|
||||||
|
|
||||||
|
GNU LESSER 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.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser 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
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
**************************************************************************
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
@@ -7,15 +190,17 @@
|
|||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
The GNU General Public License is a free, copyleft license for
|
||||||
software and other kinds of works, specifically designed to ensure
|
software and other kinds of works.
|
||||||
cooperation with the community in the case of network server software.
|
|
||||||
|
|
||||||
The licenses for most software and other practical works are designed
|
The licenses for most software and other practical works are designed
|
||||||
to take away your freedom to share and change the works. By contrast,
|
to take away your freedom to share and change the works. By contrast,
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
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
|
share and change all versions of a program--to make sure it remains free
|
||||||
software for all its users.
|
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
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
@@ -24,34 +209,44 @@ 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
|
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.
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
Developers that use our General Public Licenses protect your rights
|
To protect your rights, we need to prevent others from denying you
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
you this License which gives you legal permission to copy, distribute
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
and/or modify the software.
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
For example, if you distribute copies of such a program, whether
|
||||||
improvements made in alternate versions of the program, if they
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
receive widespread use, become available for other developers to
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
incorporate. Many developers of free software are heartened and
|
or can get the source code. And you must show them these terms so they
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
know their rights.
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
ensure that, in such cases, the modified source code becomes available
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
to the community. It requires the operator of a network server to
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
that there is no warranty for this free software. For both users' and
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
changed, so that their problems will not be attributed erroneously to
|
||||||
this license.
|
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
|
The precise terms and conditions for copying, distribution and
|
||||||
modification follow.
|
modification follow.
|
||||||
@@ -60,7 +255,7 @@ modification follow.
|
|||||||
|
|
||||||
0. Definitions.
|
0. Definitions.
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
works, such as semiconductor masks.
|
works, such as semiconductor masks.
|
||||||
@@ -537,45 +732,35 @@ 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
|
the Program, the only way you could satisfy both those terms and this
|
||||||
License would be to refrain entirely from conveying the Program.
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
Notwithstanding any other provision of this License, you have
|
||||||
permission to link or combine any covered work with a work licensed
|
permission to link or combine any covered work with a work licensed
|
||||||
under version 3 of the GNU General Public License into a single
|
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
|
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,
|
License will continue to apply to the part which is the covered work,
|
||||||
but the work with which it is combined will remain governed by version
|
but the special requirements of the GNU Affero General Public License,
|
||||||
3 of the GNU General Public License.
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
the GNU General Public License from time to time. Such new versions will
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
address new problems or concerns.
|
address new problems or concerns.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
Each version is given a distinguishing version number. If the
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
Program specifies that a certain numbered version of the GNU General
|
||||||
Public License "or any later version" applies to it, you have the
|
Public License "or any later version" applies to it, you have the
|
||||||
option of following the terms and conditions either of that numbered
|
option of following the terms and conditions either of that numbered
|
||||||
version or of any later version published by the Free Software
|
version or of any later version published by the Free Software
|
||||||
Foundation. If the Program does not specify a version number of the
|
Foundation. If the Program does not specify a version number of the
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
GNU General Public License, you may choose any version ever published
|
||||||
by the Free Software Foundation.
|
by the Free Software Foundation.
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
If the Program specifies that a proxy can decide which future
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
public statement of acceptance of a version permanently authorizes you
|
public statement of acceptance of a version permanently authorizes you
|
||||||
to choose that version for the Program.
|
to choose that version for the Program.
|
||||||
|
|
||||||
@@ -633,29 +818,43 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
Copyright (C) <year> <name of author>
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published
|
it under the terms of the GNU General Public License as published by
|
||||||
by the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU Affero General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
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.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
If the program does terminal interaction, make it output a short
|
||||||
network, you should also make sure that it provides a way for users to
|
notice like this when it starts in an interactive mode:
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
<program> Copyright (C) <year> <name of author>
|
||||||
of the code. There are many ways you could offer source, and different
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
solutions will be better for different programs; see section 13 for the
|
This is free software, and you are welcome to redistribute it
|
||||||
specific requirements.
|
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,
|
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.
|
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 AGPL, see
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
<http://www.gnu.org/licenses/>.
|
<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>.
|
||||||
|
|
||||||
|
|
||||||
|
**************************************************************************
|
||||||
28
account_invoice_margin/README.rst
Normal file
28
account_invoice_margin/README.rst
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
******************************
|
||||||
|
Hibou - Account Invoice Margin
|
||||||
|
******************************
|
||||||
|
|
||||||
|
Include a margin calculation on invoices.
|
||||||
|
|
||||||
|
For more information and add-ons, visit `Hibou.io <https://hibou.io/docs/hibou-odoo-suite-1/invoice-margin-156>`_.
|
||||||
|
|
||||||
|
|
||||||
|
=============
|
||||||
|
Main Features
|
||||||
|
=============
|
||||||
|
|
||||||
|
* Adds computed field `margin` to invoices to give the profitability by calculating the difference between the Unit Price and the Cost.
|
||||||
|
|
||||||
|
.. image:: https://user-images.githubusercontent.com/15882954/45578631-880c0000-b837-11e8-9c4d-d2f15c3c0592.png
|
||||||
|
:alt: 'Customer Invoice'
|
||||||
|
:width: 988
|
||||||
|
:align: left
|
||||||
|
|
||||||
|
|
||||||
|
=======
|
||||||
|
License
|
||||||
|
=======
|
||||||
|
|
||||||
|
Please see `LICENSE <https://github.com/hibou-io/hibou-odoo-suite/blob/16.0/LICENSE>`_.
|
||||||
|
|
||||||
|
Copyright Hibou Corp. 2023
|
||||||
1
account_invoice_margin/__init__.py
Normal file
1
account_invoice_margin/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import models
|
||||||
24
account_invoice_margin/__manifest__.py
Executable file
24
account_invoice_margin/__manifest__.py
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
'name': 'Invoice Margin',
|
||||||
|
'author': 'Hibou Corp. <hello@hibou.io>',
|
||||||
|
'version': '16.0.1.1.0',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'category': 'Accounting',
|
||||||
|
'sequence': 95,
|
||||||
|
'summary': 'Invoices include margin calculation.',
|
||||||
|
'description': """
|
||||||
|
Invoices include margin calculation.
|
||||||
|
If the invoice line comes from a sale order line, the cost will come
|
||||||
|
from the sale order line.
|
||||||
|
""",
|
||||||
|
'website': 'https://hibou.io/',
|
||||||
|
'depends': [
|
||||||
|
'account',
|
||||||
|
'sale_margin',
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'views/account_invoice_views.xml',
|
||||||
|
],
|
||||||
|
'installable': True,
|
||||||
|
'application': False,
|
||||||
|
}
|
||||||
48
account_invoice_margin/i18n/es.po
Normal file
48
account_invoice_margin/i18n/es.po
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * account_invoice_margin
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 15.0+e\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2021-10-11 16:27+0000\n"
|
||||||
|
"PO-Revision-Date: 2021-10-11 16:27+0000\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
|
#. module: account_invoice_margin
|
||||||
|
#: model:ir.model.fields,field_description:account_invoice_margin.field_account_move_line__purchase_price
|
||||||
|
msgid "Cost"
|
||||||
|
msgstr "Costo"
|
||||||
|
|
||||||
|
#. module: account_invoice_margin
|
||||||
|
#: model:ir.model.fields,help:account_invoice_margin.field_account_bank_statement_line__margin
|
||||||
|
#: model:ir.model.fields,help:account_invoice_margin.field_account_move__margin
|
||||||
|
#: model:ir.model.fields,help:account_invoice_margin.field_account_payment__margin
|
||||||
|
msgid ""
|
||||||
|
"It gives profitability by calculating the difference between the Unit Price"
|
||||||
|
"and the cost."
|
||||||
|
msgstr "Da la rentabilidad calculando la diferencia entre el precio unitario y costo del producto"
|
||||||
|
|
||||||
|
#. module: account_invoice_margin
|
||||||
|
#: model:ir.model,name:account_invoice_margin.model_account_move
|
||||||
|
msgid "Journal Entry"
|
||||||
|
msgstr "Asiento contable"
|
||||||
|
|
||||||
|
#. module: account_invoice_margin
|
||||||
|
#: model:ir.model,name:account_invoice_margin.model_account_move_line
|
||||||
|
msgid "Journal Item"
|
||||||
|
msgstr "Apunte contable"
|
||||||
|
|
||||||
|
#. module: account_invoice_margin
|
||||||
|
#: model:ir.model.fields,field_description:account_invoice_margin.field_account_bank_statement_line__margin
|
||||||
|
#: model:ir.model.fields,field_description:account_invoice_margin.field_account_move__margin
|
||||||
|
#: model:ir.model.fields,field_description:account_invoice_margin.field_account_move_line__margin
|
||||||
|
#: model:ir.model.fields,field_description:account_invoice_margin.field_account_payment__margin
|
||||||
|
msgid "Margin"
|
||||||
|
msgstr "Margen"
|
||||||
1
account_invoice_margin/models/__init__.py
Normal file
1
account_invoice_margin/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import account_invoice
|
||||||
74
account_invoice_margin/models/account_invoice.py
Normal file
74
account_invoice_margin/models/account_invoice.py
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class AccountMoveLine(models.Model):
|
||||||
|
_inherit = "account.move.line"
|
||||||
|
|
||||||
|
margin = fields.Monetary(compute='_compute_product_margin', digits='Product Price', store=True,
|
||||||
|
groups='base.group_user')
|
||||||
|
margin_percent = fields.Float(compute='_product_margin', store=True, string='Margin (%)',
|
||||||
|
groups='base.group_user')
|
||||||
|
purchase_price = fields.Monetary(string='Cost', digits='Product Price',
|
||||||
|
groups='base.group_user')
|
||||||
|
|
||||||
|
# Note we are keeping this API because it is easy to customize and extend the purchase price/margin calculation
|
||||||
|
def _compute_margin(self, move, product, product_uom, sale_lines):
|
||||||
|
# if sale_line_ids and don't re-browse
|
||||||
|
for line in sale_lines:
|
||||||
|
return line.purchase_price
|
||||||
|
frm_cur = move.company_currency_id
|
||||||
|
to_cur = move.currency_id
|
||||||
|
purchase_price = product.standard_price
|
||||||
|
if product_uom and product_uom != product.uom_id:
|
||||||
|
purchase_price = product.uom_id._compute_price(purchase_price, product_uom)
|
||||||
|
ctx = self.env.context.copy()
|
||||||
|
ctx['date'] = move.date if move.date else fields.Date.context_today(move)
|
||||||
|
price = frm_cur.with_context(ctx)._convert(purchase_price, to_cur, move.company_id, ctx['date'], round=False)
|
||||||
|
return price
|
||||||
|
|
||||||
|
@api.onchange('product_id', 'product_uom_id')
|
||||||
|
def product_id_change_margin(self):
|
||||||
|
for line in self:
|
||||||
|
if not line.product_id:
|
||||||
|
line.purchase_price = 0.0
|
||||||
|
else:
|
||||||
|
line.purchase_price = line._compute_margin(line.move_id, line.product_id, line.product_uom_id, line.sale_line_ids)
|
||||||
|
|
||||||
|
@api.model_create_multi
|
||||||
|
def create(self, vals):
|
||||||
|
lines = super(AccountMoveLine, self).create(vals)
|
||||||
|
if vals and 'purchase_price' not in vals[0]:
|
||||||
|
lines.product_id_change_margin()
|
||||||
|
return lines
|
||||||
|
|
||||||
|
@api.depends('product_id', 'purchase_price', 'quantity', 'price_unit', 'price_subtotal')
|
||||||
|
def _compute_product_margin(self):
|
||||||
|
for line in self:
|
||||||
|
currency = line.move_id.currency_id
|
||||||
|
price = line.purchase_price
|
||||||
|
margin = line.price_subtotal - (price * line.quantity)
|
||||||
|
if line.product_id and not price:
|
||||||
|
date = line.move_id.date if line.move_id.date else fields.Date.context_today(line.move_id)
|
||||||
|
from_cur = line.move_id.company_currency_id.with_context(date=date)
|
||||||
|
price = from_cur._convert(line.product_id.standard_price, currency, line.company_id, date, round=False)
|
||||||
|
margin = line.price_subtotal - (price * line.quantity)
|
||||||
|
|
||||||
|
line.margin = currency.round(margin) if currency else margin
|
||||||
|
line.margin_percent = 1.0 if not line.price_subtotal else line.margin / line.price_subtotal
|
||||||
|
|
||||||
|
|
||||||
|
class AccountMove(models.Model):
|
||||||
|
_inherit = "account.move"
|
||||||
|
|
||||||
|
margin = fields.Monetary(compute='_compute_product_margin', store=True, digits='Product Price',
|
||||||
|
help="Profitability by calculating the difference between the Unit Price and the cost.",
|
||||||
|
groups='base.group_user')
|
||||||
|
margin_percent = fields.Float(compute='_compute_product_margin', store=True, string='Margin (%)',
|
||||||
|
groups='base.group_user')
|
||||||
|
|
||||||
|
@api.depends('invoice_line_ids.margin', 'invoice_line_ids.price_subtotal')
|
||||||
|
def _compute_product_margin(self):
|
||||||
|
for invoice in self:
|
||||||
|
invoice.margin = sum(invoice.invoice_line_ids.mapped('margin'))
|
||||||
|
total_price_subtotal = sum(invoice.invoice_line_ids.mapped('price_subtotal'))
|
||||||
|
invoice.margin_percent = 1.0 if not total_price_subtotal else invoice.margin / total_price_subtotal
|
||||||
1
account_invoice_margin/tests/__init__.py
Normal file
1
account_invoice_margin/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import test_invoice_margin
|
||||||
60
account_invoice_margin/tests/test_invoice_margin.py
Normal file
60
account_invoice_margin/tests/test_invoice_margin.py
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
from odoo.fields import Command
|
||||||
|
from odoo.addons.sale_margin.tests.test_sale_margin import TestSaleMargin
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
class TestInvoiceMargin(TestSaleMargin):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestInvoiceMargin, self).setUp()
|
||||||
|
self.AccountMove = self.env['account.move']
|
||||||
|
self.SaleOrder = self.env['sale.order']
|
||||||
|
|
||||||
|
def test_invoice_margin(self):
|
||||||
|
self.product.standard_price = 700.0
|
||||||
|
order = self.empty_order
|
||||||
|
|
||||||
|
order.order_line = [
|
||||||
|
Command.create({
|
||||||
|
'price_unit': 1000.0,
|
||||||
|
'product_uom_qty': 10.0,
|
||||||
|
'product_id': self.product.id,
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
# Confirm the sales order.
|
||||||
|
order.action_confirm()
|
||||||
|
# Verify that margin field gets bind with the value.
|
||||||
|
self.assertEqual(order.margin, 3000.00, "Sales order profit should be 6000.00")
|
||||||
|
self.assertEqual(order.margin_percent, 0.3, "Sales order margin should be 30%")
|
||||||
|
|
||||||
|
order.order_line.write({'qty_delivered': 10.0})
|
||||||
|
|
||||||
|
# Invoice the sales order.
|
||||||
|
inv = order._create_invoices()
|
||||||
|
self.assertEqual(inv.margin, order.margin)
|
||||||
|
self.assertEqual(inv.margin_percent, order.margin_percent)
|
||||||
|
|
||||||
|
account = self.env['account.account'].search([('account_type', '=', 'expense')], limit=1)
|
||||||
|
self.assertTrue(account)
|
||||||
|
inv = self.AccountMove.create({
|
||||||
|
'move_type': 'in_invoice',
|
||||||
|
'partner_id': order.partner_id.id,
|
||||||
|
'invoice_line_ids': [
|
||||||
|
(0, 0, {
|
||||||
|
'account_id': account.id,
|
||||||
|
'name': '[CARD] Graphics Card',
|
||||||
|
'price_unit': 1000.0,
|
||||||
|
'purchase_price': 600.0,
|
||||||
|
'quantity': 10.0,
|
||||||
|
'product_id': self.product.id}),
|
||||||
|
(0, 0, {
|
||||||
|
'account_id': account.id,
|
||||||
|
'name': 'Line without product_uom',
|
||||||
|
'price_unit': 1000.0,
|
||||||
|
'purchase_price': 800.0,
|
||||||
|
'quantity': 10.0,})
|
||||||
|
],
|
||||||
|
})
|
||||||
|
self.assertEqual(len(inv.invoice_line_ids), 2)
|
||||||
|
self.assertEqual(inv.margin, 6000.0)
|
||||||
|
self.assertEqual(inv.margin_percent, 0.3)
|
||||||
21
account_invoice_margin/views/account_invoice_views.xml
Normal file
21
account_invoice_margin/views/account_invoice_views.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="invoice_margin_form">
|
||||||
|
<field name="name">account.invoice.margin.view.form</field>
|
||||||
|
<field name="model">account.move</field>
|
||||||
|
<field name="inherit_id" ref="account.view_move_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='amount_residual']" position="after">
|
||||||
|
<field name="margin" groups="base.group_user"/>
|
||||||
|
<span class="oe_inline" groups="base.group_user">
|
||||||
|
(<field name="margin_percent" nolabel="1" class="oe_inline" widget="percentage"/>)
|
||||||
|
</span>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='invoice_line_ids']//field[@name='price_unit']" position="after">
|
||||||
|
<field name="purchase_price" groups="base.group_user"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user