-
-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] purchase_procurement_analytic: Allow to select a strategy for g…
…rouping As to keep former process and give also the ability to group per line, an option is added in configuration that allows user to choose either to group purchase order lines together on the same analytic account or to group purchase orders per analytic account.
- Loading branch information
1 parent
95af2d2
commit 12bd16c
Showing
18 changed files
with
738 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,39 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
============================= | ||
Purchase Procurement analytic | ||
Purchase Procurement Analytic | ||
============================= | ||
|
||
This module takes account analytic value from procurements to the created | ||
purchase order line. | ||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--analytic-lightgray.png?logo=github | ||
:target: https://github.com/OCA/account-analytic/tree/14.0/purchase_procurement_analytic | ||
:alt: OCA/account-analytic | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/account-analytic-14-0/account-analytic-14-0-purchase_procurement_analytic | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/87/14.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module allows either: | ||
|
||
* To group generated purchase order lines per analytic account | ||
* To group generated purchase orders per analytic account | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
@@ -20,52 +46,62 @@ To configure this module, you need to: | |
Usage | ||
===== | ||
|
||
#. Go to *Inventory > Reports > Procurement Exceptions* and create a new one. | ||
#. Set *Analytic Account*. | ||
#. *Run Procurement* | ||
#. The generated purchase order line will have this analytic account. | ||
They won't be grouped if analytic account is different. | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/87/10.0 | ||
|
||
Known issues / Roadmap | ||
====================== | ||
You need to configure the way purchase generation will behave. | ||
|
||
* If product supplier info min quantity is greater than procurement qty and we | ||
have sale orders with distinct analytic account which contains this product, | ||
each purchase order line takes seller min quantity. | ||
* Go to Purchase > Configuration | ||
* Select either purchase grouping per anlaytic: | ||
* Per order (default) | ||
* Per line | ||
|
||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/account-analytic/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-analytic/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20purchase_procurement_analytic%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* ACSONE SA/NV | ||
* Tecnativa | ||
|
||
Contributors | ||
------------ | ||
~~~~~~~~~~~~ | ||
|
||
* Carlos Dauden <[email protected]> | ||
* Pedro M. Baeza <[email protected]> | ||
* Vicent Cubells <[email protected]> | ||
* Denis Roussel <[email protected]> | ||
|
||
Maintainer | ||
---------- | ||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. | ||
.. |maintainer-rousseldenis| image:: https://github.com/rousseldenis.png?size=40px | ||
:target: https://github.com/rousseldenis | ||
:alt: rousseldenis | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-rousseldenis| | ||
|
||
This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/14.0/purchase_procurement_analytic>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,6 @@ | |
"purchase_stock", | ||
"stock_analytic", | ||
], | ||
"data": ["views/res_config_settings.xml"], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from . import stock_rule | ||
from . import purchase_order_line | ||
from . import res_company | ||
from . import res_config_settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2022 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
|
||
_inherit = "res.company" | ||
|
||
purchase_analytic_grouping = fields.Selection( | ||
[("order", "Per Order"), ("line", "Per line")], | ||
default="order", | ||
required=True, | ||
) |
15 changes: 15 additions & 0 deletions
15
purchase_procurement_analytic/models/res_config_settings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2022 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
|
||
_inherit = "res.config.settings" | ||
|
||
purchase_analytic_grouping = fields.Selection( | ||
related="company_id.purchase_analytic_grouping", | ||
readonly=False, | ||
required=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2022 ACSONE SA/NV | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockRule(models.Model): | ||
|
||
_inherit = "stock.rule" | ||
|
||
def _make_po_get_domain(self, company_id, values, partner): | ||
""" | ||
If the grouping strategy is set 'per order' and if an analytic | ||
account is set on procurement, add the analytic account in the | ||
criteria to find an eligible purchase order. | ||
""" | ||
domain = super()._make_po_get_domain(company_id, values, partner) | ||
if company_id.purchase_analytic_grouping == "order": | ||
analytic_id = values.get("analytic_account_id") | ||
if analytic_id: | ||
domain += (("order_line.account_analytic_id", "=", analytic_id),) | ||
return domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
To configure this module, you need to: | ||
|
||
#. Go to your user settings. | ||
#. Enable *Analytic Accounting for Purchases* in *Technical Settings*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
* Carlos Dauden <[email protected]> | ||
* Pedro M. Baeza <[email protected]> | ||
* Vicent Cubells <[email protected]> | ||
* Denis Roussel <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
This module allows to not group purchase lines that concern different | ||
analytic account if created from procurements. | ||
This module allows either: | ||
|
||
* To group generated purchase order lines per analytic account | ||
* To group generated purchase orders per analytic account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
You need to configure the way purchase generation will behave. | ||
|
||
* Go to Purchase > Configuration | ||
* Select either purchase grouping per analytic: | ||
* Per order (default) | ||
* Per line |
Oops, something went wrong.