Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3991 Lượt xem

hi i have installed one module of version11 in verison 13 , it has installed but when i try to create a customer it showing this error



    old_res = super(Partner,self).onchange_state(self.state_id.id)
AttributeError: 'super' object has no attribute 'onchange_state'
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

In odoo 13 , your inheriting  the below onchange function from res_partner model,

@api.onchange('state_id')

    def _onchange_state(self):

        if self.state_id.country_id:

            self.country_id = self.state_id.country_id

In odoo 13 onchange_state has been changed to _onchange_state.
Hope it helps,

Thanks


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

The error message says that the function that you are trying to super is not existing inside the model. ie, the function onchange_state is not there inside odoo13 in this model.

In v13, the function might have changed or logic might have rewritten in some way, so you have to check and adjust code accordingly.


Thanks

Ảnh đại diện
Huỷ bỏ

Hello.
Do you know where to check those code refactores along the versions?
I find it hard to know what changed when doing module migrations.

Thank you