diff --git a/stock_picking_batch_account_sale_type/README.rst b/stock_picking_batch_account_sale_type/README.rst new file mode 100644 index 000000000000..f6dee84272fb --- /dev/null +++ b/stock_picking_batch_account_sale_type/README.rst @@ -0,0 +1,88 @@ +============================================== +Stock batch picking extended account sale type +============================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5492d2cbb0582ce3a9c986c64ab4f98071c911a26e4f1abea4fc5df930e1dc24 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |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--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-workflow/tree/18.0/stock_picking_batch_account_sale_type + :alt: OCA/stock-logistics-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-workflow-18-0/stock-logistics-workflow-18-0-stock_picking_batch_account_sale_type + :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-workflow&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to set auto invoice from batch picking in sale order +type. + +**Table of contents** + +.. contents:: + :local: + +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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa + +Contributors +------------ + +- `Tecnativa `__: + + - Carlos Dauden + - Sergio Teruel + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-ernestotejeda| image:: https://github.com/ernestotejeda.png?size=40px + :target: https://github.com/ernestotejeda + :alt: ernestotejeda + +Current `maintainer `__: + +|maintainer-ernestotejeda| + +This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_picking_batch_account_sale_type/__init__.py b/stock_picking_batch_account_sale_type/__init__.py new file mode 100644 index 000000000000..31660d6a9650 --- /dev/null +++ b/stock_picking_batch_account_sale_type/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/stock_picking_batch_account_sale_type/__manifest__.py b/stock_picking_batch_account_sale_type/__manifest__.py new file mode 100644 index 000000000000..c5e76bace8b6 --- /dev/null +++ b/stock_picking_batch_account_sale_type/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2022 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Stock batch picking extended account sale type", + "summary": "Generates invoices when batch is set to Done state", + "version": "18.0.1.0.0", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["ernestotejeda"], + "development_status": "Beta", + "category": "Warehouse Management", + "depends": ["stock_picking_batch_account", "sale_order_type"], + "website": "https://github.com/OCA/stock-logistics-workflow", + "data": ["views/sale_order_type_views.xml"], + "installable": True, + "license": "AGPL-3", +} diff --git a/stock_picking_batch_account_sale_type/i18n/es.po b/stock_picking_batch_account_sale_type/i18n/es.po new file mode 100644 index 000000000000..627c17415e57 --- /dev/null +++ b/stock_picking_batch_account_sale_type/i18n/es.po @@ -0,0 +1,54 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_batch_extended_account +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-07-31 17:29+0000\n" +"PO-Revision-Date: 2022-07-31 19:31+0200\n" +"Last-Translator: Sergio Teruel \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Poedit 2.3\n" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account_sale_type.field_res_partner__batch_picking_auto_invoice +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account_sale_type.field_res_users__batch_picking_auto_invoice +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account_sale_type.field_sale_order_type__batch_picking_auto_invoice +msgid "Batch Picking Auto Invoice" +msgstr "Facturación automática en agrupación de albaranes" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model,name:stock_picking_batch_extended_account_sale_type.model_stock_picking_batch +msgid "Batch Transfer" +msgstr "Agrupación de albaranes" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model.fields.selection,name:stock_picking_batch_extended_account_sale_type.selection__res_partner__batch_picking_auto_invoice__sale_type +msgid "By sale type" +msgstr "Por tipo de venta" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model,name:stock_picking_batch_extended_account_sale_type.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model,name:stock_picking_batch_extended_account_sale_type.model_sale_order_type +msgid "Type of sale order" +msgstr "Tipo de pedido de venta" + +#~ msgid "Nothing to print." +#~ msgstr "Nada para imprimir." + +#~ msgid "Print Invoices" +#~ msgstr "Imprimir facturas" + +#~ msgid "Transfer" +#~ msgstr "Albarán" diff --git a/stock_picking_batch_account_sale_type/i18n/it.po b/stock_picking_batch_account_sale_type/i18n/it.po new file mode 100644 index 000000000000..930aeecdbee1 --- /dev/null +++ b/stock_picking_batch_account_sale_type/i18n/it.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_batch_extended_account_sale_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-11-17 09:33+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account_sale_type.field_res_partner__batch_picking_auto_invoice +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account_sale_type.field_res_users__batch_picking_auto_invoice +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account_sale_type.field_sale_order_type__batch_picking_auto_invoice +msgid "Batch Picking Auto Invoice" +msgstr "Auto fattura prelievo ragruppato" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model,name:stock_picking_batch_extended_account_sale_type.model_stock_picking_batch +msgid "Batch Transfer" +msgstr "Trasferimento raggruppato" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model.fields.selection,name:stock_picking_batch_extended_account_sale_type.selection__res_partner__batch_picking_auto_invoice__sale_type +msgid "By sale type" +msgstr "Per tipo vendita" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model,name:stock_picking_batch_extended_account_sale_type.model_res_partner +msgid "Contact" +msgstr "Contatto" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model,name:stock_picking_batch_extended_account_sale_type.model_sale_order_type +msgid "Type of sale order" +msgstr "Tipo di ordine di vendita" diff --git a/stock_picking_batch_account_sale_type/i18n/stock_picking_batch_extended_account_sale_type.pot b/stock_picking_batch_account_sale_type/i18n/stock_picking_batch_extended_account_sale_type.pot new file mode 100644 index 000000000000..bfb8df6a7ef6 --- /dev/null +++ b/stock_picking_batch_account_sale_type/i18n/stock_picking_batch_extended_account_sale_type.pot @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * stock_picking_batch_extended_account_sale_type +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account_sale_type.field_res_partner__batch_picking_auto_invoice +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account_sale_type.field_res_users__batch_picking_auto_invoice +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account_sale_type.field_sale_order_type__batch_picking_auto_invoice +msgid "Batch Picking Auto Invoice" +msgstr "" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model,name:stock_picking_batch_extended_account_sale_type.model_stock_picking_batch +msgid "Batch Transfer" +msgstr "" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model.fields.selection,name:stock_picking_batch_extended_account_sale_type.selection__res_partner__batch_picking_auto_invoice__sale_type +msgid "By sale type" +msgstr "" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model,name:stock_picking_batch_extended_account_sale_type.model_res_partner +msgid "Contact" +msgstr "" + +#. module: stock_picking_batch_extended_account_sale_type +#: model:ir.model,name:stock_picking_batch_extended_account_sale_type.model_sale_order_type +msgid "Type of sale order" +msgstr "" diff --git a/stock_picking_batch_account_sale_type/models/__init__.py b/stock_picking_batch_account_sale_type/models/__init__.py new file mode 100644 index 000000000000..f8e7ee90fb90 --- /dev/null +++ b/stock_picking_batch_account_sale_type/models/__init__.py @@ -0,0 +1,5 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import res_partner +from . import sale_order_type +from . import stock_batch_picking diff --git a/stock_picking_batch_account_sale_type/models/res_partner.py b/stock_picking_batch_account_sale_type/models/res_partner.py new file mode 100644 index 000000000000..a3b8cbd9dfe7 --- /dev/null +++ b/stock_picking_batch_account_sale_type/models/res_partner.py @@ -0,0 +1,12 @@ +# Copyright 2020 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + batch_picking_auto_invoice = fields.Selection( + selection_add=[("sale_type", "By sale type")] + ) diff --git a/stock_picking_batch_account_sale_type/models/sale_order_type.py b/stock_picking_batch_account_sale_type/models/sale_order_type.py new file mode 100644 index 000000000000..3f6373ec4c4c --- /dev/null +++ b/stock_picking_batch_account_sale_type/models/sale_order_type.py @@ -0,0 +1,10 @@ +# Copyright 2022 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class SaleOrderType(models.Model): + _inherit = "sale.order.type" + + batch_picking_auto_invoice = fields.Boolean() diff --git a/stock_picking_batch_account_sale_type/models/stock_batch_picking.py b/stock_picking_batch_account_sale_type/models/stock_batch_picking.py new file mode 100644 index 000000000000..36ba9433f9c9 --- /dev/null +++ b/stock_picking_batch_account_sale_type/models/stock_batch_picking.py @@ -0,0 +1,16 @@ +# Copyright 2022 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import models + + +class StockBatchPicking(models.Model): + _inherit = "stock.picking.batch" + + def _get_domain_picking_to_invoice(self): + domain = super()._get_domain_picking_to_invoice() + return [ + "|", + "&", + ("partner_id.batch_picking_auto_invoice", "=", "sale_type"), + ("sale_id.type_id.batch_picking_auto_invoice", "=", True), + ] + domain diff --git a/stock_picking_batch_account_sale_type/pyproject.toml b/stock_picking_batch_account_sale_type/pyproject.toml new file mode 100644 index 000000000000..4231d0cccb3d --- /dev/null +++ b/stock_picking_batch_account_sale_type/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/stock_picking_batch_account_sale_type/readme/CONTRIBUTORS.md b/stock_picking_batch_account_sale_type/readme/CONTRIBUTORS.md new file mode 100644 index 000000000000..5afbff2172ca --- /dev/null +++ b/stock_picking_batch_account_sale_type/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [Tecnativa](https://www.tecnativa.com): + - Carlos Dauden + - Sergio Teruel diff --git a/stock_picking_batch_account_sale_type/readme/DESCRIPTION.md b/stock_picking_batch_account_sale_type/readme/DESCRIPTION.md new file mode 100644 index 000000000000..0c2a4871aed7 --- /dev/null +++ b/stock_picking_batch_account_sale_type/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows to set auto invoice from batch picking in sale order type. diff --git a/stock_picking_batch_account_sale_type/static/description/icon.png b/stock_picking_batch_account_sale_type/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/stock_picking_batch_account_sale_type/static/description/icon.png differ diff --git a/stock_picking_batch_account_sale_type/static/description/index.html b/stock_picking_batch_account_sale_type/static/description/index.html new file mode 100644 index 000000000000..b8c959cbbe19 --- /dev/null +++ b/stock_picking_batch_account_sale_type/static/description/index.html @@ -0,0 +1,430 @@ + + + + + +Stock batch picking extended account sale type + + + +
+

Stock batch picking extended account sale type

+ + +

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

+

This module allows to set auto invoice from batch picking in sale order +type.

+

Table of contents

+ +
+

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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Carlos Dauden
    • +
    • Sergio Teruel
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+ +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.

+

Current maintainer:

+

ernestotejeda

+

This module is part of the OCA/stock-logistics-workflow project on GitHub.

+

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

+
+
+
+ + diff --git a/stock_picking_batch_account_sale_type/tests/__init__.py b/stock_picking_batch_account_sale_type/tests/__init__.py new file mode 100644 index 000000000000..e6dfbb846496 --- /dev/null +++ b/stock_picking_batch_account_sale_type/tests/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2022 Sergio Teruel - Tecnativa +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from . import test_stock_picking_batch_extended_account_sale_type diff --git a/stock_picking_batch_account_sale_type/tests/test_stock_picking_batch_extended_account_sale_type.py b/stock_picking_batch_account_sale_type/tests/test_stock_picking_batch_extended_account_sale_type.py new file mode 100644 index 000000000000..ebc3b6ac65f6 --- /dev/null +++ b/stock_picking_batch_account_sale_type/tests/test_stock_picking_batch_extended_account_sale_type.py @@ -0,0 +1,41 @@ +# Copyright 2019 Sergio Teruel - Tecnativa +# Copyright 2023 Moduon Team - Eduardo de Miguel +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT +from odoo.addons.stock_picking_batch_account.tests import ( + test_stock_picking_batch_extended_account as test_bp_account, +) + + +class TestStockPickingBatchExtendedAccountSaleType( + test_bp_account.TestStockPickingBatchExtendedAccount +): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT)) + cls.sale_type = cls.env["sale.order.type"].create( + {"name": "sale type for tests", "batch_picking_auto_invoice": True} + ) + cls.partner.write( + {"sale_type": cls.sale_type.id, "batch_picking_auto_invoice": "no"} + ) + cls.partner2.write( + {"sale_type": cls.sale_type.id, "batch_picking_auto_invoice": "sale_type"} + ) + + def test_create_invoice_from_bp_sale_type(self): + self.order1 = self._create_sale_order(self.partner) + self.order2 = self._create_sale_order(self.partner2) + self.order1.action_confirm() + self.order2.action_confirm() + pickings = self.order1.picking_ids + self.order2.picking_ids + move_lines = pickings.mapped("move_line_ids") + move_lines.quantity = 1.0 + bp = self._create_batch_picking(pickings) + bp.action_assign() + action_done_res = bp.action_done() + if action_done_res is not True: + self._process_immediate_transfer(action_done_res) + self.assertFalse(self.order1.invoice_ids) + self.assertTrue(self.order2.invoice_ids) diff --git a/stock_picking_batch_account_sale_type/views/sale_order_type_views.xml b/stock_picking_batch_account_sale_type/views/sale_order_type_views.xml new file mode 100644 index 000000000000..85e46b29929d --- /dev/null +++ b/stock_picking_batch_account_sale_type/views/sale_order_type_views.xml @@ -0,0 +1,12 @@ + + + + sale.order.type + + + + + + + +