-
-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] l10n_it_delivery_note: link carrier with delivery method
- Loading branch information
Showing
12 changed files
with
51 additions
and
13 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
11 changes: 11 additions & 0 deletions
11
l10n_it_delivery_note/migrations/14.0.2.6.0/post-migrate.py
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,11 @@ | ||
from openupgradelib import openupgrade | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
note_ids = env["stock.delivery.note"].search( | ||
[("carrier_id", "!=", False), ("delivery_method_id", "!=", False)] | ||
) | ||
|
||
for note_id in note_ids: | ||
note_id.carrier_id.write({"carrier_ids": [(4, note_id.delivery_method_id.id)]}) |
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
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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Copyright (c) 2019, Link IT Europe Srl | ||
# @author: Matteo Bilotta <[email protected]> | ||
|
||
from odoo import api, fields, models | ||
from odoo import _, api, fields, models | ||
|
||
|
||
class StockDeliveryNoteSelectWizard(models.TransientModel): | ||
|
@@ -37,6 +37,17 @@ def _compute_fields(self): | |
self.picking_ids += self.selected_picking_ids | ||
else: | ||
self.picking_ids = self.picking_ids | ||
self.warning_message = self._get_warning_message() | ||
|
||
def _get_warning_message(self): | ||
res = super()._get_warning_message() | ||
carrier_ids = self.picking_ids.mapped("carrier_id.partner_id") | ||
if len(carrier_ids) > 1: | ||
res = _( | ||
"The selected pickings have different delivery methods: %(carriers)s", | ||
carriers=", ".join(carrier_ids.mapped("name")), | ||
) | ||
return res | ||
|
||
def check_compliance(self, pickings): | ||
super().check_compliance(pickings) | ||
|
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