stock_valuation_xlsx: fix crash with using depreciation rules

This commit is contained in:
Alexis de Lattre
2021-11-15 16:20:59 +01:00
parent 49226e814c
commit b72d8c44d4

View File

@@ -145,7 +145,7 @@ class StockValuationXlsx(models.TransientModel):
def _prepare_expiry_depreciation_rules(self, company_id, past_date): def _prepare_expiry_depreciation_rules(self, company_id, past_date):
rules = self.env['stock.expiry.depreciation.rule'].search_read([('company_id', '=', company_id)], ['start_limit_days', 'ratio'], order='start_limit_days desc') rules = self.env['stock.expiry.depreciation.rule'].search_read([('company_id', '=', company_id)], ['start_limit_days', 'ratio'], order='start_limit_days desc')
if past_date: if past_date:
date_dt = past_date date_dt = fields.Date.to_date(past_date) # convert datetime to date
else: else:
date_dt = fields.Date.context_today(self) date_dt = fields.Date.context_today(self)
for rule in rules: for rule in rules: