diff --git a/setup/stock_picking_batch_extended_account_sale_type/odoo/addons/stock_picking_batch_extended_account_sale_type b/setup/stock_picking_batch_extended_account_sale_type/odoo/addons/stock_picking_batch_extended_account_sale_type new file mode 120000 index 000000000000..ca6d7f876134 --- /dev/null +++ b/setup/stock_picking_batch_extended_account_sale_type/odoo/addons/stock_picking_batch_extended_account_sale_type @@ -0,0 +1 @@ +../../../../stock_picking_batch_extended_account_sale_type \ No newline at end of file diff --git a/setup/stock_picking_batch_extended_account_sale_type/setup.py b/setup/stock_picking_batch_extended_account_sale_type/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/stock_picking_batch_extended_account_sale_type/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/stock_picking_batch_extended_account_sale_type/README.rst b/stock_picking_batch_extended_account_sale_type/README.rst new file mode 100644 index 000000000000..b2639b5db81c --- /dev/null +++ b/stock_picking_batch_extended_account_sale_type/README.rst @@ -0,0 +1,85 @@ +============================================== +Stock batch picking extended account sale type +============================================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/15.0/stock_picking_batch_extended_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-15-0/stock-logistics-workflow-15-0-stock_picking_batch_extended_account_sale_type + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/154/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module extends stock_picking_batch_extended_account module to allow 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 smashing 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_extended_account_sale_type/__init__.py b/stock_picking_batch_extended_account_sale_type/__init__.py new file mode 100644 index 000000000000..31660d6a9650 --- /dev/null +++ b/stock_picking_batch_extended_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_extended_account_sale_type/__manifest__.py b/stock_picking_batch_extended_account_sale_type/__manifest__.py new file mode 100644 index 000000000000..f13479fc038c --- /dev/null +++ b/stock_picking_batch_extended_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": "15.0.1.0.0", + "author": "Tecnativa, Odoo Community Association (OCA)", + "maintainers": ["ernestotejeda"], + "development_status": "Beta", + "category": "Warehouse Management", + "depends": ["stock_picking_batch_extended_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_extended_account_sale_type/i18n/es.po b/stock_picking_batch_extended_account_sale_type/i18n/es.po new file mode 100644 index 000000000000..627c17415e57 --- /dev/null +++ b/stock_picking_batch_extended_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_extended_account_sale_type/i18n/stock_picking_batch_extended_account_sale_type.pot b/stock_picking_batch_extended_account_sale_type/i18n/stock_picking_batch_extended_account_sale_type.pot new file mode 100644 index 000000000000..30e466593788 --- /dev/null +++ b/stock_picking_batch_extended_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 13.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_extended_account_sale_type/models/__init__.py b/stock_picking_batch_extended_account_sale_type/models/__init__.py new file mode 100644 index 000000000000..f8e7ee90fb90 --- /dev/null +++ b/stock_picking_batch_extended_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_extended_account_sale_type/models/res_partner.py b/stock_picking_batch_extended_account_sale_type/models/res_partner.py new file mode 100644 index 000000000000..a3b8cbd9dfe7 --- /dev/null +++ b/stock_picking_batch_extended_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_extended_account_sale_type/models/sale_order_type.py b/stock_picking_batch_extended_account_sale_type/models/sale_order_type.py new file mode 100644 index 000000000000..3f6373ec4c4c --- /dev/null +++ b/stock_picking_batch_extended_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_extended_account_sale_type/models/stock_batch_picking.py b/stock_picking_batch_extended_account_sale_type/models/stock_batch_picking.py new file mode 100644 index 000000000000..36ba9433f9c9 --- /dev/null +++ b/stock_picking_batch_extended_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_extended_account_sale_type/readme/CONTRIBUTORS.rst b/stock_picking_batch_extended_account_sale_type/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..0763b4b67d40 --- /dev/null +++ b/stock_picking_batch_extended_account_sale_type/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Carlos Dauden + * Sergio Teruel diff --git a/stock_picking_batch_extended_account_sale_type/readme/DESCRIPTION.rst b/stock_picking_batch_extended_account_sale_type/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..0b47b5fc0d68 --- /dev/null +++ b/stock_picking_batch_extended_account_sale_type/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module extends stock_picking_batch_extended_account module to allow to set +auto invoice from batch picking in sale order type. diff --git a/stock_picking_batch_extended_account_sale_type/static/description/icon.png b/stock_picking_batch_extended_account_sale_type/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/stock_picking_batch_extended_account_sale_type/static/description/icon.png differ diff --git a/stock_picking_batch_extended_account_sale_type/static/description/index.html b/stock_picking_batch_extended_account_sale_type/static/description/index.html new file mode 100644 index 000000000000..cfcbcd81d65c --- /dev/null +++ b/stock_picking_batch_extended_account_sale_type/static/description/index.html @@ -0,0 +1,426 @@ + + + + + + +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 Runbot

+

This module extends stock_picking_batch_extended_account module to allow 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 smashing 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_extended_account_sale_type/tests/__init__.py b/stock_picking_batch_extended_account_sale_type/tests/__init__.py new file mode 100644 index 000000000000..e6dfbb846496 --- /dev/null +++ b/stock_picking_batch_extended_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_extended_account_sale_type/tests/test_stock_picking_batch_extended_account_sale_type.py b/stock_picking_batch_extended_account_sale_type/tests/test_stock_picking_batch_extended_account_sale_type.py new file mode 100644 index 000000000000..f64357f7dd58 --- /dev/null +++ b/stock_picking_batch_extended_account_sale_type/tests/test_stock_picking_batch_extended_account_sale_type.py @@ -0,0 +1,36 @@ +# Copyright 2019 Sergio Teruel - Tecnativa +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo.addons.stock_picking_batch_extended_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.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.qty_done = 1.0 + bp = self._create_batch_picking(pickings) + bp.action_assign() + bp.action_done() + self.assertFalse(self.order1.invoice_ids) + self.assertTrue(self.order2.invoice_ids) diff --git a/stock_picking_batch_extended_account_sale_type/views/sale_order_type_views.xml b/stock_picking_batch_extended_account_sale_type/views/sale_order_type_views.xml new file mode 100644 index 000000000000..85e46b29929d --- /dev/null +++ b/stock_picking_batch_extended_account_sale_type/views/sale_order_type_views.xml @@ -0,0 +1,12 @@ + + + + sale.order.type + + + + + + + +