Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
3293 Представления

Hello, 

Can you explain me this Python function ? 

    @api.model
    def create(self, vals):
        record = super(ResPartnerSchool, self).create(vals)
        record.no_duplicate_school_dates()
        if not self.env.context.get('tracking_disable'):
            record.changed_half_pension()
        return record

and specially :

        if not self.env.context.get('tracking_disable'):
            record.changed_half_pension()

Thanks you

Аватар
Отменить
Лучший ответ

if not self.env.context.get('tracking_disable') this means if context does not have
"tracking_disable" or {'tracking_disable': False}

Аватар
Отменить
Лучший ответ

hello,

if not self.env.context.get('tracking_disable'):   
record.changed_half_pension()
this context you will get at the time when you import the csv file into odoo. so whenver you  
upload the csv file data to the system at that time the create method is call. so when you didn't
get the context at that time record.changed_half_pension() method will call. and when you import the
data from import button at that time record.changed_half_pension() this method will not call.

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
авг. 25
2495
3
февр. 25
3797
0
мая 24
46
1
апр. 24
3512
4
сент. 23
5050