minor fix
This commit is contained in:
parent
0b7911f058
commit
60a74c6488
20
shipment.py
20
shipment.py
|
@ -396,7 +396,8 @@ class ShipmentDetailedReport(Report):
|
|||
|
||||
pool = Pool()
|
||||
company = Transaction().context.get('company.rec_name')
|
||||
model = 'stock.shipment.' + data['type_shipment']
|
||||
type_shipment_ = data['type_shipment']
|
||||
model = 'stock.shipment.' + type_shipment_
|
||||
ModelShipment = pool.get(model)
|
||||
Move = pool.get('stock.move')
|
||||
Product = pool.get('product.product')
|
||||
|
@ -415,10 +416,15 @@ class ShipmentDetailedReport(Report):
|
|||
'product.account_category.name', 'product.name', 'product.cost_price',
|
||||
'quantity', 'to_location.name', 'from_location.name'
|
||||
]
|
||||
fields = ModelShipment.fields_get(fields_names=['operation_center'])
|
||||
fields = ModelShipment.fields_get(fields_names=['operation_center', 'customer', 'supplier'])
|
||||
if 'operation_center' in fields.keys():
|
||||
fields_names.append('shipment.operation_center.rec_name')
|
||||
|
||||
if type_shipment_ == 'in':
|
||||
fields_names.append('shipment.supplier.name')
|
||||
elif type_shipment_ == 'out':
|
||||
fields_names.append('shipment.customer.name')
|
||||
|
||||
moves = Move.search_read(
|
||||
('shipment', 'in', shipments_id),
|
||||
fields_names=fields_names,
|
||||
|
@ -435,6 +441,13 @@ class ShipmentDetailedReport(Report):
|
|||
except:
|
||||
oc = ''
|
||||
|
||||
if type_shipment_ == 'in':
|
||||
party = m['shipment.']['supplier.']['name']
|
||||
elif type_shipment_ == 'out':
|
||||
party = m['shipment.']['customer.']['rec_name']
|
||||
else:
|
||||
party = ''
|
||||
|
||||
cost_price = product['cost_price']
|
||||
category = product.get('account_category.', '')
|
||||
if category:
|
||||
|
@ -444,6 +457,7 @@ class ShipmentDetailedReport(Report):
|
|||
category_ad = product_.categories[0].name
|
||||
|
||||
value = {
|
||||
'party': party,
|
||||
'oc': oc,
|
||||
'product': product['name'],
|
||||
'cost_price': cost_price,
|
||||
|
@ -453,11 +467,13 @@ class ShipmentDetailedReport(Report):
|
|||
|
||||
}
|
||||
try:
|
||||
value['cost_unit_w_tax'] = float(product_.cost_price_taxed)
|
||||
value['cost_w_tax'] = float(
|
||||
product_.cost_price_taxed) * quantity
|
||||
value['last_cost'] = product_.last_cost
|
||||
except:
|
||||
value['cost_w_tax'] = 0
|
||||
value['cost_unit_w_tax'] = 0
|
||||
value['last_cost'] = 0
|
||||
|
||||
try:
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue