diff --git a/rma_analytic/__manifest__.py b/rma_analytic/__manifest__.py index 72c45266..bb2430cd 100644 --- a/rma_analytic/__manifest__.py +++ b/rma_analytic/__manifest__.py @@ -6,7 +6,7 @@ "version": "12.0.1.0.0", "author": "Eficent," "Odoo Community Association (OCA)", "license": "LGPL-3", - "website": "http://www.eficent.com", + "website": "https://github.com/ForgeFlow/stock-rma", "category": "Analytic", "depends": [ "rma_account", diff --git a/rma_analytic/models/rma_order_line.py b/rma_analytic/models/rma_order_line.py index 4ac13c87..7702c87a 100644 --- a/rma_analytic/models/rma_order_line.py +++ b/rma_analytic/models/rma_order_line.py @@ -15,11 +15,7 @@ class RmaOrderLine(models.Model): @api.multi def _prepare_rma_line_from_inv_line(self, line): - res = super( - RmaOrderLine, self - )._prepare_rma_line_from_inv_line(line) + res = super(RmaOrderLine, self)._prepare_rma_line_from_inv_line(line) if line.account_analytic_id: - res.update( - analytic_account_id=line.account_analytic_id.id - ) + res.update(analytic_account_id=line.account_analytic_id.id) return res diff --git a/rma_analytic/models/stock_move.py b/rma_analytic/models/stock_move.py index d0932dc5..3f35ddee 100644 --- a/rma_analytic/models/stock_move.py +++ b/rma_analytic/models/stock_move.py @@ -9,9 +9,5 @@ class StockMove(models.Model): def _prepare_procurement_values(self): res = super(StockMove, self)._prepare_procurement_values() - res.update( - { - "account_analytic_id": self.rma_line_id.analytic_account_id.id - } - ) + res.update({"account_analytic_id": self.rma_line_id.analytic_account_id.id}) return res diff --git a/rma_analytic/tests/test_rma_analytic.py b/rma_analytic/tests/test_rma_analytic.py index 6ae294be..c43c8653 100644 --- a/rma_analytic/tests/test_rma_analytic.py +++ b/rma_analytic/tests/test_rma_analytic.py @@ -5,7 +5,6 @@ from odoo.addons.rma.tests import test_rma class TestRmaAnalytic(test_rma.TestRma): - @classmethod def setUpClass(cls): super(TestRmaAnalytic, cls).setUpClass() @@ -23,15 +22,11 @@ class TestRmaAnalytic(test_rma.TestRma): cls.env.ref("base.res_partner_2"), dropship=False, ) - receivable_type = cls.env.ref( - "account.data_account_type_receivable" - ) + receivable_type = cls.env.ref("account.data_account_type_receivable") # Create Invoices: customer_account = ( cls.env["account.account"] - .search( - [("user_type_id", "=", receivable_type.id)], limit=1 - ) + .search([("user_type_id", "=", receivable_type.id)], limit=1) .id ) cls.inv_customer = cls.env["account.invoice"].create( @@ -41,9 +36,7 @@ class TestRmaAnalytic(test_rma.TestRma): "type": "out_invoice", } ) - cls.anal = cls.env["account.analytic.account"].create( - {"name": "Name"} - ) + cls.anal = cls.env["account.analytic.account"].create({"name": "Name"}) cls.inv_line_1 = cls.env["account.invoice.line"].create( { "name": cls.partner_id.name, @@ -89,21 +82,11 @@ class TestRmaAnalytic(test_rma.TestRma): "operation_id": self.env.ref( "rma.rma_operation_customer_replace" ).id, - "in_route_id": self.env.ref( - "rma.route_rma_customer" - ), - "out_route_id": self.env.ref( - "rma.route_rma_customer" - ), - "in_warehouse_id": self.env.ref( - "stock.warehouse0" - ), - "out_warehouse_id": self.env.ref( - "stock.warehouse0" - ), - "location_id": self.env.ref( - "stock.stock_location_stock" - ), + "in_route_id": self.env.ref("rma.route_rma_customer"), + "out_route_id": self.env.ref("rma.route_rma_customer"), + "in_warehouse_id": self.env.ref("stock.warehouse0"), + "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, "uom_id": self.product_1.uom_id.id, @@ -138,13 +121,7 @@ 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({"invoice_line_ids": [(6, 0, self.inv_customer.invoice_line_ids.ids)]}) add_inv.add_lines() self.assertEqual( @@ -166,21 +143,11 @@ class TestRmaAnalytic(test_rma.TestRma): "operation_id": self.env.ref( "rma_account.rma_operation_customer_refund" ).id, - "in_route_id": self.env.ref( - "rma.route_rma_customer" - ).id, - "out_route_id": self.env.ref( - "rma.route_rma_customer" - ).id, - "in_warehouse_id": self.env.ref( - "stock.warehouse0" - ).id, - "out_warehouse_id": self.env.ref( - "stock.warehouse0" - ).id, - "location_id": self.env.ref( - "stock.stock_location_stock" - ).id, + "in_route_id": self.env.ref("rma.route_rma_customer").id, + "out_route_id": self.env.ref("rma.route_rma_customer").id, + "in_warehouse_id": self.env.ref("stock.warehouse0").id, + "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, "uom_id": self.product_1.uom_id.id, diff --git a/rma_analytic/views/rma_order_line_view.xml b/rma_analytic/views/rma_order_line_view.xml index b37b181f..61c098c9 100644 --- a/rma_analytic/views/rma_order_line_view.xml +++ b/rma_analytic/views/rma_order_line_view.xml @@ -1,14 +1,17 @@ - + rma.order.line.tree rma.order.line - + - + @@ -16,10 +19,13 @@ rma.order.line.supplier.tree rma.order.line - + - + @@ -27,10 +33,13 @@ rma.order.line.supplier.form rma.order.line - + - + @@ -38,10 +47,13 @@ rma.order.line.form rma.order.line - + - + diff --git a/rma_analytic/wizards/rma_add_invoice.py b/rma_analytic/wizards/rma_add_invoice.py index 54e86dc4..bef3d610 100644 --- a/rma_analytic/wizards/rma_add_invoice.py +++ b/rma_analytic/wizards/rma_add_invoice.py @@ -8,11 +8,7 @@ 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) + 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 - ) + 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 fb50ab3b..81914ca9 100644 --- a/rma_analytic/wizards/rma_add_stock_move.py +++ b/rma_analytic/wizards/rma_add_stock_move.py @@ -9,8 +9,6 @@ class RmaAddStockMove(models.TransientModel): @api.model def _prepare_rma_line_from_stock_move(self, sm, lot=False): - data = super( - RmaAddStockMove, self - )._prepare_rma_line_from_stock_move(sm, lot) + data = super(RmaAddStockMove, self)._prepare_rma_line_from_stock_move(sm, lot) data.update(analytic_account_id=sm.analytic_account_id.id) return data diff --git a/rma_analytic/wizards/rma_make_picking.py b/rma_analytic/wizards/rma_make_picking.py index a45dd9e9..33617542 100644 --- a/rma_analytic/wizards/rma_make_picking.py +++ b/rma_analytic/wizards/rma_make_picking.py @@ -1,7 +1,7 @@ # Copyright 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 models, api +from odoo import api, models class RmaMakePicking(models.TransientModel): @@ -9,10 +9,8 @@ class RmaMakePicking(models.TransientModel): @api.model def _get_procurement_data(self, item, group, qty, picking_type): - procurement_data = super( - RmaMakePicking, self - )._get_procurement_data(item, group, qty, picking_type) - procurement_data.update( - analytic_account_id=item.line_id.analytic_account_id.id + procurement_data = super(RmaMakePicking, self)._get_procurement_data( + item, group, qty, picking_type ) + procurement_data.update(analytic_account_id=item.line_id.analytic_account_id.id) return procurement_data diff --git a/rma_analytic/wizards/rma_refund.py b/rma_analytic/wizards/rma_refund.py index 41c3c5ea..d6e18518 100644 --- a/rma_analytic/wizards/rma_refund.py +++ b/rma_analytic/wizards/rma_refund.py @@ -11,7 +11,5 @@ class RmaRefund(models.TransientModel): def prepare_refund_line(self, item, refund): res = super(RmaRefund, self).prepare_refund_line(item, refund) if item.line_id.analytic_account_id: - res.update( - account_analytic_id=item.line_id.analytic_account_id.id - ) + res.update(account_analytic_id=item.line_id.analytic_account_id.id) return res diff --git a/setup/rma_analytic/odoo/addons/rma_analytic b/setup/rma_analytic/odoo/addons/rma_analytic new file mode 120000 index 00000000..4a1f6b6f --- /dev/null +++ b/setup/rma_analytic/odoo/addons/rma_analytic @@ -0,0 +1 @@ +../../../../rma_analytic \ No newline at end of file diff --git a/setup/rma_analytic/setup.py b/setup/rma_analytic/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/rma_analytic/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)