minor fix
This commit is contained in:
parent
aab3467e5a
commit
c60bc3432f
29
stock.py
29
stock.py
|
@ -656,7 +656,7 @@ class WarehouseKardexStockStart(ModelView):
|
|||
'Warehouse Kardex Stock Start'
|
||||
__name__ = 'stock_co.warehouse_kardex_stock.start'
|
||||
company = fields.Many2One('company.company', 'Company', required=True)
|
||||
location = fields.Many2One('stock.location', "Location",
|
||||
locations = fields.Many2Many('stock.location', None, None, "Location",
|
||||
domain=[
|
||||
('type', 'in', ['warehouse']),
|
||||
('active', '=', True)
|
||||
|
@ -688,10 +688,11 @@ class WarehouseKardexStock(Wizard):
|
|||
def do_print_(self, action):
|
||||
data = {
|
||||
'company': self.start.company.id,
|
||||
'location': self.start.location.id,
|
||||
# 'location': self.start.location.id,
|
||||
'from_date': self.start.from_date,
|
||||
'to_date': self.start.to_date,
|
||||
'categories': [l.id for l in self.start.categories],
|
||||
'locations': [l.id for l in self.start.locations],
|
||||
}
|
||||
return action, data
|
||||
|
||||
|
@ -707,11 +708,11 @@ class WarehouseKardexReport(Report):
|
|||
Company = pool.get('company.company')
|
||||
Product = pool.get('product.product')
|
||||
Location = pool.get('stock.location')
|
||||
warehouse = Location(data['location'])
|
||||
warehouses = Location.browse(data['locations'])
|
||||
# StockMove = pool.get('stock.move')
|
||||
id_location = warehouse.storage_location.id
|
||||
input_location = warehouse.input_location.id
|
||||
output_location = warehouse.output_location.id
|
||||
id_locations = [w.storage_location.id for w in warehouses if w.storage_location]
|
||||
# input_location = warehouse.input_location.id
|
||||
# output_location = warehouse.output_location.id
|
||||
dom_products = [
|
||||
('active', '=', True),
|
||||
('template.active', '=', True),
|
||||
|
@ -729,11 +730,11 @@ class WarehouseKardexReport(Report):
|
|||
|
||||
stock_context_start = {
|
||||
'stock_date_end': (data['from_date'] - timedelta(1)),
|
||||
'locations': [id_location],
|
||||
'locations': id_locations,
|
||||
}
|
||||
stock_context_end = {
|
||||
'stock_date_end': data['to_date'],
|
||||
'locations': [id_location],
|
||||
'locations': id_locations,
|
||||
}
|
||||
|
||||
products = {}
|
||||
|
@ -755,9 +756,11 @@ class WarehouseKardexReport(Report):
|
|||
# 'output': f'and from_location = {id_location} and to_location != {output_location}',
|
||||
# 'output_dif': f'and from_location = {output_location} and to_location = {id_location}'
|
||||
# }
|
||||
tup_locations = str(tuple(id_locations)).replace(',', '') if len(
|
||||
id_locations) == 1 else str(tuple(id_locations))
|
||||
type = {
|
||||
'input': f'and to_location = {id_location}',
|
||||
'output': f'and from_location = {id_location}',
|
||||
'input': f'and to_location in {tup_locations}',
|
||||
'output': f'and from_location in {tup_locations}',
|
||||
}
|
||||
|
||||
# where product in {tuple(products)}
|
||||
|
@ -791,8 +794,12 @@ class WarehouseKardexReport(Report):
|
|||
# report_context['products_in'] = moves['input']
|
||||
# report_context['products_start'] = products_start
|
||||
# report_context['products_end'] = products_end
|
||||
wh_name = ''
|
||||
for l in warehouses:
|
||||
wh_name += (l.name + ' ,')
|
||||
|
||||
report_context['products'] = products.values()
|
||||
report_context['warehouse'] = warehouse.name
|
||||
report_context['warehouse'] = wh_name
|
||||
report_context['company'] = Company(data['company'])
|
||||
return report_context
|
||||
|
||||
|
|
|
@ -4,11 +4,10 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<form>
|
||||
<label name="company"/>
|
||||
<field name="company"/>
|
||||
<label name="location"/>
|
||||
<field name="location"/>
|
||||
<label name="from_date"/>
|
||||
<field name="from_date"/>
|
||||
<label name="to_date"/>
|
||||
<field name="to_date"/>
|
||||
<field name="locations" colspan="4"/>
|
||||
<field name="categories" colspan="4"/>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue