Update configuration.py

This commit is contained in:
zainab2097 2024-07-31 17:31:20 +03:00 committed by GitHub
parent 7972b49fc6
commit 3f7054d21f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 1 deletions

View File

@ -96,7 +96,17 @@ class AttachmentRule(models.Model):
if record.file_save:
file_size = len(base64.b64decode(record.file_save))
if file_size > max_size:
raise ValidationError(_('Attachment %s exceeds the maximum allowed size of 10 MB.') % record.attachment_filename)
raise ValidationError(_('Attachment %s exceeds the maximum allowed size of 4 MB.') % record.attachment_filename)
@api.onchange('file_save')
def _onchange_file_save(self):
max_size = 4 * 1024 * 1024 # 4 MB
for record in self:
if record.file_save:
file_size = len(base64.b64decode(record.file_save))
if file_size > max_size:
record.file_save = False
raise UserError(_('Attachment %s exceeds the maximum allowed size of 4 MB.') % record.attachment_filename)
class TransactionTrace(models.Model):
_name = 'cm.transaction.trace'