mirror of
https://github.com/bringout/oca-ocb-web.git
synced 2026-04-20 12:52:04 +02:00
Initial commit: Web packages
This commit is contained in:
commit
cd458d4b85
791 changed files with 410049 additions and 0 deletions
28
odoo-bringout-oca-ocb-web_editor/web_editor/models/models.py
Normal file
28
odoo-bringout-oca-ocb-web_editor/web_editor/models/models.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from hashlib import sha256
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class Base(models.AbstractModel):
|
||||
_inherit = 'base'
|
||||
|
||||
@api.model
|
||||
def _get_view_field_attributes(self):
|
||||
keys = super()._get_view_field_attributes()
|
||||
keys.append('sanitize')
|
||||
keys.append('sanitize_tags')
|
||||
return keys
|
||||
|
||||
|
||||
class BaseModel(models.AbstractModel):
|
||||
_inherit = 'base'
|
||||
|
||||
def update_field_translations_sha(self, fname, translations):
|
||||
field = self._fields[fname]
|
||||
if callable(field.translate):
|
||||
for translation in translations.values():
|
||||
for key, value in translation.items():
|
||||
translation[key] = field.translate.term_converter(value)
|
||||
return self._update_field_translations(fname, translations, lambda old_term: sha256(old_term.encode()).hexdigest())
|
||||
Loading…
Add table
Add a link
Reference in a new issue