i try to update module "base", an error occured and loading didnt end. i even can`t watch error description.
But i disabled loadscreen in page code and then i watched it:
UncaughtClientError > SyntaxError
Uncaught Error Javascript > JSON.parse: unexpected character at line 1 column 1 of the JSON data
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
jsonrpc/promise</<@https://erp-test-server.ta-da.ua/web/assets/2407-3bfcb27/web.assets_backend.min.js:593:55
i tried to find something in assets or some js module, but i failed. also this error ocurred, when i try update other base modules, like "mail" or "web".
p.s. i didnt apply any changes to base module.
p.s_2 in this ubuntu server odoo is building in docker container.
The right way to update a base module is to inherit it (see documentation on official odoo webpage : https://www.odoo.com/documentation/15.0/fr/developer/howtos/backend.html).
As Example : To update the base model: account_analytic_default:
Create your own module account_analytic_default_mycustom :
__manifest__.py
file in this directory: # -*- coding: utf-8 -*-
{
'name': "account_analytic_default_mycustom",
'summary': """ my customizaton on account_analytic_default""",
'description': """
my customizaton on account_analytic_default using inherit on model and views
""",
'author': "sb",
'category': 'Uncategorized',
'version': '13.0.2.0.1',
# any module necessary for this one to work correctly
'depends': ['base','account_analytic_default','account_analytic_default_hr_expense'],
# always loaded
'data': [
# 'security/ir.model.access.csv',
#'views/views.xml',
#'views/templates.xml',
],
}
Inside your main module directory, create the basic directories : models, controllers, views, security... and create an __init__.py
file which contains lines to import the previously defined basic directories.
Create a new file in your models directory: models.py
And in this file, to add new fields and methods to the corresponding model:
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class AccountAnalyticDefault(models.Model):
_inherit = "account.analytic.default"
my_newfield_startdate= fields.Datetime(string="Début réserv.")
my_newfield_qty = fields.Integer('quantity')
my_newfield_qty_perc = fields.Integer('quantity percent', compute='_compute_my_newfield_qty_perc')
@api.onchange('my_newfield_qty')
def _compute_my_newfield_qty_perc(self):
total_quantity = sum(self.env.search([]).mapped("my_newfield_qty"))
for record in self:
record.my_newfield_qty_perc = record.my_newfield_qty/total_quantity