Changed wizard in order to allow search several picking lists at a time
This commit is contained in:
parent
8548590dad
commit
a7b99be470
|
@ -4,9 +4,11 @@
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from .shipment import *
|
from .shipment import *
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
StockSearchShipmentStart,
|
StockSearchShipmentStart,
|
||||||
|
StockSearchShipmentStartFields,
|
||||||
module='stock_search_shipment', type_='model')
|
module='stock_search_shipment', type_='model')
|
||||||
Pool.register(
|
Pool.register(
|
||||||
StockSearchShipment,
|
StockSearchShipment,
|
||||||
|
|
25
shipment.py
25
shipment.py
|
@ -3,17 +3,27 @@
|
||||||
# copyright notices and license terms.
|
# copyright notices and license terms.
|
||||||
from trytond.model import fields, ModelView
|
from trytond.model import fields, ModelView
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
from trytond.wizard import Button, StateAction, StateView, Wizard
|
from trytond.wizard import Button, StateAction, StateTransition, StateView, \
|
||||||
|
Wizard
|
||||||
from trytond.pyson import PYSONEncoder
|
from trytond.pyson import PYSONEncoder
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
|
|
||||||
__all__ = ['StockSearchShipmentStart', 'StockSearchShipment']
|
__all__ = ['StockSearchShipmentStart', 'StockSearchShipmentStartFields',
|
||||||
|
'StockSearchShipment']
|
||||||
__metaclass__ = PoolMeta
|
__metaclass__ = PoolMeta
|
||||||
|
|
||||||
|
|
||||||
class StockSearchShipmentStart(ModelView):
|
class StockSearchShipmentStart(ModelView):
|
||||||
'Stock Search Shipment Start'
|
'Stock Search Shipment Start'
|
||||||
__name__ = 'stock.search.shipment.start'
|
__name__ = 'stock.search.shipment.start'
|
||||||
|
shipments = fields.One2Many('stock.search.shipment.start.field', 'search',
|
||||||
|
'Shipments')
|
||||||
|
|
||||||
|
|
||||||
|
class StockSearchShipmentStartFields(ModelView):
|
||||||
|
'Stock Search Shipment Start'
|
||||||
|
__name__ = 'stock.search.shipment.start.field'
|
||||||
|
search = fields.Many2One('stock.search.shipment.start', 'Search')
|
||||||
name = fields.Char('Code', required=True,
|
name = fields.Char('Code', required=True,
|
||||||
help='The code of the stock shipment you are looking for.')
|
help='The code of the stock shipment you are looking for.')
|
||||||
|
|
||||||
|
@ -40,13 +50,13 @@ class StockSearchShipment(Wizard):
|
||||||
('res_model', '=', context['active_model']),
|
('res_model', '=', context['active_model']),
|
||||||
('domain', '=', None),
|
('domain', '=', None),
|
||||||
], limit=1)
|
], limit=1)
|
||||||
shipments = Shipment.search([
|
codes = [s.name for s in self.start.shipments]
|
||||||
('code', '=', self.start.name),
|
shipments = [s.id for s in Shipment.search([
|
||||||
], limit=1)
|
('code', 'in', codes),
|
||||||
|
])]
|
||||||
if shipments:
|
if shipments:
|
||||||
shipment, = shipments
|
|
||||||
action['pyson_domain'] = PYSONEncoder().encode([
|
action['pyson_domain'] = PYSONEncoder().encode([
|
||||||
('id', '=', shipment.id),
|
('id', 'in', shipments),
|
||||||
])
|
])
|
||||||
if context['active_model'] != 'stock.shipment.out':
|
if context['active_model'] != 'stock.shipment.out':
|
||||||
action['res_model'] = context['active_model']
|
action['res_model'] = context['active_model']
|
||||||
|
@ -62,4 +72,5 @@ class StockSearchShipment(Wizard):
|
||||||
])]
|
])]
|
||||||
del action['act_window_domains']
|
del action['act_window_domains']
|
||||||
action['domains'] = []
|
action['domains'] = []
|
||||||
|
self.start.shipments = None
|
||||||
return action, {}
|
return action, {}
|
||||||
|
|
|
@ -4,10 +4,17 @@ The COPYRIGHT file at the top level of this repository contains the full
|
||||||
copyright notices and license terms. -->
|
copyright notices and license terms. -->
|
||||||
<tryton>
|
<tryton>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="stock_search_shipment_start_field_form_view">
|
||||||
|
<field name="model">stock.search.shipment.start.field</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="name">stock_search_shipment_start_field_tree</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record model="ir.ui.view" id="stock_search_shipment_start_form_view">
|
<record model="ir.ui.view" id="stock_search_shipment_start_form_view">
|
||||||
<field name="model">stock.search.shipment.start</field>
|
<field name="model">stock.search.shipment.start</field>
|
||||||
<field name="type">form</field>
|
<field name="type">form</field>
|
||||||
<field name="name">stock_search_shipment_start</field>
|
<field name="name">stock_search_shipment_start_form</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.action.wizard" id="stock_search_shipment_wizard">
|
<record model="ir.action.wizard" id="stock_search_shipment_wizard">
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!-- This file is part of the stock_search_shipment module for Tryton.
|
<!-- This file is part of the stock_search_shipment module for Tryton.
|
||||||
The COPYRIGHT file at the top level of this repository contains the full
|
The COPYRIGHT file at the top level of this repository contains the full
|
||||||
copyright notices and license terms. -->
|
copyright notices and license terms. -->
|
||||||
<form string="Stock Search Shipment">
|
<tree string="Stock Search Shipment" editable="bottom">
|
||||||
<label name="name"/>
|
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
</form>
|
<field name="search"/>
|
||||||
|
</tree>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of the stock_search_shipment module for Tryton.
|
||||||
|
The COPYRIGHT file at the top level of this repository contains the full
|
||||||
|
copyright notices and license terms. -->
|
||||||
|
<form string="Stock Search Shipment">
|
||||||
|
<field name="shipments"
|
||||||
|
view_ids="stock_search_shipment.stock_search_shipment_start_field_form_view"/>
|
||||||
|
</form>
|
Loading…
Reference in New Issue