Skip to content

Commit

Permalink
Merge PR #415 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by AaronHForgeFlow
  • Loading branch information
OCA-git-bot committed Feb 7, 2022
2 parents 16d63a9 + ef66c38 commit d7ed83a
Show file tree
Hide file tree
Showing 22 changed files with 974 additions and 0 deletions.
127 changes: 127 additions & 0 deletions procurement_mto_analytic/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
=======================
Purchase Analytic (MTO)
=======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/15.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-15-0/account-analytic-15-0-procurement_mto_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/15.0
:alt: Try me on Runbot

|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 smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20procurement_mto_analytic%0Aversion:%2015.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 <[email protected]>

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

* Pimolnat Suntian <[email protected]>

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

* Alan Ramos <[email protected]>

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/15.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 account in purchase order line from "
"sale order analytic account",
"version": "15.0.1.0.0",
"category": "Analytic",
"license": "AGPL-3",
"author": "Tecnativa, VentorTech, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-analytic",
"depends": ["sale_stock", "purchase_stock"],
"installable": True,
}
32 changes: 32 additions & 0 deletions procurement_mto_analytic/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 <[email protected]>\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_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"
32 changes: 32 additions & 0 deletions procurement_mto_analytic/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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 <[email protected]>\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.3.2\n"

#. 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"
29 changes: 29 additions & 0 deletions procurement_mto_analytic/i18n/procurement_mto_analytic.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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"
"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_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 ""

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

from . import sale_order_line
from . import stock_move
from . import stock_rule
from . import purchase_order_line
19 changes: 19 additions & 0 deletions procurement_mto_analytic/models/purchase_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 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(
PurchaseOrderLine, self
)._prepare_purchase_order_line_from_procurement(
product_id, product_qty, product_uom, company_id, values, po
)
res["account_analytic_id"] = values.get("account_analytic_id", False)
return res
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({"account_analytic_id": self.order_id.analytic_account_id.id})
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({"account_analytic_id": self.order_id.analytic_account_id.id})
return res
14 changes: 14 additions & 0 deletions procurement_mto_analytic/models/stock_move.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).

from odoo import models


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

def _prepare_procurement_values(self):
res = super()._prepare_procurement_values()
res.update(
{"account_analytic_id": self.group_id.sale_id.analytic_account_id.id}
)
return res
18 changes: 18 additions & 0 deletions procurement_mto_analytic/models/stock_rule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# License AGPL-3.0 or later (http://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):
res = super()._make_po_get_domain(company_id, values, partner)
res += (
(
"order_line.account_analytic_id",
"=",
values.get("account_analytic_id", False),
),
)
return res
21 changes: 21 additions & 0 deletions procurement_mto_analytic/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
* `Tecnativa <https://www.tecnativa.com>`__:

* Carlos Dauden
* Pedro M. Baeza
* Vicent Cubells

* Ventor-Tech:

* Sergej Lozikov

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

* Duc, Dao Dong <[email protected]>

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

* Pimolnat Suntian <[email protected]>

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

* Alan Ramos <[email protected]>
2 changes: 2 additions & 0 deletions procurement_mto_analytic/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module takes account analytic value from sale order to the created
purchase order line.
19 changes: 19 additions & 0 deletions procurement_mto_analytic/readme/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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.
Loading

0 comments on commit d7ed83a

Please sign in to comment.