def onchange_accelerated_depreciation(
     self,
     cr,
     uid,
     ids,
     accounting_method,
     accounting_periods,
     accounting_degressive_rate,
     accounting_prorata,
     fiscal_method,
     fiscal_periods,
     fiscal_degressive_rate,
     fiscal_prorata,
     context=None,
 ):
     if fiscal_periods > accounting_periods:
         return {
             "warning": {
                 "title": _("Warning"),
                 "message": _("Fiscal depreciation must be faster than accounting depreciation!"),
             }
         }
     return {
         "value": {
             "benefit_accelerated_depreciation": get_accelerated_depreciation(
                 **{
                     "accounting_method": accounting_method,
                     "accounting_periods": accounting_periods,
                     "accounting_degressive_rate": accounting_degressive_rate,
                     "accounting_prorata": accounting_prorata,
                     "fiscal_method": fiscal_method,
                     "fiscal_periods": fiscal_periods,
                     "fiscal_degressive_rate": fiscal_degressive_rate,
                     "fiscal_prorata": fiscal_prorata,
                 }
             )
         }
     }
 def _get_depreciation_infos(self, cr, uid, ids, name, arg, context=None):
     res = {}
     cr.execute(
         "SELECT asset_id as id, round(sum(debit-credit)) as amount "
         "FROM account_move_line WHERE asset_id IN %s GROUP BY asset_id",
         (tuple(ids),),
     )
     res.update(dict(cr.fetchall()))
     company_obj = self.pool.get("res.company")
     fields_to_read = [
         "purchase_value",
         "salvage_value",
         "depreciation_date_start",
         "sale_value",
         "state",
         "period_length",
         "accounting_prorata",
         "company_id",
     ]
     fields_to_read += ALL_DEPRECIATION_FIELDS
     for asset in self.read(cr, uid, ids, fields_to_read, context, "_classic_write"):
         fiscalyear_start_day = company_obj.get_fiscalyear_start_day(cr, uid, asset["company_id"], context)
         accelerated_depreciation = get_accelerated_depreciation(**asset)
         if asset["state"] == "draft":
             book_value = asset["purchase_value"]
         elif asset["state"] == "open":
             book_value = res.get(asset["id"], 0.0)
         else:
             book_value = asset["salvage_value"]
         res[asset["id"]] = {
             "depreciation_date_stop": get_period_stop_date(
                 asset["depreciation_date_start"], fiscalyear_start_day, asset["period_length"]
             ).strftime("%Y-%m-%d"),
             "benefit_accelerated_depreciation": accelerated_depreciation,
             "amount_to_depreciate": book_value - asset["salvage_value"],
         }
     return res