diff --git a/rma_analytic/README.rst b/rma_analytic/README.rst index 4f6f749a..4cbac0ec 100644 --- a/rma_analytic/README.rst +++ b/rma_analytic/README.rst @@ -25,11 +25,12 @@ Usage Contributors ------------ -* Aaron Henriquez +* Aaron Henriquez +* Juany Davila * Serpent Consulting Services Pvt. Ltd. Maintainer ---------- -This module is maintained by Eficent. +This module is maintained by ForgeFlow. diff --git a/rma_analytic/__manifest__.py b/rma_analytic/__manifest__.py index bb2430cd..30234a3f 100644 --- a/rma_analytic/__manifest__.py +++ b/rma_analytic/__manifest__.py @@ -1,11 +1,11 @@ -# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2017 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). { "name": "Analytic Account in RMA", - "version": "12.0.1.0.0", - "author": "Eficent," "Odoo Community Association (OCA)", - "license": "LGPL-3", + "version": "14.0.1.0.0", + "author": "ForgeFlow," "Odoo Community Association (OCA)", + "license": "AGPL-3", "website": "https://github.com/ForgeFlow/stock-rma", "category": "Analytic", "depends": [ diff --git a/rma_analytic/models/rma_order_line.py b/rma_analytic/models/rma_order_line.py index 7702c87a..6ff7aeb2 100644 --- a/rma_analytic/models/rma_order_line.py +++ b/rma_analytic/models/rma_order_line.py @@ -1,7 +1,7 @@ -# Copyright 2018 Eficent Business and IT Consulting Services S.L. +# Copyright 2018 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). -from odoo import api, fields, models +from odoo import fields, models class RmaOrderLine(models.Model): @@ -13,7 +13,6 @@ class RmaOrderLine(models.Model): string="Analytic Account", ) - @api.multi def _prepare_rma_line_from_inv_line(self, line): res = super(RmaOrderLine, self)._prepare_rma_line_from_inv_line(line) if line.account_analytic_id: diff --git a/rma_analytic/models/stock_move.py b/rma_analytic/models/stock_move.py index 3f35ddee..20cbf097 100644 --- a/rma_analytic/models/stock_move.py +++ b/rma_analytic/models/stock_move.py @@ -1,4 +1,4 @@ -# Copyright 2018 Eficent Business and IT Consulting Services S.L. +# Copyright 2018 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). from odoo import models diff --git a/rma_analytic/tests/test_rma_analytic.py b/rma_analytic/tests/test_rma_analytic.py index c43c8653..a6650ed0 100644 --- a/rma_analytic/tests/test_rma_analytic.py +++ b/rma_analytic/tests/test_rma_analytic.py @@ -1,4 +1,4 @@ -# Copyright 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2017-23 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) from odoo.addons.rma.tests import test_rma @@ -8,14 +8,13 @@ class TestRmaAnalytic(test_rma.TestRma): @classmethod def setUpClass(cls): super(TestRmaAnalytic, cls).setUpClass() - cls.rma_add_invoice_wiz = cls.env["rma_add_invoice"] + cls.rma_add_invoice_wiz = cls.env["rma_add_account_move"] cls.rma_refund_wiz = cls.env["rma.refund"] products2move = [ (cls.product_1, 3), (cls.product_2, 5), (cls.product_3, 2), ] - cls.rma_add_invoice_wiz = cls.env["rma_add_invoice"] cls.rma_ana_id = cls._create_rma_from_move( products2move, "supplier", @@ -29,23 +28,22 @@ class TestRmaAnalytic(test_rma.TestRma): .search([("user_type_id", "=", receivable_type.id)], limit=1) .id ) - cls.inv_customer = cls.env["account.invoice"].create( + cls.inv_customer = cls.env["account.move"].create( { "partner_id": cls.partner_id.id, - "account_id": customer_account, - "type": "out_invoice", + "move_type": "out_invoice", } ) cls.anal = cls.env["account.analytic.account"].create({"name": "Name"}) - cls.inv_line_1 = cls.env["account.invoice.line"].create( + cls.inv_line_1 = cls.env["account.move.line"].create( { "name": cls.partner_id.name, "product_id": cls.product_1.id, "quantity": 12.0, "price_unit": 100.0, - "account_analytic_id": cls.anal.id, - "invoice_id": cls.inv_customer.id, - "uom_id": cls.product_1.uom_id.id, + "analytic_account_id": cls.anal.id, + "move_id": cls.inv_customer.id, + "product_uom_id": cls.product_1.uom_id.id, "account_id": customer_account, } ) @@ -88,15 +86,15 @@ class TestRmaAnalytic(test_rma.TestRma): "out_warehouse_id": self.env.ref("stock.warehouse0"), "location_id": self.env.ref("stock.stock_location_stock"), "type": "customer", - "invoice_line_id": self.inv_line_1.id, + "account_move_line_id": self.inv_line_1.id, "uom_id": self.product_1.uom_id.id, } ) ) - rma_line._onchange_invoice_line_id() + rma_line._onchange_account_move_line_id() self.assertEqual( rma_line.analytic_account_id, - self.inv_line_1.account_analytic_id, + self.inv_line_1.analytic_account_id, ) def test_invoice_analytic02(self): @@ -121,12 +119,12 @@ class TestRmaAnalytic(test_rma.TestRma): "active_ids": [rma_order.id], "active_model": "rma.order", } - ).create({"invoice_line_ids": [(6, 0, self.inv_customer.invoice_line_ids.ids)]}) + ).create({"line_ids": [(6, 0, self.inv_customer.invoice_line_ids.ids)]}) add_inv.add_lines() self.assertEqual( rma_order.mapped("rma_line_ids.analytic_account_id"), - self.inv_line_1.account_analytic_id, + self.inv_line_1.analytic_account_id, ) def test_refund_analytic(self): @@ -149,12 +147,12 @@ class TestRmaAnalytic(test_rma.TestRma): "out_warehouse_id": self.env.ref("stock.warehouse0").id, "location_id": self.env.ref("stock.stock_location_stock").id, "type": "customer", - "invoice_line_id": self.inv_line_1.id, + "account_move_line_id": self.inv_line_1.id, "uom_id": self.product_1.uom_id.id, } ) ) - rma_line._onchange_invoice_line_id() + rma_line._onchange_account_move_line_id() rma_line.action_rma_to_approve() rma_line.action_rma_approve() make_refund = self.rma_refund_wiz.with_context( @@ -167,5 +165,5 @@ class TestRmaAnalytic(test_rma.TestRma): make_refund.invoice_refund() self.assertEqual( rma_line.mapped("analytic_account_id"), - rma_line.mapped("refund_line_ids.account_analytic_id"), + rma_line.mapped("refund_line_ids.analytic_account_id"), ) diff --git a/rma_analytic/views/rma_order_line_view.xml b/rma_analytic/views/rma_order_line_view.xml index 61c098c9..9b263ddd 100644 --- a/rma_analytic/views/rma_order_line_view.xml +++ b/rma_analytic/views/rma_order_line_view.xml @@ -1,5 +1,5 @@ - diff --git a/rma_analytic/wizards/__init__.py b/rma_analytic/wizards/__init__.py index 31333467..4f77f41f 100644 --- a/rma_analytic/wizards/__init__.py +++ b/rma_analytic/wizards/__init__.py @@ -1,7 +1,7 @@ -# Copyright 2018 Eficent Business and IT Consulting Services S.L. +# Copyright 2018 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) from . import rma_add_stock_move from . import rma_make_picking -from . import rma_add_invoice +from . import rma_add_account_move from . import rma_refund diff --git a/rma_analytic/wizards/rma_add_account_move.py b/rma_analytic/wizards/rma_add_account_move.py new file mode 100644 index 00000000..6b9e77e6 --- /dev/null +++ b/rma_analytic/wizards/rma_add_account_move.py @@ -0,0 +1,14 @@ +# Copyright 2017-23 ForgeFlow S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) + +from odoo import models + + +class RmaAddAccountMove(models.TransientModel): + _inherit = "rma_add_account_move" + + def _prepare_rma_line_from_inv_line(self, line): + res = super(RmaAddAccountMove, self)._prepare_rma_line_from_inv_line(line) + if line.analytic_account_id: + res.update(analytic_account_id=line.analytic_account_id.id) + return res diff --git a/rma_analytic/wizards/rma_add_invoice.py b/rma_analytic/wizards/rma_add_invoice.py deleted file mode 100644 index bef3d610..00000000 --- a/rma_analytic/wizards/rma_add_invoice.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) - -from odoo import models - - -class RmaAddInvoice(models.TransientModel): - _inherit = "rma_add_invoice" - - def _prepare_rma_line_from_inv_line(self, line): - res = super(RmaAddInvoice, self)._prepare_rma_line_from_inv_line(line) - if line.account_analytic_id: - res.update(analytic_account_id=line.account_analytic_id.id) - return res diff --git a/rma_analytic/wizards/rma_add_stock_move.py b/rma_analytic/wizards/rma_add_stock_move.py index 81914ca9..38e4a367 100644 --- a/rma_analytic/wizards/rma_add_stock_move.py +++ b/rma_analytic/wizards/rma_add_stock_move.py @@ -1,4 +1,4 @@ -# Copyright 2018 Eficent Business and IT Consulting Services S.L. +# Copyright 2018 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_analytic/wizards/rma_make_picking.py b/rma_analytic/wizards/rma_make_picking.py index 33617542..388d9c2b 100644 --- a/rma_analytic/wizards/rma_make_picking.py +++ b/rma_analytic/wizards/rma_make_picking.py @@ -1,4 +1,4 @@ -# Copyright 2018 Eficent Business and IT Consulting Services S.L. +# Copyright 2018 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_analytic/wizards/rma_refund.py b/rma_analytic/wizards/rma_refund.py index d6e18518..a6ac6cbd 100644 --- a/rma_analytic/wizards/rma_refund.py +++ b/rma_analytic/wizards/rma_refund.py @@ -1,4 +1,4 @@ -# © 2017 Eficent Business and IT Consulting Services S.L. +# Copyright 2017 ForgeFlow S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) from odoo import api, models