The patch method is not thread safe, which is very annoying for SH users for instance. One obvious issue is that during one thread patching the method, other threads will also be impacted and have 100 decimal places for the discount. But it is even worse: * thread A start: original = real_original; new = patchedA * thread B start: original = patchedA; new = patchedB * thread A end: reset original to real_original * thread B end: reset original to patchedA Now at the end of the transaction, the original method simply doesn't exist anymore, and we only have one of the patches, which forces a restart of the server to fix it. opw-3552839 closes odoo/odoo#152168 X-original-commit: 9239ee3a95b474ce2eea92747b64f17f58c5c4cc Signed-off-by: Quentin De Paoli <qdp@odoo.com> Signed-off-by: William André (wan) <wan@odoo.com>
10 lines
306 B
Python
10 lines
306 B
Python
from odoo import models
|
|
|
|
class DecimalPrecision(models.Model):
|
|
_inherit = 'decimal.precision'
|
|
|
|
def precision_get(self, application):
|
|
if application == 'Discount' and self.env.context.get('ignore_discount_precision'):
|
|
return 100
|
|
return super().precision_get(application)
|