Skip to Content
Menu
This question has been flagged

I'm getting the error InvalidDatetimeFormat: invalid input syntax for type date: "%Y-%m-%d"

My code from wizard is below:

@api.multi     
def export_xls(self):
        context = self._context
        datas = {'ids': context.get('active_ids', [])}
        datas['model'] = 'wizard.stock.history'
        tmp = self.read(['start_date', 'end_date'])
        if len(tmp) > 0:
            datas['form'] = tmp[0]
        for field in datas['form'].keys():
            if isinstance(datas['form'][field], tuple):
                datas['form'][field] = datas['form'][field]
        if context.get('xls_export'):
            return self.env.ref('product_category_report.stock_xlsx').report_action(self, data=datas)

And my code from rendering is,
sale_obj = self.env['sale.order.line'].search([('order_id.state', 'in', ('sale', 'done')),                                                        ('product_id', '=', product.id),
                                                       ('order_id.warehouse_id', '=', warehouse),
                                                       ('confirm_date', '>=', start_date),
                                                       ('confirm_date', '<=', end_date)])

I was taking stock reports from the odoo v11. But in this scenario, the error is happening like this. I don't know why, I have tried in many other ways, still the error is there.

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 19
3070
2
Mar 21
28174
2
Oct 22
9341
3
Jun 22
11956
6
Feb 25
52796