mirror of
https://bitbucket.org/presik/trytonpsk-stock_co.git
synced 2023-12-14 05:43:05 +01:00
add fields from_location and to_location report shipment
This commit is contained in:
parent
2138bd92a6
commit
5bf13d44d0
2 changed files with 26 additions and 0 deletions
22
shipment.py
22
shipment.py
|
@ -360,6 +360,14 @@ class ShipmentDetailedStart(ModelView):
|
||||||
('internal', 'Internal'),
|
('internal', 'Internal'),
|
||||||
], 'Type Shipment', required=True)
|
], 'Type Shipment', required=True)
|
||||||
grouped = fields.Boolean('Grouped')
|
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
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
|
@ -378,12 +386,21 @@ class ShipmentDetailed(Wizard):
|
||||||
print_ = StateReport('stock.shipment.shipment_detailed.report')
|
print_ = StateReport('stock.shipment.shipment_detailed.report')
|
||||||
|
|
||||||
def do_print_(self, action):
|
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 = {
|
data = {
|
||||||
'company': self.start.company.id,
|
'company': self.start.company.id,
|
||||||
'start_date': self.start.start_date,
|
'start_date': self.start.start_date,
|
||||||
'end_date': self.start.end_date,
|
'end_date': self.start.end_date,
|
||||||
'type_shipment': self.start.type_shipment,
|
'type_shipment': self.start.type_shipment,
|
||||||
'grouped': self.start.grouped,
|
'grouped': self.start.grouped,
|
||||||
|
'from_locations': from_locations,
|
||||||
|
'to_locations': to_locations
|
||||||
}
|
}
|
||||||
return action, data
|
return action, data
|
||||||
|
|
||||||
|
@ -411,6 +428,11 @@ class ShipmentDetailedReport(Report):
|
||||||
('effective_date', '>=', data['start_date']),
|
('effective_date', '>=', data['start_date']),
|
||||||
('effective_date', '<=', data['end_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']
|
fields_names = ['id']
|
||||||
shipments = ModelShipment.search_read(dom_shipment,
|
shipments = ModelShipment.search_read(dom_shipment,
|
||||||
fields_names=fields_names,
|
fields_names=fields_names,
|
||||||
|
|
|
@ -12,4 +12,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="end_date"/>
|
<field name="end_date"/>
|
||||||
<label name="grouped"/>
|
<label name="grouped"/>
|
||||||
<field name="grouped" xexpand="0" width="25"/>
|
<field name="grouped" xexpand="0" width="25"/>
|
||||||
|
<newline/>
|
||||||
|
<field name="from_locations" colspan="2"/>
|
||||||
|
<field name="to_locations" colspan="2"/>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue