diff --git a/setup/stock_picking_batch_extended_account/odoo/addons/stock_picking_batch_extended_account b/setup/stock_picking_batch_extended_account/odoo/addons/stock_picking_batch_extended_account new file mode 120000 index 000000000000..1e003638ae08 --- /dev/null +++ b/setup/stock_picking_batch_extended_account/odoo/addons/stock_picking_batch_extended_account @@ -0,0 +1 @@ +../../../../stock_picking_batch_extended_account \ No newline at end of file diff --git a/setup/stock_picking_batch_extended_account/setup.py b/setup/stock_picking_batch_extended_account/setup.py new file mode 100644 index 000000000000..28c57bb64031 --- /dev/null +++ b/setup/stock_picking_batch_extended_account/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/README.rst b/stock_picking_batch_extended_account/README.rst new file mode 100644 index 000000000000..e36688c41f12 --- /dev/null +++ b/stock_picking_batch_extended_account/README.rst @@ -0,0 +1,116 @@ +=========================== +Stock batch picking account +=========================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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 + :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 + :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 the functionality of stock_picking_batch_extended +to support the creation of invoices automatically when a batch is set +to 'Done' state and to allow you to print the invoices of the +sales orders linked to the pickings of the batch. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +To configure this module, you need to check 'Batch picking auto invoice' +field of the partners for whom you want the invoice to be automatically +generated when any batch that has a 'Picking' to which they belong is +set to 'done' state. + +#. Go to each of thoes partner, edit them, find 'Batch picking auto invoice' + field under 'Sales & Purchase' tab and check it. + +Usage +===== + +To use this module, you need to: + +#. Go to *Inventory > Batch Picking*. +#. Create a new batch and add some pickings such that their partners + have the option 'Batch picking auto invoice' checked + (See configuration section). Make sure the selected pickings are + linked to a sales order. +#. Confirm the batch. +#. Set the batch to 'done' state. After that, invoices will be generated + for all sales orders linked to the pickings of the batch. +#. Click on 'Print Invoices' button in the status bar and you will see a PDF + report for all the generated invoices. + +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 `_: + + * Ernesto Tejeda + * Pedro M. Baeza + * 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/__init__.py b/stock_picking_batch_extended_account/__init__.py new file mode 100644 index 000000000000..31660d6a9650 --- /dev/null +++ b/stock_picking_batch_extended_account/__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/__manifest__.py b/stock_picking_batch_extended_account/__manifest__.py new file mode 100644 index 000000000000..02f6a5370969 --- /dev/null +++ b/stock_picking_batch_extended_account/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2020 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Stock batch picking account", + "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"], + "website": "https://github.com/OCA/stock-logistics-workflow", + "data": ["views/stock_batch_picking.xml", "views/res_partner_views.xml"], + "installable": True, + "license": "AGPL-3", +} diff --git a/stock_picking_batch_extended_account/i18n/es.po b/stock_picking_batch_extended_account/i18n/es.po new file mode 100644 index 000000000000..0c8c906670d0 --- /dev/null +++ b/stock_picking_batch_extended_account/i18n/es.po @@ -0,0 +1,60 @@ +# 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:27+0000\n" +"PO-Revision-Date: 2022-07-31 19:28+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 +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account.field_res_partner__batch_picking_auto_invoice +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account.field_res_users__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 +#: model:ir.model,name:stock_picking_batch_extended_account.model_stock_picking_batch +msgid "Batch Transfer" +msgstr "Agrupación de albaranes" + +#. module: stock_picking_batch_extended_account +#: model:ir.model,name:stock_picking_batch_extended_account.model_res_partner +msgid "Contact" +msgstr "Contacto" + +#. module: stock_picking_batch_extended_account +#: model:ir.model.fields.selection,name:stock_picking_batch_extended_account.selection__res_partner__batch_picking_auto_invoice__no +msgid "No" +msgstr "No" + +#. module: stock_picking_batch_extended_account +#: code:addons/stock_picking_batch_extended_account/models/stock_batch_picking.py:0 +#, python-format +msgid "Nothing to print." +msgstr "Nada para imprimir." + +#. module: stock_picking_batch_extended_account +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended_account.stock_batch_picking_form +msgid "Print Invoices" +msgstr "Imprimir facturas" + +#. module: stock_picking_batch_extended_account +#: model:ir.model,name:stock_picking_batch_extended_account.model_stock_picking +msgid "Transfer" +msgstr "Albarán" + +#. module: stock_picking_batch_extended_account +#: model:ir.model.fields.selection,name:stock_picking_batch_extended_account.selection__res_partner__batch_picking_auto_invoice__yes +msgid "Yes" +msgstr "Si" diff --git a/stock_picking_batch_extended_account/i18n/stock_picking_batch_extended_account.pot b/stock_picking_batch_extended_account/i18n/stock_picking_batch_extended_account.pot new file mode 100644 index 000000000000..68212dcb877d --- /dev/null +++ b/stock_picking_batch_extended_account/i18n/stock_picking_batch_extended_account.pot @@ -0,0 +1,56 @@ +# 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" +"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 +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account.field_res_partner__batch_picking_auto_invoice +#: model:ir.model.fields,field_description:stock_picking_batch_extended_account.field_res_users__batch_picking_auto_invoice +msgid "Batch Picking Auto Invoice" +msgstr "" + +#. module: stock_picking_batch_extended_account +#: model:ir.model,name:stock_picking_batch_extended_account.model_stock_picking_batch +msgid "Batch Transfer" +msgstr "" + +#. module: stock_picking_batch_extended_account +#: model:ir.model,name:stock_picking_batch_extended_account.model_res_partner +msgid "Contact" +msgstr "" + +#. module: stock_picking_batch_extended_account +#: model:ir.model.fields.selection,name:stock_picking_batch_extended_account.selection__res_partner__batch_picking_auto_invoice__no +msgid "No" +msgstr "" + +#. module: stock_picking_batch_extended_account +#: code:addons/stock_picking_batch_extended_account/models/stock_batch_picking.py:0 +#, python-format +msgid "Nothing to print." +msgstr "" + +#. module: stock_picking_batch_extended_account +#: model_terms:ir.ui.view,arch_db:stock_picking_batch_extended_account.stock_batch_picking_form +msgid "Print Invoices" +msgstr "" + +#. module: stock_picking_batch_extended_account +#: model:ir.model,name:stock_picking_batch_extended_account.model_stock_picking +msgid "Transfer" +msgstr "" + +#. module: stock_picking_batch_extended_account +#: model:ir.model.fields.selection,name:stock_picking_batch_extended_account.selection__res_partner__batch_picking_auto_invoice__yes +msgid "Yes" +msgstr "" diff --git a/stock_picking_batch_extended_account/models/__init__.py b/stock_picking_batch_extended_account/models/__init__.py new file mode 100644 index 000000000000..f96ee6e9d120 --- /dev/null +++ b/stock_picking_batch_extended_account/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 stock_batch_picking +from . import stock_picking diff --git a/stock_picking_batch_extended_account/models/res_partner.py b/stock_picking_batch_extended_account/models/res_partner.py new file mode 100644 index 000000000000..d40590bfb604 --- /dev/null +++ b/stock_picking_batch_extended_account/models/res_partner.py @@ -0,0 +1,17 @@ +# Copyright 2020 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + batch_picking_auto_invoice = fields.Selection( + [("yes", "Yes"), ("no", "No")], default="no", company_dependent=True + ) + + @api.model + def _commercial_fields(self): + res = super()._commercial_fields() + return res + ["batch_picking_auto_invoice"] diff --git a/stock_picking_batch_extended_account/models/stock_batch_picking.py b/stock_picking_batch_extended_account/models/stock_batch_picking.py new file mode 100644 index 000000000000..fa7a013a1a8a --- /dev/null +++ b/stock_picking_batch_extended_account/models/stock_batch_picking.py @@ -0,0 +1,28 @@ +# Copyright 2020 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import _, models +from odoo.exceptions import UserError + + +class StockBatchPicking(models.Model): + _inherit = "stock.picking.batch" + + def action_print_invoices(self): + invoices = self.mapped("picking_ids.sale_id.invoice_ids") + if not invoices: + raise UserError(_("Nothing to print.")) + report = self.env.ref("account.account_invoices_without_payment") + return report.report_action(invoices) + + def _get_domain_picking_to_invoice(self): + return [("partner_id.batch_picking_auto_invoice", "=", "yes")] + + def _get_self_with_context_to_invoice(self): + to_invoice = self.mapped("picking_ids").filtered_domain( + self._get_domain_picking_to_invoice() + ) + return self.with_context(picking_to_invoice_in_batch=to_invoice.ids) + + def action_done(self): + self_with_ctx = self._get_self_with_context_to_invoice() + return super(StockBatchPicking, self_with_ctx).action_done() diff --git a/stock_picking_batch_extended_account/models/stock_picking.py b/stock_picking_batch_extended_account/models/stock_picking.py new file mode 100644 index 000000000000..f11faa606e7e --- /dev/null +++ b/stock_picking_batch_extended_account/models/stock_picking.py @@ -0,0 +1,29 @@ +# Copyright 2020 Tecnativa - Ernesto Tejeda +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + def _action_done(self): + result = super()._action_done() + picking_to_invoice_ids = self.env.context.get( + "picking_to_invoice_in_batch", + ) + if not picking_to_invoice_ids: + return result + sales = self.filtered(lambda r: r.id in picking_to_invoice_ids).mapped( + "sale_id" + ) + sales_to_invoice = sales.filtered(lambda so: so.invoice_status == "to invoice") + if not sales_to_invoice: + return result + self.env["sale.advance.payment.inv"].create({}).with_context( + active_model="sale.order", active_ids=sales_to_invoice.ids + ).create_invoices() + sales_to_invoice.mapped("invoice_ids").filtered( + lambda r: r.state == "draft", + ).action_post() + return result diff --git a/stock_picking_batch_extended_account/readme/CONFIGURE.rst b/stock_picking_batch_extended_account/readme/CONFIGURE.rst new file mode 100644 index 000000000000..9ac0a654fb3a --- /dev/null +++ b/stock_picking_batch_extended_account/readme/CONFIGURE.rst @@ -0,0 +1,7 @@ +To configure this module, you need to check 'Batch picking auto invoice' +field of the partners for whom you want the invoice to be automatically +generated when any batch that has a 'Picking' to which they belong is +set to 'done' state. + +#. Go to each of thoes partner, edit them, find 'Batch picking auto invoice' + field under 'Sales & Purchase' tab and check it. diff --git a/stock_picking_batch_extended_account/readme/CONTRIBUTORS.rst b/stock_picking_batch_extended_account/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..7dc0205950ad --- /dev/null +++ b/stock_picking_batch_extended_account/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* `Tecnativa `_: + + * Ernesto Tejeda + * Pedro M. Baeza + * Carlos Dauden + * Sergio Teruel diff --git a/stock_picking_batch_extended_account/readme/DESCRIPTION.rst b/stock_picking_batch_extended_account/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..9446bbd396ff --- /dev/null +++ b/stock_picking_batch_extended_account/readme/DESCRIPTION.rst @@ -0,0 +1,4 @@ +This module extends the functionality of stock_picking_batch_extended +to support the creation of invoices automatically when a batch is set +to 'Done' state and to allow you to print the invoices of the +sales orders linked to the pickings of the batch. diff --git a/stock_picking_batch_extended_account/readme/USAGE.rst b/stock_picking_batch_extended_account/readme/USAGE.rst new file mode 100644 index 000000000000..ca0ee2da84da --- /dev/null +++ b/stock_picking_batch_extended_account/readme/USAGE.rst @@ -0,0 +1,12 @@ +To use this module, you need to: + +#. Go to *Inventory > Batch Picking*. +#. Create a new batch and add some pickings such that their partners + have the option 'Batch picking auto invoice' checked + (See configuration section). Make sure the selected pickings are + linked to a sales order. +#. Confirm the batch. +#. Set the batch to 'done' state. After that, invoices will be generated + for all sales orders linked to the pickings of the batch. +#. Click on 'Print Invoices' button in the status bar and you will see a PDF + report for all the generated invoices. diff --git a/stock_picking_batch_extended_account/static/description/icon.png b/stock_picking_batch_extended_account/static/description/icon.png new file mode 100644 index 000000000000..3a0328b516c4 Binary files /dev/null and b/stock_picking_batch_extended_account/static/description/icon.png differ diff --git a/stock_picking_batch_extended_account/static/description/index.html b/stock_picking_batch_extended_account/static/description/index.html new file mode 100644 index 000000000000..56c1b58b2901 --- /dev/null +++ b/stock_picking_batch_extended_account/static/description/index.html @@ -0,0 +1,459 @@ + + + + + + +Stock batch picking account + + + +
+

Stock batch picking account

+ + +

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

+

This module extends the functionality of stock_picking_batch_extended +to support the creation of invoices automatically when a batch is set +to ‘Done’ state and to allow you to print the invoices of the +sales orders linked to the pickings of the batch.

+

Table of contents

+ +
+

Configuration

+

To configure this module, you need to check ‘Batch picking auto invoice’ +field of the partners for whom you want the invoice to be automatically +generated when any batch that has a ‘Picking’ to which they belong is +set to ‘done’ state.

+
    +
  1. Go to each of thoes partner, edit them, find ‘Batch picking auto invoice’ +field under ‘Sales & Purchase’ tab and check it.
  2. +
+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Inventory > Batch Picking.
  2. +
  3. Create a new batch and add some pickings such that their partners +have the option ‘Batch picking auto invoice’ checked +(See configuration section). Make sure the selected pickings are +linked to a sales order.
  4. +
  5. Confirm the batch.
  6. +
  7. Set the batch to ‘done’ state. After that, invoices will be generated +for all sales orders linked to the pickings of the batch.
  8. +
  9. Click on ‘Print Invoices’ button in the status bar and you will see a PDF +report for all the generated invoices.
  10. +
+
+
+

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:
      +
    • Ernesto Tejeda
    • +
    • Pedro M. Baeza
    • +
    • 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/tests/__init__.py b/stock_picking_batch_extended_account/tests/__init__.py new file mode 100644 index 000000000000..c675dc51a7ff --- /dev/null +++ b/stock_picking_batch_extended_account/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 diff --git a/stock_picking_batch_extended_account/tests/test_stock_picking_batch_extended_account.py b/stock_picking_batch_extended_account/tests/test_stock_picking_batch_extended_account.py new file mode 100644 index 000000000000..c38122ec3874 --- /dev/null +++ b/stock_picking_batch_extended_account/tests/test_stock_picking_batch_extended_account.py @@ -0,0 +1,105 @@ +# Copyright 2022 Tecnativa - Sergio Teruel +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). +from odoo.tests import Form, TransactionCase + + +class TestStockPickingBatchExtendedAccount(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.SaleOrder = cls.env["sale.order"] + cls.product_uom_id = cls.env.ref("uom.product_uom_unit") + cls.stock_loc = cls.browse_ref(cls, "stock.stock_location_stock") + cls.product = cls.env["product.product"].create( + { + "name": "test", + "type": "product", + "list_price": 20.00, + "invoice_policy": "delivery", + } + ) + cls.env["stock.quant"].create( + { + "product_id": cls.product.id, + "product_uom_id": cls.product.uom_id.id, + "location_id": cls.stock_loc.id, + "quantity": 100.0, + } + ) + cls.partner = cls.env["res.partner"].create( + {"name": "partner test 1", "batch_picking_auto_invoice": "no"} + ) + cls.partner2 = cls.env["res.partner"].create( + {"name": "partner test 2", "batch_picking_auto_invoice": "no"} + ) + # Use OCA batch picking extended + cls.env.company.use_oca_batch_validation = True + + def _create_sale_order(self, partner): + with Form(self.env["sale.order"]) as so_form: + so_form.partner_id = partner + with so_form.order_line.new() as line_form: + line_form.product_id = self.product + line_form.product_uom_qty = 1.0 + return so_form.save() + + def _create_batch_picking(self, pickings): + # Create the BP + with Form( + self.env["stock.picking.to.batch"].with_context( + active_ids=pickings.ids, active_model="sotck.picking" + ) + ) as wiz_form: + wiz_form.name = "BP for test" + wiz_form.mode = "new" + wiz = wiz_form.save() + action = wiz.action_create_batch() + return self.env["stock.picking.batch"].browse(action["res_id"]) + + def _test_create_invoice_from_bp_no_invoices(self): + self.partner.batch_picking_auto_invoice = "no" + self.partner2.batch_picking_auto_invoice = "no" + 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.assertFalse(self.order2.invoice_ids) + + def test_create_invoice_from_bp_all_invoices(self): + self.partner.batch_picking_auto_invoice = "yes" + self.partner2.batch_picking_auto_invoice = "yes" + 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.assertTrue(self.order1.invoice_ids) + self.assertTrue(self.order2.invoice_ids) + + def test_create_invoice_from_bp_mixin(self): + self.partner.batch_picking_auto_invoice = "yes" + self.partner2.batch_picking_auto_invoice = "no" + 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.assertTrue(self.order1.invoice_ids) + self.assertFalse(self.order2.invoice_ids) diff --git a/stock_picking_batch_extended_account/views/res_partner_views.xml b/stock_picking_batch_extended_account/views/res_partner_views.xml new file mode 100644 index 000000000000..0fb98fe50a7b --- /dev/null +++ b/stock_picking_batch_extended_account/views/res_partner_views.xml @@ -0,0 +1,21 @@ + + + + res.partner.form + res.partner + + + + + + + + + + + + + diff --git a/stock_picking_batch_extended_account/views/stock_batch_picking.xml b/stock_picking_batch_extended_account/views/stock_batch_picking.xml new file mode 100644 index 000000000000..3b959093d20c --- /dev/null +++ b/stock_picking_batch_extended_account/views/stock_batch_picking.xml @@ -0,0 +1,23 @@ + + + + stock.picking.batch + + + +