Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2596 Представления

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

Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
янв. 22
464
1
июл. 21
176
0
апр. 21
331
2
авг. 25
6390
1
июн. 22
8354