Skip to content

Commit

Permalink
[IMP] add an alert message when return products on an stock picking a…
Browse files Browse the repository at this point in the history
…nd set true boolean "to refound"
  • Loading branch information
nicomacr committed Nov 7, 2018
1 parent 3b1a303 commit 57462e5
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 1 deletion.
1 change: 1 addition & 0 deletions sale_stock_ux/__init__.py
Expand Up @@ -3,3 +3,4 @@
# directory
##############################################################################
from . import models
from . import wizards
3 changes: 2 additions & 1 deletion sale_stock_ux/__manifest__.py
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Sale Stock UX',
'version': '11.0.1.0.0',
'version': '11.0.1.1.0',
'category': 'Sales',
'sequence': 14,
'summary': '',
Expand All @@ -36,6 +36,7 @@
'data': [
'views/sale_order_views.xml',
'views/sale_order_line_views.xml',
'wizards/stock_return_picking_line_views.xml',
],
'demo': [
],
Expand Down
5 changes: 5 additions & 0 deletions sale_stock_ux/wizards/__init__.py
@@ -0,0 +1,5 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from . import stock_return_picking
23 changes: 23 additions & 0 deletions sale_stock_ux/wizards/stock_return_picking.py
@@ -0,0 +1,23 @@
##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, api


class StockReturnPicking(models.TransientModel):
_inherit = "stock.return.picking"

@api.model
def default_get(self, fields):
"""Get sale order for lines."""
result = super(StockReturnPicking, self).default_get(fields)
try:
for line in result["product_return_moves"]:
assert line[0] == 0
# en realidad no nos importa si hay linea de venta o no ya que
# también lo usamos en compras y queremos que en todo caso este
line[2]["to_refund"] = True
except KeyError:
pass
return result
31 changes: 31 additions & 0 deletions sale_stock_ux/wizards/stock_return_picking_line_views.xml
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_stock_return_picking_form" model="ir.ui.view">
<field name="name">Imrpove refunds wizard</field>
<field name="inherit_id" ref="stock.view_stock_return_picking_form"/>
<field name="model">stock.return.picking</field>
<field name="arch" type="xml">
<group position="before">
<div class="alert alert-info" role="alert" style="margin-bottom:0px;">
<b>Importante</b>: si está haciendo un movimiento inverso relacionado a un Pedido de Venta o de Compra, entonces debe prestar atención al campo <b>"Para Abonar (actualizar OC/OV)"</b>, donde, si:
<ul>
<li>
<b>Está marcado</b>: entonces <b>se va</b> a actualizar la OC/OV considerando que los productos devueltos no se van a volver a entregar, y por ende, permitiendo hacer una nota de crédito si los items ya fueron facturados, o tener en cuenta esta devolución al hacer la factura.
</li>
<li>
<b>No está marcado</b>: entonces <b>no se va</b> a actualizar la OC/OV. Esto es común, por ejemplo, si se devuelve mercadería defectuosa y se pretende hacer una nueva entrega de la misma.
</li>
</ul>
Si la devolución no está ligada a una OC/OV entonces este campo no repercute en nada.
</div>
</group>
<field name="to_refund" position="attributes">
<!-- porque lo queremos usar tmb en oc y esto lo hace no marcable -->
<attribute name="attrs"></attribute>
<!-- porque la traducción no se actualiza -->
<attribute name="string">Para Abonar (actualizar OC/OV)</attribute>
</field>
</field>
</record>

</odoo>

0 comments on commit 57462e5

Please sign in to comment.