Exemplo n.º 1
0
class ModelAccess(models.Model):
    _name = "base.model.access"

    name = fields.Char(unique=True)
    model = fields.Char(required=True)
    group_id = fields.Many2one("base.group")
    allow_read = fields.Boolean(required=True, default=False)
    allow_write = fields.Boolean(required=True, default=False)
    allow_create = fields.Boolean(required=True, default=False)
    allow_unlink = fields.Boolean(required=True, default=False)
Exemplo n.º 2
0
class DocumentLevelSecurityRule(models.Model):
    _name = "base.dls"

    name = fields.Char(required=True)
    model = fields.Char(required=True)
    query = fields.Char(required=True)
    group_ids = fields.Many2many("base.group",
                                 relation="base.group.dls.rel",
                                 field_a="dls_oid",
                                 field_b="group_oid")
    on_read = fields.Boolean(required=True, default=True)
    on_write = fields.Boolean(requried=True, default=True)
    on_create = fields.Boolean(required=True, default=True)
    on_unlink = fields.Boolean(required=True, default=True)
Exemplo n.º 3
0
class tModel(models.Model):
    _name = "test.load.model"

    name = fields.Char()
    age = fields.Integer()
    boolean = fields.Boolean()
    manytoone_id = fields.Many2one("test.load.comodel")
    onetomany_ids = fields.One2many("test.load.comodel", "inverse_id")
    manytomany_ids = fields.Many2many(
        "test.load.comodel", relation="test.load.comodel.rel", field_a="a_oid", field_b="b_oid")
Exemplo n.º 4
0
class tModel(Model):
    _name = "TestModel"

    char_max_req = fields.Char(max_length=10, required=True)
    char_with_default = fields.Char(default="Default")
    integer = fields.Integer()
    selection = fields.Selection(choices=["a", "b", "c"])
    m2o = fields.Many2one("TestCoModel")
    m2m = fields.Many2many("TestTagModel",
                           relation="test.model.tag.rel",
                           field_a="a_oid",
                           field_b="b_oid")
    boolean = fields.Boolean()
    date_time = fields.DateTime()
Exemplo n.º 5
0
class tModel(models.Model):
    _name = "test.models.model"

    name = fields.Char()
    country = fields.Char(default="Argentina")
    age = fields.Integer()
    boolean = fields.Boolean()
    cascade_id = fields.Many2one("test.models.comodel", ondelete="CASCADE")
    restrict_id = fields.Many2one("test.models.comodel", ondelete="RESTRICT")
    setnull_id = fields.Many2one("test.models.comodel", ondelete="SET NULL")
    onetomany_ids = fields.One2many("test.models.comodel", "inverse_id")
    manytomany_ids = fields.Many2many("test.models.comodel",
                                      relation="test.model.comodel.rel",
                                      field_a="a_oid",
                                      field_b="b_oid")