minor fix in MoveByProduct
This commit is contained in:
parent
8960a9067a
commit
a46568c798
|
@ -0,0 +1 @@
|
|||
,presik,presik,23.09.2023 12:38,file:///home/presik/.config/libreoffice/4;
|
Binary file not shown.
16
stock.py
16
stock.py
|
@ -83,7 +83,6 @@ class Move(metaclass=PoolMeta):
|
|||
def do(cls, moves):
|
||||
super(Move, cls).do(moves)
|
||||
for move in moves:
|
||||
print('cuantos movimientos ocurren', move)
|
||||
product = move.product
|
||||
if not move.description:
|
||||
move.description = cls.on_change_with_description(move)
|
||||
|
@ -283,7 +282,9 @@ class MoveByProduct(Report):
|
|||
dom_products.append(
|
||||
('product', '=', data['product']),
|
||||
)
|
||||
print(dom_products)
|
||||
moves = Move.search([dom_products])
|
||||
print(moves, 'moves')
|
||||
|
||||
products = {}
|
||||
Location = pool.get('stock.location')
|
||||
|
@ -292,18 +293,20 @@ class MoveByProduct(Report):
|
|||
product = move.product
|
||||
amount = move.quantity * float(product.cost_price)
|
||||
origin = None
|
||||
id_dict = product.id
|
||||
if location.type == 'customer':
|
||||
id_dict = move.origin.sale.party.name + str(product.id)
|
||||
origin = move.origin.sale.party.name if move.origin else None
|
||||
try:
|
||||
row = products[product.id]
|
||||
row[3].append(move.quantity)
|
||||
row[5].append(amount)
|
||||
row = products[id_dict]
|
||||
row[4].append(move.quantity)
|
||||
row[6].append(amount)
|
||||
except Exception as e:
|
||||
template = product.template
|
||||
brand = template.brand and template.brand.name
|
||||
category = template.account_category and template.account_category.name
|
||||
effective_date = move.effective_date
|
||||
products[product.id] = [
|
||||
products[id_dict] = [
|
||||
product.code,
|
||||
origin,
|
||||
product.rec_name,
|
||||
|
@ -316,7 +319,10 @@ class MoveByProduct(Report):
|
|||
template.list_price,
|
||||
effective_date,
|
||||
]
|
||||
print(products[id_dict])
|
||||
|
||||
report_context['records'] = products.values()
|
||||
print(report_context['records'])
|
||||
report_context['from_location'] = from_location
|
||||
report_context['to_location'] = location
|
||||
report_context['customer_location'] = location.type == 'customer'
|
||||
|
|
Loading…
Reference in New Issue