Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] procurement_mto_analytic: Migration to 16.0 #637

Open
wants to merge 25 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
94dbc69
[MIG] purchase_procurement_analytic > procurement_mto_analytic: Migra…
Nov 14, 2018
84f4c5c
[UPD] README.rst
OCA-git-bot Nov 20, 2018
4b373e3
[UPD] Update procurement_mto_analytic.pot
oca-travis Nov 20, 2018
3157a79
[MIG] procurement_mto_analytic: Migration to 12.0
Feb 18, 2019
0844a67
[ADD] Add feature to set analytic account for purchase lines of servi…
Feb 19, 2019
675a262
[UPD] README.rst
OCA-git-bot Feb 25, 2019
36662c5
[UPD] Update procurement_mto_analytic.pot
oca-travis Feb 25, 2019
0ea842b
[UPD] README.rst
OCA-git-bot Jul 29, 2019
26303c4
[IMP] procurement_mto_analytic: black, isort
ps-tubtim Jan 8, 2020
524dd98
[MIG] procurement_mto_analytic: Migration to 13.0
ps-tubtim Mar 24, 2020
e40a1da
[UPD] Update procurement_mto_analytic.pot
oca-travis Mar 24, 2020
186344b
Added translation using Weblate (Spanish)
eduardgm Mar 26, 2021
35290d0
Added translation using Weblate (Catalan)
eduardgm Mar 26, 2021
1691188
Translated using Weblate (Spanish)
eduardgm Mar 26, 2021
845f954
Translated using Weblate (Catalan)
eduardgm Mar 26, 2021
aeaf41d
[IMP] procurement_mto_analytic: black, isort, prettier
alan196 Nov 29, 2021
59d7ec0
[MIG] : Migration to 15.0
alan196 Nov 29, 2021
a5a2acb
[UPD] Update procurement_mto_analytic.pot
Feb 7, 2022
a558715
[UPD] README.rst
OCA-git-bot Feb 7, 2022
c9937a4
[UPD] README.rst
OCA-git-bot Sep 3, 2023
c7ef180
Update translation files
weblate Oct 9, 2023
e6c1f74
Translated using Weblate (Spanish)
Ivorra78 Oct 23, 2023
ccc6c78
[IMP] procurement_mto_analytic: pre-commit stuff
AungKoKoLin1997 Mar 26, 2024
48656ad
[MIG] procurement_mto_analytic: Migration to 16.0
AungKoKoLin1997 Mar 26, 2024
538a634
[IMP] procurement_mto_analytic: improve tests
AungKoKoLin1997 Oct 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions procurement_mto_analytic/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
=======================
Purchase Analytic (MTO)
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:541299b9d83e8dca12c223d23e8d78357360045ca1f7272edd4f4120da984de7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/16.0/procurement_mto_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-16-0/account-analytic-16-0-procurement_mto_analytic
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module takes account analytic value from sale order to the created
purchase order line.

**Table of contents**

.. contents::
:local:

Usage
=====

#. Add any product with *Make To Order* option enabled into a new sale order.
#. Set *Analytic Account*.
#. *Confirm Sale*
#. The generated purchase order line will have this analytic account.
They won't be grouped if analytic account is different.

Changelog
=========

13.0.1.0.0 (2020-01-08)
~~~~~~~~~~~~~~~~~~~~~~~

Migrated to odoo 13.

12.0.1.0.1 (2019-02-19)
~~~~~~~~~~~~~~~~~~~~~~~

[ADD] Add feature to set analytic account for purchase lines of service products.

12.0.1.0.0 (2019-02-18)
~~~~~~~~~~~~~~~~~~~~~~~

Migrated to odoo 12.

11.0.1.0.0 (2018-11-15)
~~~~~~~~~~~~~~~~~~~~~~~

First version.

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20procurement_mto_analytic%0Aversion:%2016.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
~~~~~~~

* Tecnativa
* VentorTech

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`__:

* Carlos Dauden
* Pedro M. Baeza
* Vicent Cubells

* Ventor-Tech:

* Sergej Lozikov

* `Komit <https://komit-consulting.com/>`__:

* Duc, Dao Dong <duc.dd@komit-consulting.com>

* `Ecosoft <https://ecosoft.co.th/>`__:

* Pimolnat Suntian <pimolnats@ecosoft.co.th>

* `Jarsa <https://www.jarsa.com/>`__:

* Alan Ramos <alan.ramos@jarsa.com>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/16.0/procurement_mto_analytic>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions procurement_mto_analytic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
14 changes: 14 additions & 0 deletions procurement_mto_analytic/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Purchase Analytic (MTO)",
"summary": "This module sets analytic distribution in purchase order line from "
"sale order line analytic distribution",
"version": "16.0.1.0.0",
"category": "Analytic",
"license": "AGPL-3",
"author": "Tecnativa, VentorTech, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-analytic",
"depends": ["purchase_stock", "sale_stock"],
"installable": True,
}
37 changes: 37 additions & 0 deletions procurement_mto_analytic/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * procurement_mto_analytic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-03-26 18:46+0000\n"
"Last-Translator: eduardgm <eduard.garcia@qubiq.es>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea de la Comanda de Venda"

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_stock_move
msgid "Stock Move"
msgstr "Moviment d'estoc"

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_stock_rule
msgid "Stock Rule"
msgstr "Regla d'estoc"
37 changes: 37 additions & 0 deletions procurement_mto_analytic/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * procurement_mto_analytic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-10-29 08:27+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_purchase_order_line
msgid "Purchase Order Line"
msgstr "Línea de Orden de Compra"

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_sale_order_line
msgid "Sales Order Line"
msgstr "Línea del Pedido de Venta"

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de Stock"

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_stock_rule
msgid "Stock Rule"
msgstr "Regla de Stock"
34 changes: 34 additions & 0 deletions procurement_mto_analytic/i18n/procurement_mto_analytic.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * procurement_mto_analytic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \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: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: procurement_mto_analytic
#: model:ir.model,name:procurement_mto_analytic.model_stock_rule
msgid "Stock Rule"
msgstr ""
30 changes: 30 additions & 0 deletions procurement_mto_analytic/i18n/purchase_procurement_analytic.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_procurement_analytic
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \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: purchase_procurement_analytic
#: model:ir.model,name:purchase_procurement_analytic.model_procurement_rule
msgid "Procurement Rule"
msgstr ""

#. module: purchase_procurement_analytic
#: model:ir.model,name:purchase_procurement_analytic.model_sale_order_line
msgid "Sales Order Line"
msgstr ""

#. module: purchase_procurement_analytic
#: model:ir.model,name:purchase_procurement_analytic.model_stock_move
msgid "Stock Move"
msgstr ""

5 changes: 5 additions & 0 deletions procurement_mto_analytic/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import sale_order_line
from . import stock_move
from . import purchase_order_line
47 changes: 47 additions & 0 deletions procurement_mto_analytic/models/purchase_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models


class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

@api.model
def _prepare_purchase_order_line_from_procurement(
self, product_id, product_qty, product_uom, company_id, values, po
):
res = super()._prepare_purchase_order_line_from_procurement(
product_id, product_qty, product_uom, company_id, values, po
)
res["analytic_distribution"] = values.get("analytic_distribution", False)
return res

def _find_candidate(
self,
product_id,
product_qty,
product_uom,
location_id,
name,
origin,
company_id,
values,
):
lines = (
self.filtered(
lambda po_line: po_line.analytic_distribution
== values["analytic_distribution"]
)
if values.get("analytic_distribution")
else self
)
return super(PurchaseOrderLine, lines)._find_candidate(
product_id,
product_qty,
product_uom,
location_id,
name,
origin,
company_id,
values,
)
19 changes: 19 additions & 0 deletions procurement_mto_analytic/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class SaleOrderLine(models.Model):
_inherit = "sale.order.line"

def _prepare_procurement_values(self, group_id=False):
res = super()._prepare_procurement_values(group_id)
res.update({"analytic_distribution": self.analytic_distribution})
return res

def _purchase_service_prepare_line_values(self, purchase_order, quantity=False):
res = super()._purchase_service_prepare_line_values(
purchase_order=purchase_order, quantity=quantity
)
res.update({"analytic_distribution": self.analytic_distribution})
return res
15 changes: 15 additions & 0 deletions procurement_mto_analytic/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class StockMove(models.Model):
_inherit = "stock.move"

def _prepare_procurement_values(self):
res = super()._prepare_procurement_values()
analytic_distribution = self.sale_line_id.analytic_distribution
# Update the procurement values with analytic_distribution if it exists
if analytic_distribution:
res.update({"analytic_distribution": analytic_distribution})
return res
Loading
Loading