server-ux icon indicating copy to clipboard operation
server-ux copied to clipboard

[15.0][ADD] board_group_board

Open hbrunn opened this issue 1 year ago • 2 comments
trafficstars

This module allows imposing dasboards on users of specific groups

Configuration

To configure this module, you need to:

  1. Go to Settings / Technical / Group dashboard
  2. Create a record for each group you want to impose a dashboard on
  3. Note that users will be assigned the first board with a matching group, so move i.e. manager groups before user groups

Usage

To use this module, you need to:

  1. Go to Settings / Technical / Group dashboard
  2. On some dashboard, click 'Impose on all users', this will create a dashboard for all users of the groups listed on the group dashboard
  3. New users will receive the dashboard of their group Note that while users are able to customize their boards as they see fit, they'll lose all customization once you impose a dashboard again, either by clicking the button or by a group assignment for this user.

hbrunn avatar Feb 05 '24 11:02 hbrunn

Together with https://github.com/verdigado/odoo-customize/tree/15.0/verdigado_attendance I have the following exceptions, when installing verdigado_attendance which depends on board_group_board.

Table ir_ui_view_custom is empty.

2024-02-16 11:29:28,500 1 ERROR odoo-time odoo.sql_db: bad query: INSERT INTO "ir_ui_view_custom" ("id", "arch", "create_date", "create_uid", "ref_id", "user_id", "write_date", "write_uid") VALUES (nextval('ir_ui_view_custom_id_seq'), NULL, '2024-02-16 11:28:57.057711', 1, 596, 3, '2024-02-16 11:28:57.057711', 1) RETURNING id
ERROR: null value in column "arch" of relation "ir_ui_view_custom" violates not-null constraint
DETAIL:  Failing row contains (32, 596, 3, null, 1, 2024-02-16 11:28:57.057711, 1, 2024-02-16 11:28:57.057711).

And later

2024-02-16 11:29:28,502 1 WARNING odoo-time odoo.modules.loading: Transient module states were reset
2024-02-16 11:29:28,504 1 ERROR odoo-time odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 683, in _tag_root
    f(rec)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 586, in _tag_record
    record = model._load_records([data], self.mode == 'update')
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 4424, in _load_records
    data['record']._load_records_write(data['values'])
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 4348, in _load_records_write
    self.write(values)
  File "/usr/lib/python3/dist-packages/odoo/addons/hr/models/res_users.py", line 211, in write
    result = super(User, self).write(vals)
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/res_users.py", line 77, in write
    write_res = super(Users, self).write(vals)
  File "/mnt/extra-addons/board_group_board/models/res_users.py", line 22, in write
    self._update_board_from_groups()
  File "/mnt/extra-addons/board_group_board/models/res_users.py", line 38, in _update_board_from_groups
    self.env["ir.ui.view.custom"].sudo().create(
  File "<decorator-gen-69>", line 2, in create
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 417, in _model_create_multi
    return create(self, [arg])
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_fields.py", line 613, in create
    recs = super().create(vals_list)
  File "<decorator-gen-15>", line 2, in create
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 418, in _model_create_multi
    return create(self, arg)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 4088, in create
    records = self._create(data_list)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 4186, in _create
    cr.execute(query, params)
  File "<decorator-gen-5>", line 2, in execute
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 90, in check
    return f(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/sql_db.py", line 311, in execute
    res = self._obj.execute(query, params)
psycopg2.errors.NotNullViolation: null value in column "arch" of relation "ir_ui_view_custom" violates not-null constraint
DETAIL:  Failing row contains (32, 596, 3, null, 1, 2024-02-16 11:28:57.057711, 1, 2024-02-16 11:28:57.057711).

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 474, in load_modules
    processed_modules += load_marked_modules(cr, graph,
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 363, in load_marked_modules
    loaded, processed = load_module_graph(
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 222, in load_module_graph
    load_data(cr, idref, mode, kind='data', package=package)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 69, in load_data
    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 748, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 814, in convert_xml_import
    obj.parse(doc.getroot())
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 734, in parse
    self._tag_root(de)
  File "/usr/lib/python3/dist-packages/odoo/tools/convert.py", line 696, in _tag_root
    raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
odoo.tools.convert.ParseError: while parsing /mnt/extra-addons/verdigado_attendance/security/verdigado_attendance.xml:168, somewhere inside
<record id="base.default_user" model="res.users">
        <!-- don't make new users hr managers by default /-->
        <field name="groups_id" eval="[                 (3, ref('hr.group_hr_manager')),                 (3, ref('hr.group_hr_user')),                 (3, ref('hr_attendance.group_hr_attendance_kiosk')),                 (3, ref('hr_attendance.group_hr_attendance_manager')),                 (3, ref('hr_attendance.group_hr_attendance_user')),                 (3, ref('hr_holidays.group_hr_holidays_manager')),                 (3, ref('hr_holidays.group_hr_holidays_user')),                 (4, ref('verdigado_attendance.group_verdigado_employee')),             ]"/>
    </record>
2024-02-16 11:29:28,505 1 ERROR odoo-time odoo.http: Exception during JSON request handling.

Workaround (not really working)

This worked only once:

  1. first install board_group_board
  2. second install verdigado_attendance

Any idea, why?

albig avatar Feb 16 '24 12:02 albig

thanks @albig, the code didn't yet handle the start situation where you don't have any custom views yet. Fixed with the latest commit

hbrunn avatar Feb 19 '24 08:02 hbrunn

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Jun 23 '24 12:06 github-actions[bot]