Skip to content

Commit

Permalink
[MIG] stock_picking_batch_extended_account: Migration to v15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sergio-teruel committed Dec 14, 2022
1 parent b898b8f commit 083d553
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 48 deletions.
6 changes: 6 additions & 0 deletions setup/stock_picking_batch_extended_account/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
10 changes: 5 additions & 5 deletions stock_picking_batch_extended_account/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -68,7 +68,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/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 <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_batch_extended_account%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_batch_extended_account%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Expand Down Expand Up @@ -111,6 +111,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ernestotejeda|

This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/13.0/stock_picking_batch_extended_account>`_ project on GitHub.
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/15.0/stock_picking_batch_extended_account>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion stock_picking_batch_extended_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 2 additions & 2 deletions stock_picking_batch_extended_account/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Stock batch picking account</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/13.0/stock_picking_batch_extended_account"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-13-0/stock-logistics-workflow-13-0-stock_picking_batch_extended_account"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/154/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/15.0/stock_picking_batch_extended_account"><img alt="OCA/stock-logistics-workflow" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/stock-logistics-workflow-15-0/stock-logistics-workflow-15-0-stock_picking_batch_extended_account"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/154/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>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
Expand Down Expand Up @@ -418,7 +418,7 @@ <h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_batch_extended_account%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_batch_extended_account%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -450,7 +450,7 @@ <h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/ernestotejeda"><img alt="ernestotejeda" src="https://github.com/ernestotejeda.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/13.0/stock_picking_batch_extended_account">OCA/stock-logistics-workflow</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/stock-logistics-workflow/tree/15.0/stock_picking_batch_extended_account">OCA/stock-logistics-workflow</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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)
Expand All @@ -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)

Expand All @@ -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)

Expand All @@ -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)
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="stock_batch_picking_form" model="ir.ui.view">
<field name="name">stock.picking.batch.form</field>
<record id="stock_picking_batch_form" model="ir.ui.view">
<field name="model">stock.picking.batch</field>
<field
name="inherit_id"
ref="stock_picking_batch_extended.stock_batch_picking_form"
ref="stock_picking_batch_extended.stock_picking_batch_form"
/>
<field name="arch" type="xml">
<xpath
Expand Down

0 comments on commit 083d553

Please sign in to comment.