Skip to content

Commit

Permalink
[ADD] stock_ux: add a setting to print the remaining quantities in de…
Browse files Browse the repository at this point in the history
…livery slips.

closes #381

Signed-off-by: augusto-weiss <awe@adhoc.com.ar>
  • Loading branch information
vib-adhoc committed Jul 10, 2023
1 parent a3d017a commit b4ea24f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
2 changes: 1 addition & 1 deletion stock_ux/__manifest__.py
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Stock UX',
'version': "16.0.2.1.0",
'version': "16.0.2.2.0",
'category': 'Warehouse Management',
'sequence': 14,
'summary': '',
Expand Down
5 changes: 5 additions & 0 deletions stock_ux/models/res_config_settings.py
Expand Up @@ -18,3 +18,8 @@ class ResConfigSettings(models.TransientModel):
'En Comprobantes de Transferencia usar Descripción de Origen',
config_parameter='stock_ux.delivery_slip_use_origin'
)

delivery_slip_remaining_qty = fields.Boolean(
'En Comprobantes de Transferencia mostrar cantidades pendientes de entrega',
config_parameter='stock_ux.delivery_slip_remaining_qty'
)
6 changes: 4 additions & 2 deletions stock_ux/models/stock_move_line.py
Expand Up @@ -105,8 +105,10 @@ def _get_aggregated_product_quantities(self, **kwargs):
aggregated_move_lines = super()._get_aggregated_product_quantities(**kwargs)
if bool(self.env['ir.config_parameter'].sudo().get_param('stock_ux.delivery_slip_use_origin', 'False')) == True:
for line in aggregated_move_lines:
moves = self.filtered(lambda sml: sml.product_id == aggregated_move_lines[line]['product']).mapped('move_id')
if moves.mapped('origin_description'):
moves = self.filtered(
lambda sml: sml.product_id == aggregated_move_lines[line]['product']
).mapped('move_id').filtered(lambda m: m.origin_description)
if moves:
aggregated_move_lines[line]['description'] = False
aggregated_move_lines[line]['name'] =', '.join(moves.mapped('origin_description'))
return aggregated_move_lines
2 changes: 1 addition & 1 deletion stock_ux/views/product_template_views.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<odoo>
<!-- desactivamos esta vista porque la busqeuda por warehouse y location ya viene por la vista de template. TODO hacer PR a odoo -->
<!-- desactivamos esta vista porque la busqueda por warehouse y location ya viene por la vista de template. TODO hacer PR a odoo -->
<record id="stock.product_search_form_view_stock" model="ir.ui.view">
<field name="active" eval="False"/>
</record>
Expand Down
4 changes: 4 additions & 0 deletions stock_ux/views/report_deliveryslip.xml
Expand Up @@ -21,6 +21,10 @@
<xpath expr="//t[@t-set='lines']" position="after">
<t t-set="lines" t-value="o.move_ids.filtered(lambda x: x.product_uom_qty and x.state != 'cancel')"/>
</xpath>

<xpath expr="//t[@t-if='o.backorder_ids and backorders']" position="attributes">
<attribute name="t-if">o.env['ir.config_parameter'].sudo().get_param('stock_ux.delivery_slip_remaining_qty', 'False') == 'True' and o.backorder_ids and backorders</attribute>
</xpath>
</template>

<template id="stock_report_delivery_has_serial_move_line" inherit_id="stock.stock_report_delivery_has_serial_move_line">
Expand Down
11 changes: 11 additions & 0 deletions stock_ux/views/res_config_settings_views.xml
Expand Up @@ -34,6 +34,17 @@
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="delivery_slip_remaining_qty"/>
</div>
<div class="o_setting_right_pane">
<label for="delivery_slip_remaining_qty"/>
<div class="text-muted">
Si marca esta opción, en los comprobantes de entrega se mostrarán las cantidades pendientes de entrega.
</div>
</div>
</div>
</xpath>
</field>
</record>
Expand Down

0 comments on commit b4ea24f

Please sign in to comment.