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 index f27b890261d7..e36688c41f12 100644 --- a/stock_picking_batch_extended_account/README.rst +++ b/stock_picking_batch_extended_account/README.rst @@ -14,13 +14,13 @@ Stock batch picking account :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/13.0/stock_picking_batch_extended_account + :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-13-0/stock-logistics-workflow-13-0-stock_picking_batch_extended_account + :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/13.0 + :target: https://runbot.odoo-community.org/runbot/154/15.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -68,7 +68,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -111,6 +111,6 @@ Current `maintainer `__: |maintainer-ernestotejeda| -This module is part of the `OCA/stock-logistics-workflow `_ project on GitHub. +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/__manifest__.py b/stock_picking_batch_extended_account/__manifest__.py index bec974dc960d..02f6a5370969 100644 --- a/stock_picking_batch_extended_account/__manifest__.py +++ b/stock_picking_batch_extended_account/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Stock batch picking account", "summary": "Generates invoices when batch is set to Done state", - "version": "13.0.1.1.1", + "version": "15.0.1.0.0", "author": "Tecnativa, Odoo Community Association (OCA)", "maintainers": ["ernestotejeda"], "development_status": "Beta", diff --git a/stock_picking_batch_extended_account/migrations/13.0.1.1.0/post-migration.py b/stock_picking_batch_extended_account/migrations/13.0.1.1.0/post-migration.py deleted file mode 100644 index c9c8ba9dfb48..000000000000 --- a/stock_picking_batch_extended_account/migrations/13.0.1.1.0/post-migration.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2022 Tecnativa - Sergio Teruel -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). - -from openupgradelib import openupgrade # pylint: disable=W7936 - - -@openupgrade.migrate() -def migrate(env, version): - batch_picking_auto_invoice_field = env.ref( - "stock_picking_batch_extended_account.field_res_partner__batch_picking_auto_invoice" - ) - openupgrade.logged_query( - env.cr, - """ - UPDATE ir_property - SET value_text = CASE WHEN value_integer = 1 THEN 'yes' ELSE 'no' END, - type='char', value_integer=NULL - WHERE name='batch_picking_auto_invoice' AND fields_id = %s - """ - % (batch_picking_auto_invoice_field.id,), - ) diff --git a/stock_picking_batch_extended_account/models/stock_batch_picking.py b/stock_picking_batch_extended_account/models/stock_batch_picking.py index dee939ecccab..fa7a013a1a8a 100644 --- a/stock_picking_batch_extended_account/models/stock_batch_picking.py +++ b/stock_picking_batch_extended_account/models/stock_batch_picking.py @@ -23,10 +23,6 @@ def _get_self_with_context_to_invoice(self): ) return self.with_context(picking_to_invoice_in_batch=to_invoice.ids) - def done(self): + def action_done(self): self_with_ctx = self._get_self_with_context_to_invoice() - return super(StockBatchPicking, self_with_ctx).done() - - def action_transfer(self): - self_with_ctx = self._get_self_with_context_to_invoice() - return super(StockBatchPicking, self_with_ctx).action_transfer() + 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 index 058025243a37..f11faa606e7e 100644 --- a/stock_picking_batch_extended_account/models/stock_picking.py +++ b/stock_picking_batch_extended_account/models/stock_picking.py @@ -7,8 +7,8 @@ class StockPicking(models.Model): _inherit = "stock.picking" - def action_done(self): - result = super().action_done() + def _action_done(self): + result = super()._action_done() picking_to_invoice_ids = self.env.context.get( "picking_to_invoice_in_batch", ) diff --git a/stock_picking_batch_extended_account/static/description/index.html b/stock_picking_batch_extended_account/static/description/index.html index 8be22af77fbb..56c1b58b2901 100644 --- a/stock_picking_batch_extended_account/static/description/index.html +++ b/stock_picking_batch_extended_account/static/description/index.html @@ -367,7 +367,7 @@

Stock batch picking account

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

+

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 @@ -418,7 +418,7 @@

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.

+feedback.

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

@@ -450,7 +450,7 @@

Maintainers

promote its widespread use.

Current maintainer:

ernestotejeda

-

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

+

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/test_stock_picking_batch_extended_account.py b/stock_picking_batch_extended_account/tests/test_stock_picking_batch_extended_account.py index 342ea1799c9b..7afbf433b3b3 100644 --- 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 @@ -1,9 +1,9 @@ # Copyright 2022 Tecnativa - Sergio Teruel # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo.tests import Form, SavepointCase +from odoo.tests import Form, TransactionCase -class TestStockPickingBatchExtendedAccount(SavepointCase): +class TestStockPickingBatchExtendedAccount(TransactionCase): @classmethod def setUpClass(cls): super().setUpClass() @@ -45,16 +45,17 @@ def _create_sale_order(self, partner): def _create_batch_picking(self, pickings): # Create the BP with Form( - self.env["stock.picking.batch.creator"].with_context( + 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): + 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) @@ -66,7 +67,7 @@ def test_create_invoice_from_bp_no_invoices(self): move_lines.qty_done = 1.0 bp = self._create_batch_picking(pickings) bp.action_assign() - bp.action_transfer() + bp.action_done() self.assertFalse(self.order1.invoice_ids) self.assertFalse(self.order2.invoice_ids) @@ -82,7 +83,7 @@ def test_create_invoice_from_bp_all_invoices(self): move_lines.qty_done = 1.0 bp = self._create_batch_picking(pickings) bp.action_assign() - bp.action_transfer() + bp.action_done() self.assertTrue(self.order1.invoice_ids) self.assertTrue(self.order2.invoice_ids) @@ -98,6 +99,6 @@ def test_create_invoice_from_bp_mixin(self): move_lines.qty_done = 1.0 bp = self._create_batch_picking(pickings) bp.action_assign() - bp.action_transfer() + bp.action_done() self.assertTrue(self.order1.invoice_ids) self.assertFalse(self.order2.invoice_ids) diff --git a/stock_picking_batch_extended_account/views/stock_batch_picking.xml b/stock_picking_batch_extended_account/views/stock_batch_picking.xml index 9bddadf2caa0..3b959093d20c 100644 --- a/stock_picking_batch_extended_account/views/stock_batch_picking.xml +++ b/stock_picking_batch_extended_account/views/stock_batch_picking.xml @@ -1,11 +1,10 @@ - - stock.picking.batch.form + stock.picking.batch