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

Misc fix / imp #49

Merged
merged 6 commits into from
Aug 26, 2020
Merged

Conversation

simahawk
Copy link
Member

@simahawk simahawk commented Aug 26, 2020

Commits are self-explanatory.

Major change: exceptions on dispatch now return the log entry URL to improve reporting + check pkg name is unique.

Requires OCA/rest-framework#76 to be fully functional (not broken w/out tho).

def _constrain_name_unique(self):
for rec in self:
if self.search_count([("name", "=", rec.name), ("id", "!=", rec.id)]):
raise exceptions.UserError(_("Package name must be unique!"))
Copy link

Choose a reason for hiding this comment

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

couldn't a SQL constraint be used?

Copy link
Member Author

Choose a reason for hiding this comment

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

I prefer not to go for it to avoid conflicts w/ setup data and especially tests.
Also, if for any reason you want to take control of the feature, you can do it in this way.


log_entry = self._log_call_in_db(self.env, request, _id, params, result=result)
log_entry_url = self._get_log_entry_url(log_entry)
result["log_entry_url"] = log_entry_url
Copy link

Choose a reason for hiding this comment

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

❤️

@simahawk simahawk mentioned this pull request Aug 26, 2020
Copy link
Member

@jgrandguillaume jgrandguillaume left a comment

Choose a reason for hiding this comment

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

Awesome cool

@simahawk simahawk merged commit 5e3e4a5 into camptocamp:13.0-shopfloor Aug 26, 2020
sebalix pushed a commit that referenced this pull request Oct 22, 2020
Signed-off-by simahawk
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

Successfully merging this pull request may close these issues.

3 participants