Skip to content

Commit

Permalink
[IMP] stock_picking_usability: Show always stock move line shortcut, …
Browse files Browse the repository at this point in the history
…and new shortcut to lots.
  • Loading branch information
alfredoavanzosc authored and anajuaristi committed Dec 4, 2024
1 parent 4e0d493 commit 7c0bd96
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 5 deletions.
6 changes: 4 additions & 2 deletions stock_picking_usability/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
Stock Picking Usability
=======================

With this module, pickings usability is improved, by adding adding a button to access
to the detailed operations. Also it makes always visible the detailed operations page.
* With this module, pickings usability is improved, by adding adding a button
to access to the detailed operations. Also it makes always visible the
detailed operations page.
* In stock picking form new shortcut to lots.

Bug Tracker
===========
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_usability/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Picking Usability",
"version": "14.0.2.0.0",
"version": "14.0.2.1.0",
"category": "Hidden/Tools",
"license": "AGPL-3",
"author": "AvanzOSC",
Expand Down
11 changes: 11 additions & 0 deletions stock_picking_usability/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,14 @@ msgstr "Mostrar siempre las operaciones detalladas"
#: model:ir.model,name:stock_picking_usability.model_stock_picking
msgid "Transfer"
msgstr "Albarán"

#. module: stock_picking_usability
#: model:ir.model.fields,field_description:stock_picking_usability.field_stock_picking__count_lots
msgid "Lots"
msgstr "Lotes"

#. module: stock_picking_usability
#: model_terms:ir.ui.view,arch_db:stock_picking_usability.stock_picking_view_form
msgid "<span class=\"o_stat_text\">Lots</span>"
msgstr "<span class=\"o_stat_text\">Lotes</span>"

11 changes: 11 additions & 0 deletions stock_picking_usability/i18n/stock_picking_usability.pot
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,14 @@ msgstr ""
#: model:ir.model,name:stock_picking_usability.model_stock_picking
msgid "Transfer"
msgstr ""

#. module: stock_picking_usability
#: model:ir.model.fields,field_description:stock_picking_usability.field_stock_picking__count_lots
msgid "Lots"
msgstr ""

#. module: stock_picking_usability
#: model_terms:ir.ui.view,arch_db:stock_picking_usability.stock_picking_view_form
msgid "<span class=\"o_stat_text\">Lots</span>"
msgstr ""

22 changes: 21 additions & 1 deletion stock_picking_usability/models/stock_picking.py
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
14 changes: 13 additions & 1 deletion stock_picking_usability/views/stock_picking_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,26 @@
type="object"
help="List view of detailed operations"
groups="base.group_no_one"
attrs="{'invisible': [('show_operations', '=', False)]}"
context="{'picking_type_code': picking_type_code, 'default_picking_id': id, 'form_view_ref':'stock.view_move_line_form', 'address_in_id': partner_id, 'default_picking_type_id': picking_type_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id}"
>
<div class="o_form_field o_stat_info">
<span class="o_stat_text">Detailed Operations</span>
<field name="is_return_picking" invisible="1" />
</div>
</button>
<button
name="action_picking_stock_production_lot_tree"
class="oe_stat_button"
icon="fa-arrows-v"
type="object"
help="List view of lots"
groups="base.group_no_one"
>
<div class="o_form_field o_stat_info">
<span class="o_stat_text">Lots</span>
<field name="count_lots" />
</div>
</button>
</button>
</field>
</record>
Expand Down

0 comments on commit 7c0bd96

Please sign in to comment.