diff --git a/shipment_advice_cash_on_delivery/README.rst b/partner_invoicing_mode_cash_on_delivery/README.rst similarity index 60% rename from shipment_advice_cash_on_delivery/README.rst rename to partner_invoicing_mode_cash_on_delivery/README.rst index a800eaf77c4a..f21e5bd0aabb 100644 --- a/shipment_advice_cash_on_delivery/README.rst +++ b/partner_invoicing_mode_cash_on_delivery/README.rst @@ -1,13 +1,13 @@ -================================ -Shipment Advice Cash on Delivery -================================ +======================================= +Partner Invoicing Mode Cash on Delivery +======================================= .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:402231bc491adcd94e5edba386548075cb5aa8332caa2ca5843f7bea5ba88f0f + !! source digest: sha256:5525b56e6241690abaa44bb465f180508ee6a0af871cd8a3d2232216e25c602c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -16,14 +16,14 @@ Shipment Advice Cash on Delivery .. |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%2Fstock--logistics--transport-lightgray.png?logo=github - :target: https://github.com/OCA/stock-logistics-transport/tree/16.0/shipment_advice_cash_on_delivery - :alt: OCA/stock-logistics-transport +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--invoicing-lightgray.png?logo=github + :target: https://github.com/OCA/account-invoicing/tree/16.0/partner_invoicing_mode_cash_on_delivery + :alt: OCA/account-invoicing .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/stock-logistics-transport-16-0/stock-logistics-transport-16-0-shipment_advice_cash_on_delivery + :target: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-partner_invoicing_mode_cash_on_delivery :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-transport&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -31,7 +31,7 @@ Shipment Advice Cash on Delivery Allow to mark a payment mode as "cash on delivery". When the picking is delivered, an invoice is automaticaly generated with the amount to be paid. -Allows users to print cash on delivery invoices from a shipment advice +Allows users to identify cash on delivery invoices on shippings. **Table of contents** @@ -41,15 +41,16 @@ Allows users to print cash on delivery invoices from a shipment advice Configuration ============= -You must mark a payment mode as "cash on delivery". +You must mark a payment mode as "cash on delivery". If you want the invoice +to be posted at the same moment, check the "Auto validate Invoice When Cash On Delivery" Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. +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 to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -69,6 +70,7 @@ Contributors * Jacques-Etienne Baudoux * Souheil Bejaoui * Tuan Tran +* Denis Roussel Maintainers ~~~~~~~~~~~ @@ -83,6 +85,6 @@ 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/stock-logistics-transport `_ project on GitHub. +This module is part of the `OCA/account-invoicing `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/shipment_advice_cash_on_delivery/__init__.py b/partner_invoicing_mode_cash_on_delivery/__init__.py similarity index 100% rename from shipment_advice_cash_on_delivery/__init__.py rename to partner_invoicing_mode_cash_on_delivery/__init__.py diff --git a/shipment_advice_cash_on_delivery/__manifest__.py b/partner_invoicing_mode_cash_on_delivery/__manifest__.py similarity index 65% rename from shipment_advice_cash_on_delivery/__manifest__.py rename to partner_invoicing_mode_cash_on_delivery/__manifest__.py index 59ae3f21c4ed..6d8f11f12025 100644 --- a/shipment_advice_cash_on_delivery/__manifest__.py +++ b/partner_invoicing_mode_cash_on_delivery/__manifest__.py @@ -4,21 +4,19 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { - "name": "Shipment Advice Cash on Delivery", - "summary": """This module allows users to print cash on delivery invoices - from a shipment advice""", + "name": "Partner Invoicing Mode Cash on Delivery", + "summary": """This module allows users to distinguish cash on delivery invoices + in the automatic invoicing flow""", "version": "16.0.1.0.0", "license": "AGPL-3", "author": "BCIM, ACSONE SA/NV, Camptocamp, Odoo Community Association (OCA)", - "website": "https://github.com/OCA/stock-logistics-transport", + "website": "https://github.com/OCA/account-invoicing", "depends": [ "account_payment_sale", - "shipment_advice", "partner_invoicing_mode_at_shipping", ], "data": [ "views/account_payment_mode_views.xml", - "views/shipment_advice.xml", "views/stock_picking_views.xml", ], } diff --git a/shipment_advice_cash_on_delivery/models/__init__.py b/partner_invoicing_mode_cash_on_delivery/models/__init__.py similarity index 67% rename from shipment_advice_cash_on_delivery/models/__init__.py rename to partner_invoicing_mode_cash_on_delivery/models/__init__.py index 4d956b2e1898..dd21a50eb9f0 100644 --- a/shipment_advice_cash_on_delivery/models/__init__.py +++ b/partner_invoicing_mode_cash_on_delivery/models/__init__.py @@ -1,3 +1,2 @@ from . import account_payment_mode -from . import shipment_advice from . import stock_picking diff --git a/partner_invoicing_mode_cash_on_delivery/models/account_payment_mode.py b/partner_invoicing_mode_cash_on_delivery/models/account_payment_mode.py new file mode 100644 index 000000000000..c9bc7dd526c7 --- /dev/null +++ b/partner_invoicing_mode_cash_on_delivery/models/account_payment_mode.py @@ -0,0 +1,15 @@ +# Copyright 2018 Jacques-Etienne Baudoux (BCIM) + +from odoo import fields, models + + +class AccountPaymentMode(models.Model): + _inherit = "account.payment.mode" + + cash_on_delivery = fields.Boolean( + help="Check this if you want to identify Cash On Delivery invoices on stock pickings." + ) + auto_validate_invoice_cash_on_delivery = fields.Boolean( + help="Check this if you want Cash on Delivery deliveries will validate " + "automatically generated invoices." + ) diff --git a/shipment_advice_cash_on_delivery/models/stock_picking.py b/partner_invoicing_mode_cash_on_delivery/models/stock_picking.py similarity index 87% rename from shipment_advice_cash_on_delivery/models/stock_picking.py rename to partner_invoicing_mode_cash_on_delivery/models/stock_picking.py index 75e3ffe471a9..55c6b08a1ca2 100644 --- a/shipment_advice_cash_on_delivery/models/stock_picking.py +++ b/partner_invoicing_mode_cash_on_delivery/models/stock_picking.py @@ -14,6 +14,11 @@ class StockPicking(models.Model): ) def _invoice_at_shipping(self): + """ + This will take this picking into account for invoice creation (at shipping) + when sale order has Cash On Delivery set and even if the partner is not + using that mode (at shipping). + """ self.ensure_one() res = super()._invoice_at_shipping() res = res or self.sale_id.payment_mode_id.cash_on_delivery diff --git a/partner_invoicing_mode_cash_on_delivery/readme/CONFIGURE.rst b/partner_invoicing_mode_cash_on_delivery/readme/CONFIGURE.rst new file mode 100644 index 000000000000..7c8a91089189 --- /dev/null +++ b/partner_invoicing_mode_cash_on_delivery/readme/CONFIGURE.rst @@ -0,0 +1,2 @@ +You must mark a payment mode as "cash on delivery". If you want the invoice +to be posted at the same moment, check the "Auto validate Invoice When Cash On Delivery" diff --git a/shipment_advice_cash_on_delivery/readme/CONTRIBUTORS.rst b/partner_invoicing_mode_cash_on_delivery/readme/CONTRIBUTORS.rst similarity index 73% rename from shipment_advice_cash_on_delivery/readme/CONTRIBUTORS.rst rename to partner_invoicing_mode_cash_on_delivery/readme/CONTRIBUTORS.rst index e0ae86784fb0..d7b17518465f 100644 --- a/shipment_advice_cash_on_delivery/readme/CONTRIBUTORS.rst +++ b/partner_invoicing_mode_cash_on_delivery/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Jacques-Etienne Baudoux * Souheil Bejaoui * Tuan Tran +* Denis Roussel diff --git a/shipment_advice_cash_on_delivery/readme/DESCRIPTION.rst b/partner_invoicing_mode_cash_on_delivery/readme/DESCRIPTION.rst similarity index 67% rename from shipment_advice_cash_on_delivery/readme/DESCRIPTION.rst rename to partner_invoicing_mode_cash_on_delivery/readme/DESCRIPTION.rst index 047006f7e69a..f75c701ec887 100644 --- a/shipment_advice_cash_on_delivery/readme/DESCRIPTION.rst +++ b/partner_invoicing_mode_cash_on_delivery/readme/DESCRIPTION.rst @@ -1,4 +1,4 @@ Allow to mark a payment mode as "cash on delivery". When the picking is delivered, an invoice is automaticaly generated with the amount to be paid. -Allows users to print cash on delivery invoices from a shipment advice +Allows users to identify cash on delivery invoices on shippings. diff --git a/shipment_advice_cash_on_delivery/static/description/index.html b/partner_invoicing_mode_cash_on_delivery/static/description/index.html similarity index 72% rename from shipment_advice_cash_on_delivery/static/description/index.html rename to partner_invoicing_mode_cash_on_delivery/static/description/index.html index a0bfca033c86..faf2b1beb50f 100644 --- a/shipment_advice_cash_on_delivery/static/description/index.html +++ b/partner_invoicing_mode_cash_on_delivery/static/description/index.html @@ -1,20 +1,20 @@ + - -Shipment Advice Cash on Delivery + +Partner Invoicing Mode Cash on Delivery -
-

Shipment Advice Cash on Delivery

+
+

Partner Invoicing Mode Cash on Delivery

-

Beta License: AGPL-3 OCA/stock-logistics-transport Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/account-invoicing Translate me on Weblate Try me on Runboat

Allow to mark a payment mode as “cash on delivery”. When the picking is delivered, an invoice is automaticaly generated with the amount to be paid. -Allows users to print cash on delivery invoices from a shipment advice

+Allows users to identify cash on delivery invoices on shippings.

Table of contents

-

Configuration

-

You must mark a payment mode as “cash on delivery”.

+

Configuration

+

You must mark a payment mode as “cash on delivery”. If you want the invoice +to be posted at the same moment, check the “Auto validate Invoice When Cash On Delivery”

-

Bug Tracker

-

Bugs are tracked on GitHub Issues. +

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 to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

-

Credits

+

Credits

-

Authors

+

Authors

  • BCIM
  • ACSONE SA/NV
  • @@ -410,23 +411,22 @@

    Authors

-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

- -Odoo Community Association - +Odoo Community Association

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/stock-logistics-transport project on GitHub.

+

This module is part of the OCA/account-invoicing project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/shipment_advice_cash_on_delivery/tests/__init__.py b/partner_invoicing_mode_cash_on_delivery/tests/__init__.py similarity index 100% rename from shipment_advice_cash_on_delivery/tests/__init__.py rename to partner_invoicing_mode_cash_on_delivery/tests/__init__.py diff --git a/shipment_advice_cash_on_delivery/tests/test_shipment_advice_cash_on_delivery.py b/partner_invoicing_mode_cash_on_delivery/tests/test_shipment_advice_cash_on_delivery.py similarity index 80% rename from shipment_advice_cash_on_delivery/tests/test_shipment_advice_cash_on_delivery.py rename to partner_invoicing_mode_cash_on_delivery/tests/test_shipment_advice_cash_on_delivery.py index cc5d64f56a7c..3bd28e6f649e 100644 --- a/shipment_advice_cash_on_delivery/tests/test_shipment_advice_cash_on_delivery.py +++ b/partner_invoicing_mode_cash_on_delivery/tests/test_shipment_advice_cash_on_delivery.py @@ -4,11 +4,11 @@ from odoo import Command +from odoo.addons.base.tests.common import BaseCommon from odoo.addons.queue_job.tests.common import trap_jobs -from odoo.addons.shipment_advice.tests.common import Common -class TestShipmentAdviceCashOnDelivery(Common): +class TestPartnerInvoiceCashOnDelivery(BaseCommon): @classmethod def setUpClass(cls): super().setUpClass() @@ -73,42 +73,17 @@ def _create_and_process_sale_order(self, dict_val): so.action_confirm() pick = so.picking_ids - # Process shipment advice & picking - shipment_advice = self.env["shipment.advice"].create( - {"shipment_type": "outgoing"} - ) - self._plan_records_in_shipment(shipment_advice, pick) - self._in_progress_shipment_advice(shipment_advice) - wiz = self._load_records_in_shipment(shipment_advice, pick) - self.assertEqual(wiz.picking_ids, pick) - self.assertFalse(wiz.move_line_ids) pick.move_ids.write({"quantity_done": 1}) with trap_jobs() as trap: pick._action_done() - if trap.jobs_count() > 0: - trap.assert_enqueued_job( - pick._invoicing_at_shipping, - ) - trap.perform_enqueued_jobs() - shipment_advice.action_done() - self.assertEqual(shipment_advice.state, "done") + trap.perform_enqueued_jobs() - return pick, shipment_advice + return pick - def _check_picking_shipment(self, pick, shipment, partner): + def _check_picking(self, pick, partner): self.assertEqual(len(pick.cash_on_delivery_invoice_ids), 1) cod_invoice = pick.cash_on_delivery_invoice_ids[0] self.assertEqual(cod_invoice.invoice_partner_display_name, partner.name) - action = shipment.with_context( - discard_logo_check=True - ).print_cash_on_delivery_invoices() - self.assertEqual(action.get("type"), "ir.actions.report") - self.assertEqual(action.get("report_name"), "account.report_invoice") - self.assertEqual(action.get("report_type"), "qweb-pdf") - self.assertEqual( - action.get("context").get("active_ids"), - pick.cash_on_delivery_invoice_ids.ids, - ) def test01(self): """ @@ -116,7 +91,7 @@ def test01(self): invoicing at shipping => Should be listed in picking.cash_on_delivery_invoice_ids """ - pick, shipment = self._create_and_process_sale_order( + pick = self._create_and_process_sale_order( { "partner_id": self.partner_standard.id, "partner_invoice_id": self.partner_standard.id, @@ -138,7 +113,7 @@ def test01(self): } ) - self._check_picking_shipment(pick, shipment, self.partner_standard) + self._check_picking(pick, self.partner_standard) def test02(self): """ @@ -146,7 +121,7 @@ def test02(self): invoicing at shipping => Should be listed in picking.cash_on_delivery_invoice_ids """ - pick, shipment = self._create_and_process_sale_order( + pick = self._create_and_process_sale_order( { "partner_id": self.partner_at_shipping.id, "partner_invoice_id": self.partner_at_shipping.id, @@ -168,7 +143,7 @@ def test02(self): } ) - self._check_picking_shipment(pick, shipment, self.partner_at_shipping) + self._check_picking(pick, self.partner_at_shipping) def test03(self): """ @@ -176,7 +151,7 @@ def test03(self): invoicing at shipping => Should NOT be listed in picking.cash_on_delivery_invoice_ids """ - pick, dummy = self._create_and_process_sale_order( + pick = self._create_and_process_sale_order( { "partner_id": self.partner_at_shipping.id, "partner_invoice_id": self.partner_at_shipping.id, @@ -206,7 +181,7 @@ def test04(self): invoicing at shipping => Should NOT be listed in picking.cash_on_delivery_invoice_ids """ - pick, dummy = self._create_and_process_sale_order( + pick = self._create_and_process_sale_order( { "partner_id": self.partner_standard.id, "partner_invoice_id": self.partner_standard.id, diff --git a/shipment_advice_cash_on_delivery/views/account_payment_mode_views.xml b/partner_invoicing_mode_cash_on_delivery/views/account_payment_mode_views.xml similarity index 90% rename from shipment_advice_cash_on_delivery/views/account_payment_mode_views.xml rename to partner_invoicing_mode_cash_on_delivery/views/account_payment_mode_views.xml index 0d0214ba4f4f..a173c9a591ab 100644 --- a/shipment_advice_cash_on_delivery/views/account_payment_mode_views.xml +++ b/partner_invoicing_mode_cash_on_delivery/views/account_payment_mode_views.xml @@ -8,7 +8,7 @@ diff --git a/shipment_advice_cash_on_delivery/views/stock_picking_views.xml b/partner_invoicing_mode_cash_on_delivery/views/stock_picking_views.xml similarity index 100% rename from shipment_advice_cash_on_delivery/views/stock_picking_views.xml rename to partner_invoicing_mode_cash_on_delivery/views/stock_picking_views.xml diff --git a/setup/partner_invoicing_mode_cash_on_delivery/odoo/addons/partner_invoicing_mode_cash_on_delivery b/setup/partner_invoicing_mode_cash_on_delivery/odoo/addons/partner_invoicing_mode_cash_on_delivery new file mode 120000 index 000000000000..d430887a99e5 --- /dev/null +++ b/setup/partner_invoicing_mode_cash_on_delivery/odoo/addons/partner_invoicing_mode_cash_on_delivery @@ -0,0 +1 @@ +../../../../partner_invoicing_mode_cash_on_delivery \ No newline at end of file diff --git a/setup/partner_invoicing_mode_cash_on_delivery/setup.py b/setup/partner_invoicing_mode_cash_on_delivery/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/partner_invoicing_mode_cash_on_delivery/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/shipment_advice_cash_on_delivery/models/account_payment_mode.py b/shipment_advice_cash_on_delivery/models/account_payment_mode.py deleted file mode 100644 index 5725bd11c70b..000000000000 --- a/shipment_advice_cash_on_delivery/models/account_payment_mode.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright 2018 Jacques-Etienne Baudoux (BCIM) - -from odoo import fields, models - - -class AccountPaymentMode(models.Model): - _inherit = "account.payment.mode" - - cash_on_delivery = fields.Boolean("Cash on Delivery") - auto_validate_invoice = fields.Boolean() diff --git a/shipment_advice_cash_on_delivery/models/shipment_advice.py b/shipment_advice_cash_on_delivery/models/shipment_advice.py deleted file mode 100644 index 95ad40e1b1df..000000000000 --- a/shipment_advice_cash_on_delivery/models/shipment_advice.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2018 Jacques-Etienne Baudoux (BCIM) -# Copyright 2023 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from odoo import models - - -class ShipmentAdvice(models.Model): - _inherit = "shipment.advice" - - def print_cash_on_delivery_invoices(self): - done_shipment_advices = self.filtered(lambda s: s.state == "done") - cod_invoices = done_shipment_advices.mapped("loaded_picking_ids").mapped( - "cash_on_delivery_invoice_ids" - ) - if cod_invoices: - return self.env.ref( - "account.account_invoices_without_payment" - ).report_action(cod_invoices) - return {} diff --git a/shipment_advice_cash_on_delivery/readme/CONFIGURE.rst b/shipment_advice_cash_on_delivery/readme/CONFIGURE.rst deleted file mode 100644 index 5a85e16d0855..000000000000 --- a/shipment_advice_cash_on_delivery/readme/CONFIGURE.rst +++ /dev/null @@ -1 +0,0 @@ -You must mark a payment mode as "cash on delivery". diff --git a/shipment_advice_cash_on_delivery/views/shipment_advice.xml b/shipment_advice_cash_on_delivery/views/shipment_advice.xml deleted file mode 100644 index 50f9a241edf9..000000000000 --- a/shipment_advice_cash_on_delivery/views/shipment_advice.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Print COD Invoice - - - code - action = records.print_cash_on_delivery_invoices() - - - - - shipment.advice.view.form.inherit - shipment.advice - - -
-
-
-
- -