Skip to content
  • Projects
  • Groups
  • Snippets
  • Help

aa.gusti / project

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Issues 0
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Charts
  • Create a new issue
  • Issue Boards
Odoo qa

Odoo qa

Last edited by aa.gusti Nov 20, 2021
Page History

QA

Q: Apa saja jenis field dalam Odoo

A: Lihat https://www.odoo.com/documentation/15.0/developer/reference/backend/orm.html

  • Jenis Field

    • Standard Field
      • Boolean
      • Char
        • size (int)
        • trim (bool)
        • translate (bool)
      • Float
        • digits (tuple(int,int) or str)
      • Integer
    • Advance Field
      • Binary
        • attachment (bool)
      • Html
        • sanitize (bool) default: True
        • sanitize_tags (bool) default: True
        • sanitize_attributes (bool) default: True
        • sanitize_style (bool)default: False
        • strip_style (bool) default: False
        • strip_classes (bool)default: False
      • Image
        • max_width (int)
        • max_height (int)
        • verify_resolution (bool)
      • Monetary
        • currency_field (str)
      • Selection
        • selection (list(tuple(str,str)) or callable or str)
        • selection_add (list(tuple(str,str)))
        • ondelete
      • Text
    • Date Field
      • Date
      • Datetime
    • Relational Fields
      • One2many
      • Many2one
      • Many2many
    • Pseudo-relational fields
      • Reference
      • Many2onwReference
    • Computed Field
    • Command
  • Parameter

    • string (str)
    • help (str)
    • invisible (bool)
    • readonly (bool)
    • required (bool)
    • index (bool)
    • default (value or callable)
    • states (dict)
    • groups (str
    • company_dependent (bool)
    • copy (bool)
    • store (bool)
    • group_operator (str)
    • group_expand (str)

Q: Bagaimana Membuat Tabel?

A: Buat Class dengan menurunkan models.Model

class Village(models.Model):
    _name = 'res.district.village'
    _description = "Desa/Keurahan"
    sub_district_id = fields.Many2one('res.district.sub', string='Kecamatan', required=True)
    typ = fields.Selection([
        ('desa', 'Desa'),
        ('kelurahan', 'Kelurahan')], 
        string='Jenis')
    code = fields.Char(string="Kode Desa/Kelurahan")
    name = fields.Char(string="Nama Desa/Kelurahan", index=True)
    display_code = fields.Char(index=True)  # compute='_compute_display_code', store=True,
    display_name = fields.Char(index=True)  # compute='_compute_display_name', store=True,
    _sql_constraints = [
        ('village_code_uniq', 'unique (sub_district_id,code)', 'Kode Kelurahan/Desa Harus Unik !'),
        ('village_name_uniq', 'unique (sub_district_id,typ,name)', 'Nama Kelurahan/Desa  Harus Unik !'),
    ]

Q: Bagaimana menurunkan suatu Tabel?

A: Buat Class dengan menurunkan models.Model

class ResPartner(models.Model):
    _inherit = 'res.partner'

Q: Apa itu _sql_constraints?

A: _sql_constraints adalah aturan yang akan diterapkan dalam suatu tabel lihat diatas.

Q: Bagaimana membuat custom select Option tanpa tabel? A: Definisikan type field dengan fild.Selection()

typ = fields.Selection([
        ('desa', 'Desa'),
        ('kelurahan', 'Kelurahan')],
        string='Jenis Desa')

Q: Bagaimana Menggabungkan 2 field dari field.Select dengan Field Lain:

A: dengan memanggil dict objek tersebut

def get_selection_label(self, obj, field_name, field_value):
    return dict(self.env[obj].fields_get(allfields=[field_name])[field_name]['selection'])[field_value]


class ResPartner(models.Model):
    _inherit = 'res.partner'

    def my_method(self):
        state_value_translated = get_selection_label(self, 'res.partner', 'state', self.state)
  Clone repository
  • Big data
  • Dw pajak
  • Hadoop
  • Hive
  • Home
  • Odoo
  • Odoo devel
  • Odoo devel action
  • Odoo devel form
  • Odoo devel model
  • Odoo devel pdl
  • Odoo devel pdl objek pajak
  • Odoo devel pdl product_category
  • Odoo devel view area
  • Odoo qa
More Pages
×

New Wiki Page

Tip: You can specify the full path for the new file. We will automatically create any missing directories.