Shipment default search by code or by reference

This commit is contained in:
Jordi Esteve 2015-07-09 20:40:54 +02:00
parent a7b99be470
commit 0519edb741
4 changed files with 71 additions and 3 deletions

View File

@ -7,6 +7,11 @@ from .shipment import *
def register():
Pool.register(
ShipmentIn,
ShipmentInReturn,
ShipmentOut,
ShipmentOutReturn,
ShipmentInternal,
StockSearchShipmentStart,
StockSearchShipmentStartFields,
module='stock_search_shipment', type_='model')

View File

@ -3,3 +3,6 @@ Búsqueda de albarán
===================
Permite buscar los albaranes desde su propia vista de formulario.
Amplia el criterio de búsqueda por defecto para buscar en el código o en la
referencia del albarán.

View File

@ -3,3 +3,6 @@ Stock Search Shipment Module
The stock search shipment module allows to search stock shipments from its own
form view.
The default search criteria is redefined to search by the shipment code or the
shipment reference.

View File

@ -3,16 +3,73 @@
# copyright notices and license terms.
from trytond.model import fields, ModelView
from trytond.pool import Pool, PoolMeta
from trytond.wizard import Button, StateAction, StateTransition, StateView, \
Wizard
from trytond.wizard import Button, StateAction, StateView, Wizard
from trytond.pyson import PYSONEncoder
from trytond.transaction import Transaction
__all__ = ['StockSearchShipmentStart', 'StockSearchShipmentStartFields',
__all__ = ['ShipmentIn', 'ShipmentInReturn',
'ShipmentOut', 'ShipmentOutReturn', 'ShipmentInternal',
'StockSearchShipmentStart', 'StockSearchShipmentStartFields',
'StockSearchShipment']
__metaclass__ = PoolMeta
class ShipmentIn():
__name__ = 'stock.shipment.in'
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
('code',) + tuple(clause[1:]),
('reference',) + tuple(clause[1:]),
]
class ShipmentInReturn():
__name__ = 'stock.shipment.in.return'
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
('code',) + tuple(clause[1:]),
('reference',) + tuple(clause[1:]),
]
class ShipmentOut():
__name__ = 'stock.shipment.out'
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
('code',) + tuple(clause[1:]),
('reference',) + tuple(clause[1:]),
]
class ShipmentOutReturn():
__name__ = 'stock.shipment.out.return'
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
('code',) + tuple(clause[1:]),
('reference',) + tuple(clause[1:]),
]
class ShipmentInternal():
__name__ = 'stock.shipment.internal'
@classmethod
def search_rec_name(cls, name, clause):
return ['OR',
('code',) + tuple(clause[1:]),
('reference',) + tuple(clause[1:]),
]
class StockSearchShipmentStart(ModelView):
'Stock Search Shipment Start'
__name__ = 'stock.search.shipment.start'