Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2542 Zobrazení

hi! someone could help me, I'm trying to get the opening quantityt for a stock card but all the time I have 0.0, could you help me by saying that I have something wrong or another way to do it.

this is my code

my function

def get_opening_quantity(self, product):
product = self.env['product.product'].browse(product)
date = datetime.strptime(str(self.start_date), '%Y-%m-%d %H:%M:%S')
date = date - timedelta(days=1)
date = date.strftime('%Y-%m-%d')
qty = product.with_context(to_date=date).qty_available
return qty

this is my excel where im trying to print it


worksheet.write_merge(row, row, 0, 2, 'Start Qty', group_style)
op_qty = self.get_opening_quantity(val.get('id'))
balance = op_qty
worksheet.write_merge(row, row, 3, 9, '', group_style_right)
worksheet.write(row, 10, op_qty, group_style_right)
row += 1


im doing all that from a wizard 

thanks!!!

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
led 22
464
1
čvc 21
176
0
dub 21
331
2
lis 22
6201
1
čvn 22
8216