Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] partner_invoicing_mode_at_shipping: Migration to 18.0 #1835

Open
wants to merge 31 commits into
base: 18.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
287d418
[MIG] rename account_invoice_mode_at_shipping
TDu Sep 27, 2022
efc9bc8
[MIG] partner_invoicing_mode_at_shipping: Migration to 16.0
StefanRijnhart Nov 30, 2022
2bf79c9
[UPD] Update partner_invoicing_mode_at_shipping.pot
Apr 21, 2023
66b5c77
[UPD] README.rst
OCA-git-bot Apr 21, 2023
7a5a41c
partner_invoicing_mode_at_shipping 16.0.1.0.1
OCA-git-bot Apr 21, 2023
6eb6ac1
Added translation using Weblate (Spanish)
Ivorra78 Jul 29, 2023
83d32d2
Translated using Weblate (Spanish)
Ivorra78 Jul 29, 2023
14d4a9b
[UPD] README.rst
OCA-git-bot Sep 3, 2023
a3999fc
[IMP] partner_invoicing_mode_at_shipping: Add grouping option per pic…
rousseldenis Dec 18, 2023
a826970
Added translation using Weblate (Italian)
mymage Feb 26, 2024
5ee9f88
Translated using Weblate (Italian)
mymage Feb 27, 2024
af7851c
[IMP] partner_invoicing_mode_at_shipping: Compute 'one_invoice_per_pi…
rousseldenis Dec 18, 2023
3b0f6a1
[IMP] partner_invoicing_mode_at_shipping: Refactor tests and change t…
rousseldenis Dec 18, 2023
f0fcd7c
[IMP] partner_invoicing_mode_at_shipping: Add migration script for 'o…
rousseldenis Dec 20, 2023
9cbe4a2
[IMP] partner_invoicing_mode_at_shipping: Add 'one_invoice_per_shippi…
rousseldenis Dec 20, 2023
76bc877
[IMP] partner_invoicing_mode_at_shipping: Remove unused function
rousseldenis Dec 22, 2023
bc5633a
[FIX] partner_invoicing_mode_at_shipping: Add one_invoice_per_shippin…
rousseldenis Feb 8, 2024
6b467f0
[IMP] partner_invoicing_mode_at_shipping: Extract _invoicing_at_shipp…
tuantrantg Mar 28, 2024
bec4897
[UPD] Update partner_invoicing_mode_at_shipping.pot
Jun 27, 2024
ea177c1
[BOT] post-merge updates
OCA-git-bot Jun 27, 2024
f9d307a
Update translation files
weblate Jun 27, 2024
411384f
Translated using Weblate (Spanish)
anmarmo1 Jun 29, 2024
f40a038
Translated using Weblate (Italian)
mymage Jul 15, 2024
3c8af32
Added translation using Weblate (French)
samibc2c Nov 6, 2024
f4c0ef1
Translated using Weblate (French)
samibc2c Nov 6, 2024
d7634a2
[IMP] partner_invoicing_mode_at_shipping: pre-commit auto fixes
chaule97 Dec 31, 2024
584e09a
[MIG] partner_invoicing_mode_at_shipping: Migration to 17.0
NICO-SOLUTIONS Apr 8, 2024
06e39a7
[IMP] partner_invoicing_mode_at_shipping: pre-commit auto fixes
chaule97 Nov 7, 2024
fe0c6bc
[MIG] partner_invoicing_mode_at_shipping: Migration to 18.0
chaule97 Nov 7, 2024
4974b72
[UPD] partner_invoicing_mode_at_shipping: Update testcase
chaule97 Nov 7, 2024
da17712
[DON'T MERGE] Add test-requirements.txt
chaule97 Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[MIG] partner_invoicing_mode_at_shipping: Migration to 17.0
  • Loading branch information
NICO-SOLUTIONS authored and chaule97 committed Jan 3, 2025
commit 584e09a13d0f99dd8d1020cd53f99e207dfd070b
7 changes: 6 additions & 1 deletion partner_invoicing_mode_at_shipping/README.rst
Original file line number Diff line number Diff line change
@@ -69,10 +69,15 @@ Contributors

- Phuc (Tran Thanh) <phuc@trobz.com>

- Nils Coenen <nils.coenen@nico-solutions.de>

- Chau Le <chaulb@trobz.com>

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

5 changes: 4 additions & 1 deletion partner_invoicing_mode_at_shipping/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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",
@@ -13,5 +13,8 @@
"views/res_partner.xml",
],
"depends": ["account", "partner_invoicing_mode", "queue_job", "stock"],
"external_dependencies": {
"python": ["openupgradelib"],
},
"pre_init_hook": "pre_init_hook",
}
5 changes: 1 addition & 4 deletions partner_invoicing_mode_at_shipping/hooks.py
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade

from odoo import SUPERUSER_ID, api


def _add_one_invoice_per_shipping(env):
if not openupgrade.column_exists(env.cr, "sale_order", "one_invoice_per_shipping"):
@@ -21,6 +19,5 @@ def _add_one_invoice_per_shipping(env):
openupgrade.add_fields(env, field_spec)


def pre_init_hook(cr):
env = api.Environment(cr, SUPERUSER_ID, {})
def pre_init_hook(env):
_add_one_invoice_per_shipping(env)

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):
@@ -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()
2 changes: 2 additions & 0 deletions partner_invoicing_mode_at_shipping/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -3,3 +3,5 @@
> - Thierry Ducrest \<<thierry.ducrest@camptocamp.com>\>

- Phuc (Tran Thanh) \<<phuc@trobz.com>\>
- Nils Coenen \<<nils.coenen@nico-solutions.de>\>
- Chau Le \<<chaulb@trobz.com>\>
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
@@ -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>
2 changes: 0 additions & 2 deletions partner_invoicing_mode_at_shipping/tests/common.py
Original file line number Diff line number Diff line change
@@ -27,7 +27,6 @@ def setUpClass(cls):
},
)
],
"pricelist_id": cls.env.ref("product.list0").id,
}
)

@@ -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
@@ -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")

@@ -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):
@@ -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)
@@ -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)
@@ -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
Original file line number Diff line number Diff line change
@@ -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(
@@ -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(