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

[16.0][IMP] spreadsheet_dashboard_oca: Dashboard editability #31

Merged

Conversation

pedrobaeza
Copy link
Member

All the spreadsheet dashboards coming from Odoo in the modules spreadsheet_dashboard* are noupdate="0", which means that if you modify anything via this module, and then you update the module, all the changes will be lost.

To avoid frustrations and to allow seamless updates, the following mechanisms have been put in place:

  • Spreadsheet dashboards now have an active field.
  • Only the manually created dashboards or those coming from data with noupdate="1" will be editable.
  • There's a mechanism for copying existing dashboards.

So, for modifying one of the standard dashboards, the steps will be:

  • Duplicate it through the "Copy" button.
  • Disable the standard one.
  • Edit the copy.

imagen

@Tecnativa TT49379

@pedrobaeza pedrobaeza added this to the 16.0 milestone May 29, 2024
type="object"
string="Copy"
icon="fa-copy"
groups="base.group_system"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only setting users??

Copy link
Member Author

@pedrobaeza pedrobaeza May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't changed this. Only being consistent with the other buttons. But yes, it seems a bit restricted. What do you think, @etobella ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was done this way in order to set some groups, but we can create a new set if we think that it is the best option.

Copy link

@sergio-teruel sergio-teruel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only a minor comment

type="object"
string="Copy"
icon="fa-copy"
groups="base.group_system"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was done this way in order to set some groups, but we can create a new set if we think that it is the best option.

Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a remark inline.

Otherwise, LGTM.

Thanks for catching that point.

@@ -30,3 +32,13 @@ def _inverse_spreadsheet_raw(self):
record.data = base64.encodebytes(
json.dumps(record.spreadsheet_raw).encode("UTF-8")
)

def _compute_can_edit(self):
"""We can edit if the record doesn't have XML-ID, or the XML-ID is noupdate=1"""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we export a record (compatible for import) an xml id is generated.
With the current algorithm, if we export a record, it will become not editable. Don't you think ?

Quite theoritical use case though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, as the XML-ID entry __export__.<whatever> will be noupdate=1.

Copy link
Contributor

@legalsylvain legalsylvain May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, as the XML-ID entry __export__.<whatever> will be noupdate=1.

I just tested in a 16.0 CE database.

  • create a new product template, via UI
# select id, name, categ_id, type from product_template where id = 28;
 id |            name             | categ_id | type  
----+-----------------------------+----------+-------
 28 | {"en_US": "my new product"} |        1 | consu
  • export the product via UI, (checking compatible for import)
select id, module, name, model, res_id, noupdate from ir_model_data where res_id = 28 and model = 'product.template';
  id   |   module   |             name             |      model       | res_id | noupdate 
-------+------------+------------------------------+------------------+--------+----------
 15659 | __export__ | product_template_28_c3c1d954 | product.template |     28 | f

If I understand correctly, noupdate = False, so can_edit = False

did I missed something ? Sorry if my comment is not relevant.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch, I didn't expect that one... Anyway, fixed 😉

All the spreadsheet dashboards coming from Odoo in the modules
spreadsheet_dashboard* are noupdate="0", which means that if you
modify anything via this module, and then you update the module, all the
changes will be lost.

To avoid frustrations and to allow seamless updates, the following
mechanisms have been put in place:

- Spreadsheet dashboards now have an active field.
- Only the manually created dashboards or those coming from data
  with noupdate="1" will be editable.
- There's a mechanism for copying existing dashboards.

So, for modifying one of the standard dashboards, the steps will be:

- Duplicate it through the "Copy" button.
- Disable the standard one.
- Edit the copy.

TT49379
@pedrobaeza pedrobaeza force-pushed the 16.0-imp-spreadsheet_dashboard_oca-ux branch from 5e7293a to 5b9316b Compare May 29, 2024 21:08
@legalsylvain
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-31-by-legalsylvain-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 00657f8 into OCA:16.0 May 29, 2024
5 of 7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 2ba9692. Thanks a lot for contributing to OCA. ❤️

@pedrobaeza pedrobaeza deleted the 16.0-imp-spreadsheet_dashboard_oca-ux branch May 29, 2024 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants