From 157f73cb2a463343078d46199a399b8e6d7e922d Mon Sep 17 00:00:00 2001 From: Jordi Ballester Date: Sun, 26 Jun 2022 19:01:36 +0200 Subject: [PATCH 1/3] [ADD] rma_sale_force_invoiced --- rma_sale_force_invoiced/README.rst | 49 +++++++++++++++++++ rma_sale_force_invoiced/__init__.py | 2 + rma_sale_force_invoiced/__manifest__.py | 17 +++++++ rma_sale_force_invoiced/models/__init__.py | 1 + .../models/rma_operation.py | 13 +++++ .../views/rma_operation_views.xml | 15 ++++++ rma_sale_force_invoiced/wizards/__init__.py | 1 + .../wizards/rma_order_line_make_sale_order.py | 14 ++++++ 8 files changed, 112 insertions(+) create mode 100644 rma_sale_force_invoiced/README.rst create mode 100644 rma_sale_force_invoiced/__init__.py create mode 100644 rma_sale_force_invoiced/__manifest__.py create mode 100644 rma_sale_force_invoiced/models/__init__.py create mode 100644 rma_sale_force_invoiced/models/rma_operation.py create mode 100644 rma_sale_force_invoiced/views/rma_operation_views.xml create mode 100644 rma_sale_force_invoiced/wizards/__init__.py create mode 100644 rma_sale_force_invoiced/wizards/rma_order_line_make_sale_order.py diff --git a/rma_sale_force_invoiced/README.rst b/rma_sale_force_invoiced/README.rst new file mode 100644 index 00000000..d52f0b79 --- /dev/null +++ b/rma_sale_force_invoiced/README.rst @@ -0,0 +1,49 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :alt: License AGPL-3 + +======================= +RMA Sale Force Invoiced +======================= + +This module allows you to force the sales orders created from RMA order lines +to be set as invoiced once they are created. This use is useful in the +scenario, for example, where you sell goods free of charge and you don't want +to generate an invoice. + +Installation +============ + +This module depends on the module *sale_force_invoiced*, available in +https://github.com/OCA/sale-workflow. + +Usage +===== + +#. Go to *RMA / Configuration / Customer Operations* and set the flag +*Sale Force Invoiced* to the operation where you'd like to apply this +behaviour. +#. Go to *RMA / Customr RMA* and create a new RMA. +#. Press the button *Create Sale Quotation* available in the RMA. +#. Confirm the sale quotation. + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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. + +Credits +======= + +Contributors +------------ + +* Jordi Ballester Alomar + + +Maintainer +---------- + +This module is maintained by ForgeFlow diff --git a/rma_sale_force_invoiced/__init__.py b/rma_sale_force_invoiced/__init__.py new file mode 100644 index 00000000..aee8895e --- /dev/null +++ b/rma_sale_force_invoiced/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/rma_sale_force_invoiced/__manifest__.py b/rma_sale_force_invoiced/__manifest__.py new file mode 100644 index 00000000..4c3fd191 --- /dev/null +++ b/rma_sale_force_invoiced/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2022 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.html) + +{ + "name": "RMA Sale Force Invoiced", + "version": "14.0.1.0.0", + "license": "AGPL-3", + "category": "RMA", + "summary": "Forces sales orders created from RMA to be forced as invoiced", + "author": "ForgeFlow", + "website": "https://github.com/ForgeFlow/stock-rma", + "depends": ["rma_sale", "sale_force_invoiced"], + "data": [ + "views/rma_operation_views.xml", + ], + "installable": True, +} diff --git a/rma_sale_force_invoiced/models/__init__.py b/rma_sale_force_invoiced/models/__init__.py new file mode 100644 index 00000000..9fd5ac20 --- /dev/null +++ b/rma_sale_force_invoiced/models/__init__.py @@ -0,0 +1 @@ +from . import rma_operation diff --git a/rma_sale_force_invoiced/models/rma_operation.py b/rma_sale_force_invoiced/models/rma_operation.py new file mode 100644 index 00000000..83529d05 --- /dev/null +++ b/rma_sale_force_invoiced/models/rma_operation.py @@ -0,0 +1,13 @@ +# Copyright 2022 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.html) +from odoo import fields, models + + +class RmaOperation(models.Model): + _inherit = "rma.operation" + + sale_force_invoiced = fields.Boolean( + string="Sale Force Invoiced", + help="Forces the sales order created from RMA to be flagged invoiced. " + "This is useful when the sales order is free of charge.", + ) diff --git a/rma_sale_force_invoiced/views/rma_operation_views.xml b/rma_sale_force_invoiced/views/rma_operation_views.xml new file mode 100644 index 00000000..7f1d5e2f --- /dev/null +++ b/rma_sale_force_invoiced/views/rma_operation_views.xml @@ -0,0 +1,15 @@ + + + + + rma.operation.form + rma.operation + + + + + + + + + diff --git a/rma_sale_force_invoiced/wizards/__init__.py b/rma_sale_force_invoiced/wizards/__init__.py new file mode 100644 index 00000000..049ccf68 --- /dev/null +++ b/rma_sale_force_invoiced/wizards/__init__.py @@ -0,0 +1 @@ +from . import rma_order_line_make_sale_order diff --git a/rma_sale_force_invoiced/wizards/rma_order_line_make_sale_order.py b/rma_sale_force_invoiced/wizards/rma_order_line_make_sale_order.py new file mode 100644 index 00000000..86885a0e --- /dev/null +++ b/rma_sale_force_invoiced/wizards/rma_order_line_make_sale_order.py @@ -0,0 +1,14 @@ +# Copyright 2022 ForgeFlow S.L. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.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): + data = super(RmaLineMakeSaleOrder, self)._prepare_sale_order(line) + data["force_invoiced"] = line.operation_id.sale_force_invoiced + return data From ebe121282738b73a438c5f3eb48bac65b1a173b3 Mon Sep 17 00:00:00 2001 From: DavidJForgeFlow Date: Fri, 3 Mar 2023 16:02:07 +0100 Subject: [PATCH 2/3] [IMP] rma_sale_force_invoiced: pre-commit stuff --- .../odoo/addons/rma_sale_force_invoiced | 1 + setup/rma_sale_force_invoiced/setup.py | 6 ++++++ 2 files changed, 7 insertions(+) create mode 120000 setup/rma_sale_force_invoiced/odoo/addons/rma_sale_force_invoiced create mode 100644 setup/rma_sale_force_invoiced/setup.py diff --git a/setup/rma_sale_force_invoiced/odoo/addons/rma_sale_force_invoiced b/setup/rma_sale_force_invoiced/odoo/addons/rma_sale_force_invoiced new file mode 120000 index 00000000..b9b93641 --- /dev/null +++ b/setup/rma_sale_force_invoiced/odoo/addons/rma_sale_force_invoiced @@ -0,0 +1 @@ +../../../../rma_sale_force_invoiced \ No newline at end of file diff --git a/setup/rma_sale_force_invoiced/setup.py b/setup/rma_sale_force_invoiced/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/rma_sale_force_invoiced/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From 9f16814f7e1ada90dc3843d0cbdd4363a8fc62a1 Mon Sep 17 00:00:00 2001 From: DavidJForgeFlow Date: Fri, 3 Mar 2023 16:09:09 +0100 Subject: [PATCH 3/3] [MIG] rma_sale_force_invoiced: Migration to 15.0 --- rma_sale_force_invoiced/__manifest__.py | 2 +- rma_sale_force_invoiced/models/rma_operation.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/rma_sale_force_invoiced/__manifest__.py b/rma_sale_force_invoiced/__manifest__.py index 4c3fd191..f34b08de 100644 --- a/rma_sale_force_invoiced/__manifest__.py +++ b/rma_sale_force_invoiced/__manifest__.py @@ -3,7 +3,7 @@ { "name": "RMA Sale Force Invoiced", - "version": "14.0.1.0.0", + "version": "15.0.1.0.0", "license": "AGPL-3", "category": "RMA", "summary": "Forces sales orders created from RMA to be forced as invoiced", diff --git a/rma_sale_force_invoiced/models/rma_operation.py b/rma_sale_force_invoiced/models/rma_operation.py index 83529d05..4035e672 100644 --- a/rma_sale_force_invoiced/models/rma_operation.py +++ b/rma_sale_force_invoiced/models/rma_operation.py @@ -7,7 +7,6 @@ class RmaOperation(models.Model): _inherit = "rma.operation" sale_force_invoiced = fields.Boolean( - string="Sale Force Invoiced", help="Forces the sales order created from RMA to be flagged invoiced. " "This is useful when the sales order is free of charge.", )