Skip to content

onchange methods with new api not called correctly #88

@esciara

Description

@esciara

While trying to solve #85 I came across the following problem.

Where as calling the onchange_sale_price method (with argument 'fixed', 'percentage' or 'formula') on a sale.config.settings transient object works fine, calling the onchange_company_id method (with an int company id as argument) on an account.config.settings transient object does not. It returns a TypeError: onchange_company_id() takes exactly 1 argument (5 given)

The only reason I could see for this to happen is that where as the first one is written with the old api:

    def onchange_sale_price(self, cr, uid, ids, sale_pricelist_setting, context=None):

where as the second one is written with the new api:

    @api.onchange('company_id')
    def onchange_company_id(self):

Do you confirm this analysis? Does this mean that erppeek does not support the new api correctly yet? Or should I call that method differently?

For information, this is how I call the first one:

    config_model = erppeek_client.model('account.config.settings')
    defaults = config_model.default_get(config_model.keys())
    config_transient_object = config_model.create(defaults)
    config_transient_object.onchange_company_id(config_transient_object.company_id.id)
    [..]

and this is how I call the second:

    config_model = erppeek_client.model('sale.config.settings')
    defaults = config_model.default_get(config_model.keys())
    config_transient_object = config_model.create(defaults)
    config_transient_object.onchange_sale_price('formula')
    [..]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions