diff --git a/stock_batch_picking_ux/README.rst b/stock_batch_picking_ux/README.rst index 7568038b..934d0887 100644 --- a/stock_batch_picking_ux/README.rst +++ b/stock_batch_picking_ux/README.rst @@ -39,9 +39,18 @@ To configure this module, you need to: Usage ===== -To use this module, you need to: - -#. Go to ... +While creating a batch picking: +- Add the partner in the batch transfer, and then filter the transfers able to be selected according to it. +- Add the number of packages in the batch transfer +- For receipts, it add the supplier's shipping number. +- When pickings are selected while creating a new batch, we allow them to be unreserved and check availability. + +While proccesing the batch picking: +- Add the possibility of processing stock.move.line from a list view. +- In the transfer lines it add information of the vouchers, from & to and source document, among others. +- Allow to unreserve everything from the batch. +- A smart button is added to go to the list view of associated transfers. +- When you click on a transfer (from the transfer tab) you see all the possible actions that would be seen by entering it directly, such as the possibility of printing the remittance. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot diff --git a/stock_batch_picking_ux/models/stock_batch_picking.py b/stock_batch_picking_ux/models/stock_batch_picking.py index 1da1a7c7..932bc7ba 100644 --- a/stock_batch_picking_ux/models/stock_batch_picking.py +++ b/stock_batch_picking_ux/models/stock_batch_picking.py @@ -43,6 +43,21 @@ class StockPickingBatch(models.Model): related='picking_ids.vouchers', ) + picking_count = fields.Integer( + string="# Transferencias", compute="_compute_picking_count", + ) + + def _compute_picking_count(self): + """Calculate number of pickings.""" + groups = self.env["stock.picking"].read_group( + domain=[("batch_id", "in", self.ids)], + fields=["batch_id"], + groupby=["batch_id"], + ) + counts = {g["batch_id"][0]: g["batch_id_count"] for g in groups} + for batch in self: + batch.picking_count = counts.get(batch.id, 0) + @api.depends('picking_ids') def _compute_picking_type_data(self): for rec in self: @@ -145,3 +160,13 @@ def do_unreserve_picking(self): pickings_todo = self.mapped('picking_ids') self.write({'state': 'draft'}) pickings_todo.do_unreserve() + + def action_view_stock_picking(self): + """This function returns an action that display existing pickings of + given batch picking. + """ + self.ensure_one() + pickings = self.mapped("picking_ids") + action = self.env.ref("stock.action_picking_tree_all").read([])[0] + action["domain"] = [("id", "in", pickings.ids)] + return action \ No newline at end of file diff --git a/stock_batch_picking_ux/views/stock_batch_picking_views.xml b/stock_batch_picking_ux/views/stock_batch_picking_views.xml index 6c4ada51..0bda404e 100644 --- a/stock_batch_picking_ux/views/stock_batch_picking_views.xml +++ b/stock_batch_picking_ux/views/stock_batch_picking_views.xml @@ -38,9 +38,7 @@ - - + + @@ -61,7 +64,7 @@ - +