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][3863][ADD] crm_exception #56

Closed
wants to merge 3 commits into from

Conversation

AungKoKoLin1997
Copy link
Contributor

I will consider creating PR in OCA after the design is approved.
3863

Copy link
Contributor

@rinaldifirdaus rinaldifirdaus left a comment

Choose a reason for hiding this comment

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

IMO, we can go ahead with this design. as workaround, the client should prepare multiple exception for each field and give the warning message on exception name such "Please fill the Phone field", so that the users will acknowledge of which field that is required to be filled.

Comment on lines 19 to 27
def crm_check_exception(self):
self._check_exception()

def _check_crm_lead_check_exception(self, vals):
check_exceptions = any(
field in vals for field in self._fields_trigger_check_exception()
)
if check_exceptions:
self.crm_check_exception()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def crm_check_exception(self):
self._check_exception()
def _check_crm_lead_check_exception(self, vals):
check_exceptions = any(
field in vals for field in self._fields_trigger_check_exception()
)
if check_exceptions:
self.crm_check_exception()
def _check_crm_lead_check_exception(self, vals):
check_exceptions = any(
field in vals for field in self._fields_trigger_check_exception()
)
if check_exceptions:
self._check_exception()

# Copyright 2023 Quartile Limited
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Crm Exception",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"name": "Crm Exception",
"name": "CRM Exception",

{
"name": "Crm Exception",
"version": "16.0.1.0.0",
"category": "Tools",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"category": "Tools",
"category": "Customer Relationship Management",

@@ -0,0 +1 @@
This module allows you attach several customizable exceptions to your opportunity.
Copy link
Member

Choose a reason for hiding this comment

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

Check grammar.

<xpath expr="//field[@name='tag_ids']" position="after">
<field
name="ignore_exception"
states="purchase"
Copy link
Member

Choose a reason for hiding this comment

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

Propose an alternative or simply remove it.

if check_exceptions:
self.crm_check_exception()

def write(self, vals):
Copy link
Member

Choose a reason for hiding this comment

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

@AungKoKoLin1997 Any reason to use write() instead of @api.constrains()? Shouldn't the latter make the code more concise?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The main purpose is to avoid hardcoding a trigger field list in @api.constrains and ensure flexibility for potential future additions to the _fields_trigger_check_exception. May be rare case but I think it is also good for design.

Copy link
Member

Choose a reason for hiding this comment

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

@AungKoKoLin1997 Isn't that practically the same as the trigger fields are hardcoded anyway in _fields_trigger_check_exception() or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The trigger fields are hardcoded in _fields_trigger_check_exception() and we may extend this function and can add new more fields from another module if we will need some adjustments in the future.

Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

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

@AungKoKoLin1997 Can you provide the reason why we are now not supporting the ignore_exception option?

@AungKoKoLin1997
Copy link
Contributor Author

Can you provide the reason why we are now not supporting the ignore_exception option?

I misunderstood. I will revert it.

@AungKoKoLin1997
Copy link
Contributor Author

Closing this PR. I will create in OCA repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants