Python TypeError,未找到必需参数

时间:2017-05-24 02:35:26

标签: python odoo-10

我正在尝试建立一个模块,将A.D日期转换为B.S日期。我收到了类型错误Required argument 'month' (pos 2) not found

我的代码就像这样

 class Date(models.Model):
     _name = 'date'
     english_date = fields.Char(required=True, string='English Date')
     nep_date = fields.Char(compute='_converttonepali', store=True,string='Nepali Date')
     @api.multi
     @api.depends('english_date')
     def _converttonepali(self):
          yearsd = 2000
          monthd = 1
          eng_date = datetime.date(int(self.english_date))
          dayslapsed = (datetime.date(eng_date[0:4],eng_date[5:7],eng_date[8:]) - (start_english)).days

         for item in nepali_date:
            for month in range(1, 13):
                if dayslapsed >= item[month]:
                    monthd = month + 1
                    yearsd = int(item[0])
                 if monthd == 13:
                    monthd = 1
                    yearsd =yearsd + 1

    self.nep_date = str(yearsd) + '/' + str(monthd) + '/' + str(dayslapsed + 1)
    self.nep_date = datetime.date(int(self.nep_date[0:4]), int(self.nep_date[5:7]),int(self.nep_date[8:]))
    return self.nep_date

希望得到解决方案。谢谢大家。 here is the full error

0 个答案:

没有答案