This question has been flagged
4 Replies
5330 Views

I'm getting this error after I have set the setting for the first time. It happens whenever accessing the settings menu.

Full Error Log:
https://lbwebsites.me/web/static/src/js/fields/basic_fields.js:814
Traceback:
Error: "30" is not an integer or a virtual id
    at Class._formatValue (https://lbwebsites.me/web/static/src/js/fields/basic_fields.js:814:23)
    at Class.prototype.<computed> [as _formatValue] (https://lbwebsites.me/web/static/src/js/core/class.js:90:38)
    at Class._prepareInput (https://lbwebsites.me/web/static/src/js/fields/basic_fields.js:247:30)
    at Class._renderEdit (https://lbwebsites.me/web/static/src/js/fields/basic_fields.js:259:14)
    at Class._render (https://lbwebsites.me/web/static/src/js/fields/abstract_field.js:353:25)
    at https://lbwebsites.me/web/static/src/js/fields/abstract_field.js:187:25
    at https://lbwebsites.me/web/static/lib/jquery/jquery.js:3276:89
    at fire (https://lbwebsites.me/web/static/lib/jquery/jquery.js:3119:58)
    at Object.add [as done] (https://lbwebsites.me/web/static/lib/jquery/jquery.js:3165:49)
    at Array.<anonymous> (https://lbwebsites.me/web/static/lib/jquery/jquery.js:3275:77)
Model
default_quote_valid_to = fields.Integer(string="Default Quote Valid to Days")
get_values method (appears to be the issue)
@api.model
def get_values(self):
    res = super(ResConfigSettings, self).get_values()
    ICPSudo = self.env['ir.config_parameter'].sudo()
    res.update(
        default_quote_valid_to = ICPSudo.get_param('quote.default_quote_valid_to', default=30),
    )
    return res

Edit: also the view where the field is displayed:
<div class="row mt16 o_settings_container">
    <div class="col-12 col-lg-6 o_setting_box" id="quotes">
        <div class="o_setting_left_pane">
            <field name="default_quote_valid_to" widget="integer"/>
        </div>
        <div class="o_setting_right_pane">
            <label for="default_quote_valid_to"/>
            <div class="text-muted">
                Set the default value of the days a quote is available to.
            </div>
        </div>
    </div>
</div>


Edit 2: this is a bespoke quote module not the built in one

Avatar
Discard
Best Answer

Please write as following because your field is integer so value must be integer. 

@api.model
def get_values(self):
    res = super(ResConfigSettings, self).get_values()
    ICPSudo = self.env['ir.config_parameter'].sudo()
    res.update(
        default_quote_valid_to = int(ICPSudo.get_param('quote.default_quote_valid_to', default=30)),
    )
    return res


Avatar
Discard
Best Answer

Have the same issue. As a temporal solution I made all my settings fields Char.

Avatar
Discard
Best Answer

Hi Levi: If you are interested in setting the number of days for which a Quotation is valid, you can set it in Settings > General Settings. The setting is also available in Quotation Templates if you need different validity periods.

Avatar
Discard
Author Best Answer

Thank you Paresh W however i forgot to mention that it is actually a bespoke quote module so using that will not work for me

Edit:

My only temporary fix was to change the JavaScript that handles the fields, as it was using regex to check if it was and Integer so i changed it to convert the string to int and check if it was NaN

Avatar
Discard