Scan pending quantities, remove add products and hide picking menu

#046982
This commit is contained in:
Raimon Esteve 2021-09-03 12:35:57 +02:00
parent 9a7421c405
commit fbda7f5b30
5 changed files with 248 additions and 153 deletions

View File

@ -10,6 +10,10 @@ msgctxt "field:stock.configuration,scanner_on_shipment_in:"
msgid "Scanner on Supplier Shipments?"
msgstr "Escanejat a albarans de proveïdor?"
msgctxt "field:stock.configuration,scanner_on_shipment_in_return:"
msgid "Scanner on Supplier Return Shipments?"
msgstr "Escanejar en albarans de devolució proveïdor"
msgctxt "field:stock.configuration,scanner_on_shipment_out:"
msgid "Scanner on Customer Shipments?"
msgstr "Escanejat albarans de client?"
@ -18,6 +22,10 @@ msgctxt "field:stock.configuration,scanner_on_shipment_out_return:"
msgid "Scanner on Customer Return Shipments?"
msgstr "Escanejat a devolucions de client?"
msgctxt "field:stock.configuration,scanner_pending_quantity:"
msgid "Scanner Pending Quantity"
msgstr "Escanejar quantitat pendent"
msgctxt "field:stock.move,pending_quantity:"
msgid "Pending Quantity"
msgstr "Quantitat pendent"
@ -26,6 +34,38 @@ msgctxt "field:stock.move,scanned_quantity:"
msgid "Scanned Quantity"
msgstr "Quantitat escanejada"
msgctxt "field:stock.picking.shipment.out.ask,shipment:"
msgid "Shipment"
msgstr "Albarà"
msgctxt "field:stock.picking.shipment.out.ask,to_pick:"
msgid "To Pick"
msgstr "Per empaquetar"
msgctxt "field:stock.picking.shipment.out.result,note:"
msgid "Note"
msgstr "Nota"
msgctxt "field:stock.picking.shipment.out.result,shipment:"
msgid "Shipment"
msgstr "Albarà"
msgctxt "field:stock.picking.shipment.out.scan,pending_moves:"
msgid "APP Pending Moves"
msgstr "APP moviments pendents"
msgctxt "field:stock.picking.shipment.out.scan,product:"
msgid "Product"
msgstr "Producte"
msgctxt "field:stock.picking.shipment.out.scan,shipment:"
msgid "Shipment"
msgstr "Albarà"
msgctxt "field:stock.picking.shipment.out.scan,to_pick:"
msgid "To pick"
msgstr "Per empaquetar"
msgctxt "field:stock.shipment.in,pending_moves:"
msgid "Pending Moves"
msgstr "Moviments pendents"
@ -54,34 +94,6 @@ msgctxt "field:stock.shipment.in,scanner_enabled:"
msgid "Scanner Enabled"
msgstr "Escanejat habilitat"
msgctxt "field:stock.shipment.in.return,pending_moves:"
msgid "Pending Moves"
msgstr "Moviments pendents"
msgctxt "field:stock.shipment.in.return,scannable_products:"
msgid "Scannable Products"
msgstr "Escanejar productes"
msgctxt "field:stock.shipment.in.return,scanned_product:"
msgid "Scanned product"
msgstr "Producte escanejat"
msgctxt "field:stock.shipment.in.return,scanned_product_unit_digits:"
msgid "Scanned Product Unit Digits"
msgstr "Dígits unitat producte escanejat"
msgctxt "field:stock.shipment.in.return,scanned_quantity:"
msgid "Quantity"
msgstr "Quantitat"
msgctxt "field:stock.shipment.in.return,scanned_uom:"
msgid "Scanned UoM"
msgstr "UdM escanejada"
msgctxt "field:stock.shipment.in.return,scanner_enabled:"
msgid "Scanner Enabled"
msgstr "Escanejat habilitat"
msgctxt "field:stock.shipment.out,pending_moves:"
msgid "Pending Moves"
msgstr "Moviments pendents"
@ -143,6 +155,10 @@ msgid "If marked pending quantity is loaded when product is scanned"
msgstr ""
"Si es marca, es carregara la quantitat pendent al escanejar un producte."
msgctxt "help:stock.configuration,scanner_pending_quantity:"
msgid "Quantity scanned are pending quantities"
msgstr "Les quantitats per escanejar son les quantitats pendents"
msgctxt "help:stock.move,pending_quantity:"
msgid "Quantity pending to be scanned"
msgstr "Quantitat pendent d'escanejar"
@ -159,18 +175,6 @@ msgctxt "help:stock.shipment.in,scanned_quantity:"
msgid "Quantity of the scanned product."
msgstr "Quantitat del producte escanejat"
msgctxt "help:stock.shipment.in.return,pending_moves:"
msgid "List of pending products to be scan."
msgstr "Llista de productes pendents d'escanejar"
msgctxt "help:stock.shipment.in.return,scanned_product:"
msgid "Scan the code of the next product."
msgstr "Escanejeu el codi del proxim producte"
msgctxt "help:stock.shipment.in.return,scanned_quantity:"
msgid "Quantity of the scanned product."
msgstr "Quantitat del producte escanejat"
msgctxt "help:stock.shipment.out,pending_moves:"
msgid "List of pending products to be scan."
msgstr "Llista de productes pendents d'escanejar"
@ -195,6 +199,14 @@ msgctxt "help:stock.shipment.out.return,scanned_quantity:"
msgid "Quantity of the scanned product."
msgstr "Quantitat del producte escanejat"
msgctxt "model:ir.action,name:act_stock_picking_shipment_out"
msgid "Shipment Out Picking"
msgstr "Empaquetar albarans de client"
msgctxt "model:ir.message,text:msg_scan_all"
msgid "Are you sure you want to scan all pending moves?"
msgstr "Esteu segurs de escanejar tots els productes?"
msgctxt "model:ir.model.button,string:shipment_in_reset_button"
msgid "Reset Scanned Quantities"
msgstr "Reestableix quantitats escanejades"
@ -231,14 +243,26 @@ msgctxt "model:ir.model.button,string:shipment_out_scan_button"
msgid "Scan"
msgstr "Escaneja"
msgctxt "model:ir.model.button,string:shipment_return_in_scan_button"
msgid "Scan"
msgstr "Escaneja"
msgctxt "model:ir.ui.menu,name:menu_stock_shipment_out_picking"
msgid "Shipment Out Picking"
msgstr "Empaquetar albarans de client"
msgctxt "model:res.group,name:group_stock_scan_all"
msgid "Stock Scan All"
msgstr "Logística - Escanejar tot"
msgctxt "model:stock.picking.shipment.out.ask,name:"
msgid "Stock Picking Shipment Out Ask"
msgstr "Inici empaquetar albarans de client"
msgctxt "model:stock.picking.shipment.out.result,name:"
msgid "Stock Picking Shipment Out Result"
msgstr "Resultat empaquetar albarans de client"
msgctxt "model:stock.picking.shipment.out.scan,name:"
msgid "Stock Picking Shipment Out Scan"
msgstr "Escanejar albarans de client"
msgctxt "view:stock.configuration:"
msgid "Scanning Configuration"
msgstr "Configuració escanejat"
@ -251,18 +275,14 @@ msgctxt "view:stock.move:"
msgid "Pending Moves"
msgstr "Moviments pendents"
msgctxt "view:stock.shipment.in:"
msgid "Reset Scanned Quantities"
msgstr "Reestableix quantitats escanejades"
msgctxt "view:stock.picking.shipment.out.result:"
msgid "Done picking shipment"
msgstr "Finalitzat empaquetament albarà"
msgctxt "view:stock.shipment.in:"
msgid "Scan"
msgstr "Escaneja"
msgctxt "view:stock.shipment.in:"
msgid "Scan All"
msgstr "Escaneja tot"
msgctxt "view:stock.shipment.out.return:"
msgid "Reset Scanned Quantities"
msgstr "Reestableix quantitats escanejades"
@ -286,3 +306,35 @@ msgstr "Escaneja"
msgctxt "view:stock.shipment.out:"
msgid "Scan All"
msgstr "Escaneja tot"
msgctxt "wizard_button:stock.picking.shipment.out,ask,end:"
msgid "Cancel"
msgstr "Cancel·la"
msgctxt "wizard_button:stock.picking.shipment.out,ask,scan:"
msgid "Scan"
msgstr "Escaneja"
msgctxt "wizard_button:stock.picking.shipment.out,result,ask:"
msgid "Start"
msgstr "Inici"
msgctxt "wizard_button:stock.picking.shipment.out,result,end:"
msgid "Done"
msgstr "Finalitzat"
msgctxt "wizard_button:stock.picking.shipment.out,scan,ask:"
msgid "Back"
msgstr "Enrere"
msgctxt "wizard_button:stock.picking.shipment.out,scan,end:"
msgid "Cancel"
msgstr "Cancel·la"
msgctxt "wizard_button:stock.picking.shipment.out,scan,packed:"
msgid "Packed"
msgstr "Empaquetat"
msgctxt "wizard_button:stock.picking.shipment.out,scan,pick:"
msgid "Pick"
msgstr "Empaquetar"

View File

@ -10,6 +10,10 @@ msgctxt "field:stock.configuration,scanner_on_shipment_in:"
msgid "Scanner on Supplier Shipments?"
msgstr "¿Escaneado en albaranes de proveedor?"
msgctxt "field:stock.configuration,scanner_on_shipment_in_return:"
msgid "Scanner on Supplier Return Shipments?"
msgstr "Escanear albaranes devolución proveedor?"
msgctxt "field:stock.configuration,scanner_on_shipment_out:"
msgid "Scanner on Customer Shipments?"
msgstr "¿Escaneado en albaranes de cliente?"
@ -18,6 +22,10 @@ msgctxt "field:stock.configuration,scanner_on_shipment_out_return:"
msgid "Scanner on Customer Return Shipments?"
msgstr "¿Escaneado en devolución de cliente?"
msgctxt "field:stock.configuration,scanner_pending_quantity:"
msgid "Scanner Pending Quantity"
msgstr "Escanear cantidad pendiente"
msgctxt "field:stock.move,pending_quantity:"
msgid "Pending Quantity"
msgstr "Cantidad pendiente"
@ -26,6 +34,38 @@ msgctxt "field:stock.move,scanned_quantity:"
msgid "Scanned Quantity"
msgstr "Cantidad escaneada"
msgctxt "field:stock.picking.shipment.out.ask,shipment:"
msgid "Shipment"
msgstr "Albarán"
msgctxt "field:stock.picking.shipment.out.ask,to_pick:"
msgid "To Pick"
msgstr "Empaquetar"
msgctxt "field:stock.picking.shipment.out.result,note:"
msgid "Note"
msgstr "Nota"
msgctxt "field:stock.picking.shipment.out.result,shipment:"
msgid "Shipment"
msgstr "Albarán"
msgctxt "field:stock.picking.shipment.out.scan,pending_moves:"
msgid "APP Pending Moves"
msgstr "APP movimientos pendientes"
msgctxt "field:stock.picking.shipment.out.scan,product:"
msgid "Product"
msgstr "Producto"
msgctxt "field:stock.picking.shipment.out.scan,shipment:"
msgid "Shipment"
msgstr "Albarán"
msgctxt "field:stock.picking.shipment.out.scan,to_pick:"
msgid "To pick"
msgstr "Empaquetar"
msgctxt "field:stock.shipment.in,pending_moves:"
msgid "Pending Moves"
msgstr "Movimientos pendientes"
@ -54,34 +94,6 @@ msgctxt "field:stock.shipment.in,scanner_enabled:"
msgid "Scanner Enabled"
msgstr "Escaneado habilitado"
msgctxt "field:stock.shipment.in.return,pending_moves:"
msgid "Pending Moves"
msgstr "Movimientos pendientes"
msgctxt "field:stock.shipment.in.return,scannable_products:"
msgid "Scannable Products"
msgstr "Escanear productos"
msgctxt "field:stock.shipment.in.return,scanned_product:"
msgid "Scanned product"
msgstr "Producto escaneado"
msgctxt "field:stock.shipment.in.return,scanned_product_unit_digits:"
msgid "Scanned Product Unit Digits"
msgstr "Dígitos unidad escaneada"
msgctxt "field:stock.shipment.in.return,scanned_quantity:"
msgid "Quantity"
msgstr "Cantidad"
msgctxt "field:stock.shipment.in.return,scanned_uom:"
msgid "Scanned UoM"
msgstr "UdM escaneada"
msgctxt "field:stock.shipment.in.return,scanner_enabled:"
msgid "Scanner Enabled"
msgstr "Escaneado habilitado"
msgctxt "field:stock.shipment.out,pending_moves:"
msgid "Pending Moves"
msgstr "Movimientos pendientes"
@ -144,6 +156,10 @@ msgstr ""
"Si esta marcado la cantidad pendiente se pone or defecto cuando se escanea "
"un producto."
msgctxt "help:stock.configuration,scanner_pending_quantity:"
msgid "Quantity scanned are pending quantities"
msgstr "La cantidad escaneada es la cantidad pendiente"
msgctxt "help:stock.move,pending_quantity:"
msgid "Quantity pending to be scanned"
msgstr "Cantidad pendiente de escanear."
@ -160,18 +176,6 @@ msgctxt "help:stock.shipment.in,scanned_quantity:"
msgid "Quantity of the scanned product."
msgstr "Cantidad del producto escaneado."
msgctxt "help:stock.shipment.in.return,pending_moves:"
msgid "List of pending products to be scan."
msgstr "Lista de productos pendientes de escanear."
msgctxt "help:stock.shipment.in.return,scanned_product:"
msgid "Scan the code of the next product."
msgstr "Escanear el codigo del siguiente producto."
msgctxt "help:stock.shipment.in.return,scanned_quantity:"
msgid "Quantity of the scanned product."
msgstr "Cantidad del producto escaneado."
msgctxt "help:stock.shipment.out,pending_moves:"
msgid "List of pending products to be scan."
msgstr "Lista de productos pendientes de escanear."
@ -196,6 +200,14 @@ msgctxt "help:stock.shipment.out.return,scanned_quantity:"
msgid "Quantity of the scanned product."
msgstr "Cantidad del producto escaneado."
msgctxt "model:ir.action,name:act_stock_picking_shipment_out"
msgid "Shipment Out Picking"
msgstr "Empaquetamiento albaranes de cliente"
msgctxt "model:ir.message,text:msg_scan_all"
msgid "Are you sure you want to scan all pending moves?"
msgstr "¿Estais seguros de escanear todos los productos?"
msgctxt "model:ir.model.button,string:shipment_in_reset_button"
msgid "Reset Scanned Quantities"
msgstr "Reestablecer cantidad escaneada"
@ -232,14 +244,26 @@ msgctxt "model:ir.model.button,string:shipment_out_scan_button"
msgid "Scan"
msgstr "Escanear"
msgctxt "model:ir.model.button,string:shipment_return_in_scan_button"
msgid "Scan"
msgstr "Escanear"
msgctxt "model:ir.ui.menu,name:menu_stock_shipment_out_picking"
msgid "Shipment Out Picking"
msgstr "Empaquetamiento albaranes de cliente"
msgctxt "model:res.group,name:group_stock_scan_all"
msgid "Stock Scan All"
msgstr "Logística - Escanear todo"
msgctxt "model:stock.picking.shipment.out.ask,name:"
msgid "Stock Picking Shipment Out Ask"
msgstr "Inicio empaquetamiento albaranes de cliente"
msgctxt "model:stock.picking.shipment.out.result,name:"
msgid "Stock Picking Shipment Out Result"
msgstr "Resultado empaquetamiento albaranes de cliente"
msgctxt "model:stock.picking.shipment.out.scan,name:"
msgid "Stock Picking Shipment Out Scan"
msgstr "Escanear empaquetamiento albarán de cliente"
msgctxt "view:stock.configuration:"
msgid "Scanning Configuration"
msgstr "Configuración escaneado"
@ -252,18 +276,14 @@ msgctxt "view:stock.move:"
msgid "Pending Moves"
msgstr "Movimientos pendientes"
msgctxt "view:stock.shipment.in:"
msgid "Reset Scanned Quantities"
msgstr "Reestablecer cantidad escaneada"
msgctxt "view:stock.picking.shipment.out.result:"
msgid "Done picking shipment"
msgstr "Finalizar empaquetamiento del albarán"
msgctxt "view:stock.shipment.in:"
msgid "Scan"
msgstr "Escanear"
msgctxt "view:stock.shipment.in:"
msgid "Scan All"
msgstr "Escanear todo"
msgctxt "view:stock.shipment.out.return:"
msgid "Reset Scanned Quantities"
msgstr "Reestablecer cantidad escaneada"
@ -287,3 +307,35 @@ msgstr "Escanear"
msgctxt "view:stock.shipment.out:"
msgid "Scan All"
msgstr "Escanear todo"
msgctxt "wizard_button:stock.picking.shipment.out,ask,end:"
msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:stock.picking.shipment.out,ask,scan:"
msgid "Scan"
msgstr "Escanear"
msgctxt "wizard_button:stock.picking.shipment.out,result,ask:"
msgid "Start"
msgstr "Inicio"
msgctxt "wizard_button:stock.picking.shipment.out,result,end:"
msgid "Done"
msgstr "Finalizar"
msgctxt "wizard_button:stock.picking.shipment.out,scan,ask:"
msgid "Back"
msgstr "Atrás"
msgctxt "wizard_button:stock.picking.shipment.out,scan,end:"
msgid "Cancel"
msgstr "Cancelar"
msgctxt "wizard_button:stock.picking.shipment.out,scan,packed:"
msgid "Packed"
msgstr "Empaquetado"
msgctxt "wizard_button:stock.picking.shipment.out,scan,pick:"
msgid "Pick"
msgstr "Empaquetamiento"

View File

@ -4,7 +4,7 @@ this repository contains the full copyright notices and license terms. -->
<tryton>
<data grouped="1">
<record model="ir.message" id="msg_scan_all">
<field name="text">Are you sure you want to scan all pending moves and leave them as received? This action cannot be undone.</field>
<field name="text">Are you sure you want to scan all pending moves?</field>
</record>
</data>
</tryton>

View File

@ -31,6 +31,37 @@ class Configuration(metaclass=PoolMeta):
'Scanner on Customer Return Shipments?')
scanner_fill_quantity = fields.Boolean('Fill Quantity',
help='If marked pending quantity is loaded when product is scanned')
scanner_pending_quantity = fields.Boolean("Scanner Pending Quantity",
states={
'invisible': ~Eval('scanner_fill_quantity'),
}, depends=['scanner_fill_quantity'],
help="Quantity scanned are pending quantities")
@staticmethod
def default_scanner_fill_quantity():
return True
@staticmethod
def default_scanner_on_shipment_out():
return True
@classmethod
def write(cls, *args):
pool = Pool()
ModelData = pool.get('ir.model.data')
Menu = pool.get('ir.ui.menu')
super(Configuration, cls).write(*args)
menu_stock_shipment_out_picking = Menu(ModelData.get_id('stock_scanner',
'menu_stock_shipment_out_picking'))
actions = iter(args)
for records, values in zip(actions, actions):
if 'scanner_on_shipment_out' in values:
menu_stock_shipment_out_picking.active = values[
'scanner_on_shipment_out']
menu_stock_shipment_out_picking.save()
@classmethod
def scanner_on_shipment_type(cls, shipment_type):
@ -219,8 +250,8 @@ class StockScanMixin(object):
@fields.depends('scanned_product', 'pending_moves', 'scanned_quantity')
def on_change_scanned_product(self):
pool = Pool()
Config = pool.get('stock.configuration')
Config = Pool().get('stock.configuration')
if not self.scanned_product:
self.scanned_uom = None
self.scanned_quantity = None
@ -229,12 +260,14 @@ class StockScanMixin(object):
config = Config(1)
scanned_moves = self.get_matching_moves()
if scanned_moves:
self.scanned_uom = scanned_moves[0].uom
scanned_move = scanned_moves[0]
self.scanned_uom = scanned_move.uom
self.scanned_product_unit_digits = (
self.on_change_with_scanned_product_unit_digits())
if config.scanner_fill_quantity:
self.scanned_quantity = scanned_moves[0].pending_quantity
self.scanned_quantity = (scanned_move.pending_quantity
if config.scanner_pending_quantity else 1)
return
@ -292,33 +325,14 @@ class StockScanMixin(object):
to_save.append(shipment)
cls.save(to_save)
def get_processed_move(self):
pool = Pool()
Move = pool.get('stock.move')
move = Move()
move.company = self.company
move.product = self.scanned_product
move.uom = self.scanned_uom
move.quantity = self.scanned_quantity
move.shipment = str(self)
move.planned_date = self.planned_date
move.currency = self.company.currency
return move
def process_moves(self, moves):
pool = Pool()
Uom = pool.get('product.uom')
Uom = Pool().get('product.uom')
if (not self.scanned_quantity or not self.scanned_uom
or self.scanned_quantity < self.scanned_uom.rounding):
or self.scanned_quantity < self.scanned_uom.rounding
or not moves):
return
if not moves:
move = self.get_processed_move()
move.save()
moves = [move]
for move in moves:
# find move with the same quantity
scanned_qty_in_move_uom = Uom.compute_qty(self.scanned_uom,
@ -380,14 +394,6 @@ class ShipmentIn(StockScanMixin, metaclass=PoolMeta):
def get_pick_moves(self):
return self.incoming_moves
def get_processed_move(self):
move = super(ShipmentIn, self).get_processed_move()
move.from_location = self.supplier_location
move.to_location = self.warehouse_input
# TODO: add to scanner or improve it
move.unit_price = move.product.cost_price
return move
@classmethod
def receive(cls, shipments):
cls.set_scanned_quantity_as_quantity(shipments, 'incoming_moves')
@ -413,14 +419,6 @@ class ShipmentOut(StockScanMixin, metaclass=PoolMeta):
def get_pick_moves(self):
return self.inventory_moves
def get_processed_move(self):
move = super(ShipmentOut, self).get_processed_move()
move.from_location = self.warehouse_storage
move.to_location = self.warehouse_output
# TODO: add to scanner or improve it
move.unit_price = move.product.list_price
return move
@classmethod
def pack(cls, shipments):
cls.set_scanned_quantity_as_quantity(shipments, 'inventory_moves')
@ -433,14 +431,6 @@ class ShipmentOutReturn(ShipmentOut, metaclass=PoolMeta):
def get_pick_moves(self):
return self.incoming_moves
def get_processed_move(self):
move = super(ShipmentOutReturn, self).get_processed_move()
move.from_location = self.customer_location
move.to_location = self.warehouse_input
# TODO: add to scanner or improve it
move.unit_price = move.product.list_price
return move
@classmethod
def receive(cls, shipments):
cls.set_scanned_quantity_as_quantity(shipments, 'incoming_moves')

View File

@ -2,8 +2,7 @@
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='shipment_internal_sequence']"
position="after">
<xpath expr="/form/field[@name='shipment_internal_sequence']" position="after">
<group id="scanner" string="Scanning Configuration" colspan="4">
<label name="scanner_on_shipment_in"/>
<field name="scanner_on_shipment_in"/>
@ -15,6 +14,8 @@
<field name="scanner_on_shipment_out_return"/>
<label name="scanner_fill_quantity"/>
<field name="scanner_fill_quantity"/>
<label name="scanner_pending_quantity"/>
<field name="scanner_pending_quantity"/>
</group>
</xpath>
</data>