add fields from_location and to_location report shipment
This commit is contained in:
parent
2138bd92a6
commit
5bf13d44d0
22
shipment.py
22
shipment.py
|
@ -360,6 +360,14 @@ class ShipmentDetailedStart(ModelView):
|
|||
('internal', 'Internal'),
|
||||
], 'Type Shipment', required=True)
|
||||
grouped = fields.Boolean('Grouped')
|
||||
from_locations = fields.Many2Many('stock.location', None, None, 'From Location', domain=[
|
||||
('name', 'ilike', 'ZA%'),
|
||||
('active', '=', True)
|
||||
])
|
||||
to_locations = fields.Many2Many('stock.location', None, None, 'To Location', domain=[
|
||||
('name', 'ilike', 'ZA%'),
|
||||
('active', '=', True)
|
||||
])
|
||||
|
||||
@staticmethod
|
||||
def default_company():
|
||||
|
@ -378,12 +386,21 @@ class ShipmentDetailed(Wizard):
|
|||
print_ = StateReport('stock.shipment.shipment_detailed.report')
|
||||
|
||||
def do_print_(self, action):
|
||||
from_locations=None
|
||||
to_locations=None
|
||||
if self.start.from_locations:
|
||||
from_locations= [l.id for l in self.start.from_locations]
|
||||
if self.start.to_locations:
|
||||
to_locations= [l.id for l in self.start.to_locations]
|
||||
|
||||
data = {
|
||||
'company': self.start.company.id,
|
||||
'start_date': self.start.start_date,
|
||||
'end_date': self.start.end_date,
|
||||
'type_shipment': self.start.type_shipment,
|
||||
'grouped': self.start.grouped,
|
||||
'from_locations': from_locations,
|
||||
'to_locations': to_locations
|
||||
}
|
||||
return action, data
|
||||
|
||||
|
@ -411,6 +428,11 @@ class ShipmentDetailedReport(Report):
|
|||
('effective_date', '>=', data['start_date']),
|
||||
('effective_date', '<=', data['end_date'])
|
||||
]
|
||||
if data['from_locations']:
|
||||
dom_shipment.append(('from_location' , 'in', data['from_locations']))
|
||||
if data['to_locations']:
|
||||
dom_shipment.append(('to_location' , 'in', data['to_locations']))
|
||||
|
||||
fields_names = ['id']
|
||||
shipments = ModelShipment.search_read(dom_shipment,
|
||||
fields_names=fields_names,
|
||||
|
|
|
@ -12,4 +12,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="end_date"/>
|
||||
<label name="grouped"/>
|
||||
<field name="grouped" xexpand="0" width="25"/>
|
||||
<newline/>
|
||||
<field name="from_locations" colspan="2"/>
|
||||
<field name="to_locations" colspan="2"/>
|
||||
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue