mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 23:52:07 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
from marshmallow import fields
|
||||
|
||||
from .core import ModelSerializer
|
||||
|
||||
|
||||
class GenericAbstractSerializer(ModelSerializer):
|
||||
_name = "generic.abstract.serializer"
|
||||
_model = "base"
|
||||
_register = False
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if kwargs.get("_model"):
|
||||
self._model = kwargs.pop("_model")
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
class GenericMinimalSerializer(GenericAbstractSerializer):
|
||||
_name = "generic.minimal.serializer"
|
||||
_model_fields = ["id", "display_name"]
|
||||
|
||||
id = fields.Integer(dump_only=True)
|
||||
display_name = fields.String(dump_only=True)
|
||||
|
||||
def to_recordset(self):
|
||||
return self.get_odoo_record()
|
||||
Loading…
Add table
Add a link
Reference in a new issue