From d18ab6fda9058f78e7a15e202779175a46e02f93 Mon Sep 17 00:00:00 2001 From: JasminSForgeFlow Date: Wed, 19 Jul 2023 12:27:59 +0530 Subject: [PATCH] [MIG] rma_sale_analytic: Migration to 15.0 --- rma_sale_analytic/README.rst | 4 +-- rma_sale_analytic/__manifest__.py | 10 +++---- rma_sale_analytic/models/__init__.py | 2 +- rma_sale_analytic/models/rma_order_line.py | 15 ++++++++++ rma_sale_analytic/models/sale_order_line.py | 19 ------------- rma_sale_analytic/wizards/__init__.py | 2 +- rma_sale_analytic/wizards/rma_add_sale.py | 2 +- .../wizards/rma_order_line_make_sale_order.py | 4 +-- rma_sale_operating_unit/README.rst | 28 ------------------- rma_sale_operating_unit/__init__.py | 3 -- rma_sale_operating_unit/__manifest__.py | 14 ---------- rma_sale_operating_unit/wizards/__init__.py | 4 --- .../wizards/rma_order_line_make_sale_order.py | 18 ------------ setup/rma_sale_analytic/odoo/__init__.py | 1 - .../rma_sale_analytic/odoo/addons/__init__.py | 1 - .../rma_sale_operating_unit/odoo/__init__.py | 1 - .../odoo/addons/__init__.py | 1 - .../odoo/addons/rma_sale_operating_unit | 1 - setup/rma_sale_operating_unit/setup.py | 6 ---- 19 files changed, 27 insertions(+), 109 deletions(-) create mode 100644 rma_sale_analytic/models/rma_order_line.py delete mode 100644 rma_sale_analytic/models/sale_order_line.py delete mode 100644 rma_sale_operating_unit/README.rst delete mode 100644 rma_sale_operating_unit/__init__.py delete mode 100644 rma_sale_operating_unit/__manifest__.py delete mode 100644 rma_sale_operating_unit/wizards/__init__.py delete mode 100644 rma_sale_operating_unit/wizards/rma_order_line_make_sale_order.py delete mode 100644 setup/rma_sale_analytic/odoo/__init__.py delete mode 100644 setup/rma_sale_analytic/odoo/addons/__init__.py delete mode 100644 setup/rma_sale_operating_unit/odoo/__init__.py delete mode 100644 setup/rma_sale_operating_unit/odoo/addons/__init__.py delete mode 120000 setup/rma_sale_operating_unit/odoo/addons/rma_sale_operating_unit delete mode 100644 setup/rma_sale_operating_unit/setup.py diff --git a/rma_sale_analytic/README.rst b/rma_sale_analytic/README.rst index f07393b1..ec6cc20a 100644 --- a/rma_sale_analytic/README.rst +++ b/rma_sale_analytic/README.rst @@ -25,10 +25,10 @@ Usage Contributors ------------ -* Aaron Henriquez +* Aaron Henriquez Maintainer ---------- -This module is maintained by Eficent. +This module is maintained by ForgeFlow. diff --git a/rma_sale_analytic/__manifest__.py b/rma_sale_analytic/__manifest__.py index 70ce7f5a..2707b481 100644 --- a/rma_sale_analytic/__manifest__.py +++ b/rma_sale_analytic/__manifest__.py @@ -1,14 +1,14 @@ -# © 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2023 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). { "name": "Analytic Account in RMA sale", - "version": "10.0.1.0.0", - "author": "Eficent," "Odoo Community Association (OCA)", - "license": "LGPL-3", + "version": "15.0.1.0.0", + "author": "ForgeFlow," "Odoo Community Association (OCA)", + "license": "AGPL-3", "website": "https://github.com/ForgeFlow/stock-rma", "category": "Analytic", - "depends": ["rma_account", "rma_analytic"], + "depends": ["rma_account", "rma_analytic", "rma_sale", "sale_project"], "data": [], "installable": True, } diff --git a/rma_sale_analytic/models/__init__.py b/rma_sale_analytic/models/__init__.py index 18dd29c4..e626780c 100644 --- a/rma_sale_analytic/models/__init__.py +++ b/rma_sale_analytic/models/__init__.py @@ -1,3 +1,3 @@ # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -from . import sale_order_line +from . import rma_order_line diff --git a/rma_sale_analytic/models/rma_order_line.py b/rma_sale_analytic/models/rma_order_line.py new file mode 100644 index 00000000..19c454d8 --- /dev/null +++ b/rma_sale_analytic/models/rma_order_line.py @@ -0,0 +1,15 @@ +# Copyright 2023 ForgeFlow S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from odoo import api, models + + +class RMAOrderLine(models.Model): + _inherit = "rma.order.line" + + @api.onchange("sale_line_id") + def _onchange_sale_line_id(self): + res = super()._onchange_sale_line_id() + if self.sale_line_id: + self.analytic_account_id = self.sale_line_id.order_id.analytic_account_id + return res diff --git a/rma_sale_analytic/models/sale_order_line.py b/rma_sale_analytic/models/sale_order_line.py deleted file mode 100644 index b143e81d..00000000 --- a/rma_sale_analytic/models/sale_order_line.py +++ /dev/null @@ -1,19 +0,0 @@ -# © 2018 Eficent Business and IT Consulting Services S.L. -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). - -from odoo import _, api, exceptions, models - - -class SaleOrderLine(models.Model): - _inherit = "sale.order.line" - - @api.constrains("analytic_account_id") - def check_analytic(self): - for line in self: - if line.analytic_account_id != line.rma_line_id.analytic_account_id: - raise exceptions.ValidationError( - _( - "The analytic account in the sale line it's not the same" - " as in the rma line" - ) - ) diff --git a/rma_sale_analytic/wizards/__init__.py b/rma_sale_analytic/wizards/__init__.py index ad24407e..6744046a 100644 --- a/rma_sale_analytic/wizards/__init__.py +++ b/rma_sale_analytic/wizards/__init__.py @@ -1,4 +1,4 @@ -# © 2018 Eficent Business and IT Consulting Services S.L. +# Copyright 2023 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) from . import rma_add_sale diff --git a/rma_sale_analytic/wizards/rma_add_sale.py b/rma_sale_analytic/wizards/rma_add_sale.py index cf068724..0f57cdd9 100644 --- a/rma_sale_analytic/wizards/rma_add_sale.py +++ b/rma_sale_analytic/wizards/rma_add_sale.py @@ -1,4 +1,4 @@ -# © 2018 Eficent Business and IT Consulting Services S.L. +# Copyright 2023 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) from odoo import api, models diff --git a/rma_sale_analytic/wizards/rma_order_line_make_sale_order.py b/rma_sale_analytic/wizards/rma_order_line_make_sale_order.py index a0a43a0d..9c13a198 100644 --- a/rma_sale_analytic/wizards/rma_order_line_make_sale_order.py +++ b/rma_sale_analytic/wizards/rma_order_line_make_sale_order.py @@ -1,4 +1,4 @@ -# © 2018 Eficent Business and IT Consulting Services S.L. +# Copyright 2023 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) from odoo import api, models @@ -10,5 +10,5 @@ class RmaLineMakeSaleOrder(models.TransientModel): @api.model def _prepare_sale_order(self, line): res = super(RmaLineMakeSaleOrder, self)._prepare_sale_order(line) - res.update(project_id=line.analytic_account_id.id) + res.update(analytic_account_id=line.analytic_account_id.id) return res diff --git a/rma_sale_operating_unit/README.rst b/rma_sale_operating_unit/README.rst deleted file mode 100644 index 5324c1e4..00000000 --- a/rma_sale_operating_unit/README.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg - :target: https://www.gnu.org/licenses/lgpl.html - :alt: License: LGPL-3 - -============================= -RMA Sale with Operating Units -============================= - -This module introduces the following features: - -* Adds the operating unit to the quotation - -Usage -===== - -* No changes - - -Contributors ------------- - -* Aaron Henriquez - - -Maintainer ----------- - -This module is maintained by Eficent. diff --git a/rma_sale_operating_unit/__init__.py b/rma_sale_operating_unit/__init__.py deleted file mode 100644 index 36998361..00000000 --- a/rma_sale_operating_unit/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). - -from . import wizards diff --git a/rma_sale_operating_unit/__manifest__.py b/rma_sale_operating_unit/__manifest__.py deleted file mode 100644 index a44b15a3..00000000 --- a/rma_sale_operating_unit/__manifest__.py +++ /dev/null @@ -1,14 +0,0 @@ -# © 2017 Eficent Business and IT Consulting Services S.L. -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). - -{ - "name": "Analytic Account in RMA sale", - "version": "10.0.1.0.0", - "author": "Eficent," "Odoo Community Association (OCA)", - "license": "LGPL-3", - "website": "https://github.com/ForgeFlow/stock-rma", - "category": "Analytic", - "depends": ["rma_sale_analytic", "rma_operating_unit"], - "data": [], - "installable": True, -} diff --git a/rma_sale_operating_unit/wizards/__init__.py b/rma_sale_operating_unit/wizards/__init__.py deleted file mode 100644 index e22a77a6..00000000 --- a/rma_sale_operating_unit/wizards/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# © 2018 Eficent Business and IT Consulting Services S.L. -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) - -from . import rma_order_line_make_sale_order diff --git a/rma_sale_operating_unit/wizards/rma_order_line_make_sale_order.py b/rma_sale_operating_unit/wizards/rma_order_line_make_sale_order.py deleted file mode 100644 index 2ba311dd..00000000 --- a/rma_sale_operating_unit/wizards/rma_order_line_make_sale_order.py +++ /dev/null @@ -1,18 +0,0 @@ -# © 2018 Eficent Business and IT Consulting Services S.L. -# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) - -from odoo import api, models - - -class RmaLineMakeSaleOrder(models.TransientModel): - _inherit = "rma.order.line.make.sale.order" - - @api.model - def _prepare_sale_order(self, line): - sale_line = super(RmaLineMakeSaleOrder, self)._prepare_sale_order(line) - sale_line.update(operating_unit_id=line.operating_unit_id.id) - team = self.env["crm.team"].search( - [("operating_unit_id", "=", line.operating_unit_id.id)], limit=1 - ) - sale_line.update(team_id=team.id) - return sale_line diff --git a/setup/rma_sale_analytic/odoo/__init__.py b/setup/rma_sale_analytic/odoo/__init__.py deleted file mode 100644 index de40ea7c..00000000 --- a/setup/rma_sale_analytic/odoo/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/rma_sale_analytic/odoo/addons/__init__.py b/setup/rma_sale_analytic/odoo/addons/__init__.py deleted file mode 100644 index de40ea7c..00000000 --- a/setup/rma_sale_analytic/odoo/addons/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/rma_sale_operating_unit/odoo/__init__.py b/setup/rma_sale_operating_unit/odoo/__init__.py deleted file mode 100644 index de40ea7c..00000000 --- a/setup/rma_sale_operating_unit/odoo/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/rma_sale_operating_unit/odoo/addons/__init__.py b/setup/rma_sale_operating_unit/odoo/addons/__init__.py deleted file mode 100644 index de40ea7c..00000000 --- a/setup/rma_sale_operating_unit/odoo/addons/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/rma_sale_operating_unit/odoo/addons/rma_sale_operating_unit b/setup/rma_sale_operating_unit/odoo/addons/rma_sale_operating_unit deleted file mode 120000 index 1b7b5cd6..00000000 --- a/setup/rma_sale_operating_unit/odoo/addons/rma_sale_operating_unit +++ /dev/null @@ -1 +0,0 @@ -../../../../rma_sale_operating_unit \ No newline at end of file diff --git a/setup/rma_sale_operating_unit/setup.py b/setup/rma_sale_operating_unit/setup.py deleted file mode 100644 index 28c57bb6..00000000 --- a/setup/rma_sale_operating_unit/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -import setuptools - -setuptools.setup( - setup_requires=['setuptools-odoo'], - odoo_addon=True, -)