Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2551 Widoki

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!!!

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sty 22
464
1
lip 21
176
0
kwi 21
331
2
lis 22
6216
1
cze 22
8223