Skip to content

Commit

Permalink
[MIG] partner_invoicing_mode_at_shipping: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NICO-SOLUTIONS authored and chaule97 committed Jan 3, 2025
1 parent 8ab7c11 commit de3c6c9
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 55 deletions.
7 changes: 6 additions & 1 deletion partner_invoicing_mode_at_shipping/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,15 @@ Contributors

- Phuc (Tran Thanh) <[email protected]>

- Nils Coenen <[email protected]>

- Chau Le <[email protected]>

Other credits
-------------

The development of this module has been financially supported by:
The development and migration of this module has been financially
supported by:

- Camptocamp

Expand Down
6 changes: 4 additions & 2 deletions partner_invoicing_mode_at_shipping/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Partner Invoicing Mode At Shipping",
"version": "16.0.1.2.0",
"version": "17.0.1.0.0",
"summary": "Create invoices automatically when goods are shipped.",
"author": "Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
Expand All @@ -13,5 +13,7 @@
"views/res_partner.xml",
],
"depends": ["account", "partner_invoicing_mode", "queue_job", "stock"],
"pre_init_hook": "pre_init_hook",
"external_dependencies": {
"python": ["openupgradelib"],
},
}

This file was deleted.

1 change: 0 additions & 1 deletion partner_invoicing_mode_at_shipping/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from . import res_partner
from . import stock_move
from . import stock_picking
from . import sale_order
19 changes: 0 additions & 19 deletions partner_invoicing_mode_at_shipping/models/stock_move.py

This file was deleted.

3 changes: 2 additions & 1 deletion partner_invoicing_mode_at_shipping/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2020 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)

from odoo import _, models
from odoo import _, api, models


class StockPicking(models.Model):
Expand All @@ -27,6 +27,7 @@ def _invoicing_at_shipping_validation(self, invoices):
lambda invoice: invoice.partner_id.invoicing_mode == "at_shipping"
)

@api.model
def _invoicing_at_shipping(self):
self.ensure_one()
sales = self._get_sales_order_to_invoice()
Expand Down
2 changes: 2 additions & 0 deletions partner_invoicing_mode_at_shipping/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
> - Thierry Ducrest \<<[email protected]>\>
- Phuc (Tran Thanh) \<<[email protected]>\>
- Nils Coenen \<<[email protected]>\>
- Chau Le \<<[email protected]>\>
2 changes: 1 addition & 1 deletion partner_invoicing_mode_at_shipping/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
The development of this module has been financially supported by:
The development and migration of this module has been financially supported by:

- Camptocamp
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,16 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
</li>
<li><p class="first">Phuc (Tran Thanh) &lt;<a class="reference external" href="mailto:phuc&#64;trobz.com">phuc&#64;trobz.com</a>&gt;</p>
</li>
<li><p class="first">Nils Coenen &lt;<a class="reference external" href="mailto:nils.coenen&#64;nico-solutions.de">nils.coenen&#64;nico-solutions.de</a>&gt;</p>
</li>
<li><p class="first">Chau Le &lt;<a class="reference external" href="mailto:chaulb&#64;trobz.com">chaulb&#64;trobz.com</a>&gt;</p>
</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
<p>The development of this module has been financially supported by:</p>
<p>The development and migration of this module has been financially
supported by:</p>
<ul class="simple">
<li>Camptocamp</li>
</ul>
Expand Down
2 changes: 0 additions & 2 deletions partner_invoicing_mode_at_shipping/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def setUpClass(cls):
},
)
],
"pricelist_id": cls.env.ref("product.list0").id,
}
)

Expand All @@ -51,6 +50,5 @@ def _create_order(cls):
},
)
],
"pricelist_id": cls.env.ref("product.list0").id,
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def test_invoice_created_at_shipping(self):
self.so1.action_confirm()
for picking in self.so1.picking_ids:
for move in picking.move_ids:
move.quantity_done = move.product_uom_qty
move.quantity = move.product_uom_qty
picking.action_assign()
with mute_logger("odoo.addons.queue_job.delay"):
picking.with_context(test_queue_job_no_delay=True).button_validate()
picking.with_context(queue_job__no_delay=True).button_validate()
self.assertEqual(len(self.so1.invoice_ids), 1)
self.assertEqual(self.so1.invoice_ids.state, "posted")

Expand All @@ -32,10 +32,10 @@ def test_invoice_not_created_at_shipping(self):
self.so1.action_confirm()
for picking in self.so1.picking_ids:
for move in picking.move_ids:
move.quantity_done = move.product_uom_qty
move.quantity = move.product_uom_qty
picking.action_assign()
with mute_logger("odoo.addons.queue_job.delay"):
picking.with_context(test_queue_job_no_delay=True).button_validate()
picking.with_context(queue_job__no_delay=True).button_validate()
self.assertEqual(len(self.so1.invoice_ids), 0)

def test_picking_multi_order_single_invoice(self):
Expand All @@ -50,10 +50,10 @@ def test_picking_multi_order_single_invoice(self):
so2.picking_ids.move_ids.picking_id = picking
# Transfer the remaining picking with moves
for move in picking.move_ids:
move.quantity_done = move.product_uom_qty
move.quantity = move.product_uom_qty
picking.action_assign()
with mute_logger("odoo.addons.queue_job.delay"):
picking.with_context(test_queue_job_no_delay=True).button_validate()
picking.with_context(queue_job__no_delay=True).button_validate()
self.assertEqual(len(self.so1.invoice_ids), 1)
self.assertEqual(self.so1.invoice_ids.state, "posted")
self.assertEqual(self.so1.invoice_ids, so2.invoice_ids)
Expand All @@ -70,10 +70,10 @@ def test_picking_multi_order_multi_invoice(self):
so2.picking_ids.move_ids.picking_id = picking
# Transfer the remaining picking with moves
for move in picking.move_ids:
move.quantity_done = move.product_uom_qty
move.quantity = move.product_uom_qty
picking.action_assign()
with mute_logger("odoo.addons.queue_job.delay"):
picking.with_context(test_queue_job_no_delay=True).button_validate()
picking.with_context(queue_job__no_delay=True).button_validate()
self.assertEqual(len(self.so1.invoice_ids), 1)
self.assertEqual(self.so1.invoice_ids.state, "posted")
self.assertEqual(len(so2.invoice_ids), 1)
Expand All @@ -85,20 +85,20 @@ def test_picking_backorder(self):
self.partner.invoicing_mode = "at_shipping"
self.so1.action_confirm()
picking = self.so1.picking_ids
picking.move_ids.quantity_done = 2
picking.move_ids.quantity = 2
picking.action_assign()
with mute_logger("odoo.addons.queue_job.delay"):
picking.with_context(
skip_backorder=True, test_queue_job_no_delay=True
skip_backorder=True, queue_job__no_delay=True
).button_validate()
self.assertEqual(len(self.so1.invoice_ids), 1)
self.assertEqual(self.so1.invoice_ids.state, "posted")
# Now process the backorder
backorder = self.so1.picking_ids - picking
backorder.move_ids.quantity_done = 2
backorder.move_ids.quantity = 2
backorder.action_assign()
with mute_logger("odoo.addons.queue_job.delay"):
backorder.with_context(test_queue_job_no_delay=True).button_validate()
backorder.with_context(queue_job__no_delay=True).button_validate()
self.assertEqual(len(self.so1.invoice_ids), 2)
self.assertTrue(
all(invoice.state == "posted") for invoice in self.so1.invoice_ids
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_invoice_created_at_shipping_per_delivery(self):
picking = self.so1.picking_ids

# Deliver partially
picking.move_ids.quantity_done = 2.0
picking.move_ids.write({"quantity": 2.0, "picked": True})
with trap_jobs() as trap:
picking._action_done()
trap.assert_enqueued_job(
Expand All @@ -43,7 +43,7 @@ def test_invoice_created_at_shipping_per_delivery(self):
backorder = self.so1.picking_ids - picking
self.assertTrue(backorder)

backorder.move_ids.quantity_done = 2.0
backorder.move_ids.write({"quantity": 2.0, "picked": True})
with trap_jobs() as trap:
backorder._action_done()
trap.assert_enqueued_job(
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# generated from manifests external_dependencies
openupgradelib

0 comments on commit de3c6c9

Please sign in to comment.