-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] stock_picking_usability: Show always stock move line shortcut, …
…and new shortcut to lots.
- Loading branch information
1 parent
4e0d493
commit 7c0bd96
Showing
6 changed files
with
61 additions
and
5 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
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,16 +1,36 @@ | ||
# Copyright 2023 Oihane Crucelaegui - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models | ||
from odoo import fields, models | ||
|
||
|
||
class StockPicking(models.Model): | ||
_inherit = "stock.picking" | ||
|
||
count_lots = fields.Integer( | ||
string="Lots", | ||
compute="_compute_count_lots", | ||
) | ||
|
||
def _compute_count_lots(self): | ||
for picking in self: | ||
lines = picking.move_line_ids.filtered(lambda x: x.lot_id) | ||
picking.count_lots = 0 if not lines else len(lines.mapped("lot_id")) | ||
|
||
def action_picking_move_line_tree(self): | ||
action = self.env["ir.actions.actions"]._for_xml_id( | ||
"stock.stock_move_line_action" | ||
) | ||
action["context"] = self.env.context | ||
action["domain"] = [("picking_id", "in", self.ids)] | ||
return action | ||
|
||
def action_picking_stock_production_lot_tree(self): | ||
lines = self.move_line_ids.filtered(lambda x: x.lot_id) | ||
lots = lines.mapped("lot_id") | ||
action = self.env["ir.actions.actions"]._for_xml_id( | ||
"stock.action_production_lot_form" | ||
) | ||
action["context"] = self.env.context | ||
action["domain"] = [("id", "in", lots.ids)] | ||
return action |
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