Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onchange methods with new api not called correctly #88

Open
esciara opened this issue Jun 15, 2016 · 0 comments
Open

onchange methods with new api not called correctly #88

esciara opened this issue Jun 15, 2016 · 0 comments

Comments

@esciara
Copy link

esciara commented Jun 15, 2016

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')
    [..]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant