forked from OCA/l10n-italy
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] l10n_it_delivery_note: allow validation of backorders
This fixes the following issue: Steps to reproduce: * create a SO with two lines and confirm it * delivery partially only one of the two lines * validate the backorder Current behavior: The backorder is not validated as stock_delivery_note_line_move_uniq constraint is raised Expected behavior: The backorder is validated
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
* Letizia Freda <[email protected]> | ||
* Andrea Piovesana <[email protected]> | ||
* Giovanni Serra <[email protected]> | ||
* Alex Comba <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import delivery_note_common | ||
from . import test_stock_delivery_note_invoicing | ||
from . import test_stock_delivery_note |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright 2021 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from .delivery_note_common import StockDeliveryNoteCommon | ||
|
||
|
||
class StockDeliveryNote(StockDeliveryNoteCommon): | ||
|
||
# ⇒ "Ordine singolo: consegna parziale" | ||
def test_partial_delivering_single_so(self): | ||
# | ||
# SO ┐ ┌ DdT | ||
# ├ Picking ┘ | ||
# │ | ||
# └ Picking ┐ | ||
# └ DdT | ||
# | ||
|
||
# remove use_advanced_delivery_notes group in order to automatically | ||
# create delivery note when picking is validated | ||
use_adv_notes_group_id = self.env.ref( | ||
"l10n_it_delivery_note.use_advanced_delivery_notes").id | ||
self.env.user.write({'groups_id': [(3, use_adv_notes_group_id)]}) | ||
|
||
StockPicking = self.env["stock.picking"] | ||
StockBackorderConfirmationWizard = self.env['stock.backorder.confirmation'] | ||
sales_order = self.create_sales_order( | ||
[ | ||
self.large_desk_line, # 1 | ||
self.desk_combination_line, # 1 | ||
], | ||
) | ||
self.assertEqual(len(sales_order.order_line), 2) | ||
sales_order.action_confirm() | ||
self.assertEqual(len(sales_order.picking_ids), 1) | ||
picking = sales_order.picking_ids | ||
self.assertEqual(len(picking.move_lines), 2) | ||
|
||
# deliver only the first product | ||
picking.move_lines[0].quantity_done = 1 | ||
|
||
backorder_wiz_id = picking.button_validate()['res_id'] | ||
backorder_wiz = StockBackorderConfirmationWizard.browse(backorder_wiz_id) | ||
backorder_wiz.process() | ||
self.assertTrue(picking.delivery_note_id) | ||
picking_backorder = StockPicking.search([("backorder_id", "=", picking.id)]) | ||
self.assertEqual(len(picking_backorder.move_lines), 1) | ||
picking_backorder.move_lines[0].quantity_done = 1 | ||
picking_backorder.button_validate() | ||
self.assertTrue(picking_backorder.delivery_note_id) |