-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] attribute_set: target model patch fix and context fix
- Loading branch information
1 parent
204742c
commit 5405ab1
Showing
8 changed files
with
48 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from odoo.fields import Many2one | ||
from odoo.exceptions import MissingError | ||
|
||
# Override the Many2one field | ||
# class Many2oneOverride(fields.Many2one): | ||
|
||
def patch_convert_to_read(self, value, record, use_display_name=True): | ||
if use_display_name and value: | ||
try: | ||
return (value.id, value.sudo().display_name) | ||
except MissingError: | ||
return False | ||
elif value: | ||
return value.id | ||
# In general odoo assumes use_display_name is True if value is empty | ||
# If use_display_name is False is not in account or if value is empty | ||
# This fix will have a PR in odoo repositoy, | ||
# and if approved this fix code will be removed | ||
else: | ||
return False | ||
|
||
Many2one.convert_to_read = patch_convert_to_read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters