Skip to content

Instantly share code, notes, and snippets.

@ejabu
Last active March 5, 2019 07:39
Show Gist options
  • Save ejabu/db7df2947e503393c2149f9d5dcdad1e to your computer and use it in GitHub Desktop.
Save ejabu/db7df2947e503393c2149f9d5dcdad1e to your computer and use it in GitHub Desktop.
{
"New security Template": {
"prefix": "new_security",
"body": [
"<odoo>",
"",
" <record model=\"ir.module.category\" id=\"vs_base_account\">",
" <field name=\"name\">Base User</field>",
" <field name=\"description\">Base User</field>",
" <field name=\"sequence\">112</field>",
" </record>",
"",
" <record model=\"res.groups\" id=\"account_base_user\">",
" <field name=\"name\">Account Base User</field>",
" <field name=\"category_id\" ref=\"vs_base_account\"/>",
" <field name=\"implied_ids\" eval=\"[(4, ref('base.group_user'))]\"/>",
" </record>",
"",
" <record model=\"ir.module.category\" id=\"accounting_ar_process\">",
" <field name=\"name\">Accounting AR Process</field>",
" <field name=\"description\">Manage Pembentukkan dan Pelunasan AR</field>",
" <field name=\"sequence\">333</field>",
" </record>",
" ",
" <record model=\"res.groups\" id=\"ar_clerk\">",
" <field name=\"name\">AR Clerk</field>",
" <field name=\"category_id\" ref=\"accounting_ar_process\"/>",
" <field name=\"implied_ids\" eval=\"[(4, ref('account_base_user'))]\"/>",
" </record>",
"",
"",
"",
" <!-- <record id=\"base.user_root\" model=\"res.users\">",
" <field name=\"groups_id\" eval=\"[(4, ref('account.group_account_invoice')), (4, ref('account.group_account_manager'))]\"/>",
" </record>",
"",
" <record id=\"base.group_system\" model=\"res.groups\">",
" <field name=\"implied_ids\" eval=\"[(4, ref('account.group_account_manager'))]\"/>",
" </record>",
" -->",
"</odoo>"
],
},
"New Model Template": {
"prefix": "new_model",
"body": [
"$0<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
"<odoo>",
" <data>",
" <!-- List View (Tree) -->",
" <record model=\"ir.ui.view\" id=\"$1_tree\">",
" <field name=\"name\">$2.tree</field>",
" <field name=\"model\">$2</field>",
" <field name=\"arch\" type=\"xml\">",
" <tree>",
" <field name=\"name\"/>",
" </tree>",
" </field>",
" </record>",
" ",
" <!-- Form View -->",
" <record model=\"ir.ui.view\" id=\"$1_form\">",
" <field name=\"name\">$2.form</field>",
" <field name=\"model\">$2</field>",
" <field name=\"arch\" type=\"xml\">",
" <form>",
" <header>",
" <!-- <button name=\"action_cancel\" string=\"Cancel\" type=\"object\" /> -->",
" </header>",
" <sheet>",
" <group>",
" <group>",
" <field name=\"name\"/>",
" </group>",
" <group>",
" </group>",
" </group>",
" </sheet>",
" </form>",
" </field>",
" </record>",
"",
" <record model=\"ir.actions.act_window\" id=\"$1_action\">",
" <field name=\"name\">$3</field>",
" <field name=\"res_model\">$2</field>",
" <field name=\"view_type\">form</field>",
" <field name=\"view_mode\">tree,form</field>",
" </record>",
"",
" <menuitem ",
" id=\"menu_$1\" ",
" name=\"$3\" ",
" sequence=\"100\"",
" />",
"",
" <menuitem ",
" id=\"sub_$1\" ",
" parent=\"menu_$1\" ",
" name=\"Sub $3\" ",
" sequence=\"50\" ",
" action=\"$1_action\" ",
" />",
"",
" </data>",
"</odoo>",
],
},
"Inherit Model Template": {
"prefix": "inherit existing model",
"body": [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>",
"<odoo>",
" <data>",
" <record model=\"ir.ui.view\" id=\"invoice_supplier_form\">",
" <field name=\"name\">${1:account.invoice}.form</field>",
" <field name=\"model\">${1:account.invoice}</field>",
" <field name=\"inherit_id\" ref=\"account.invoice_supplier_form\"/>",
" <field name=\"arch\" type=\"xml\">",
" <xpath expr=\"//field[@name='partner_id']\" position=\"before\">",
" <field name=\"kode_supplier\" />",
" </xpath>",
" <xpath expr=\"//field[@name='date_due']\" position=\"attributes\">",
" <attribute name=\"string\">Tgl Jatuh Tempo Inv</attribute>",
" </xpath>",
" </field>",
" </record>",
" </data>",
"</odoo>"
],
},
"Sequence Nomenclature": {
"prefix": "sequence nomenclature",
"body": [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>",
"<odoo>",
" <data noupdate=\"1\">",
" <record model=\"ir.sequence\" id=\"seq_${1:payment_request}\" >",
" <field name=\"name\">${3:Payment Request}</field>",
" <field name=\"code\">${2:payment.request}</field>",
" <field name=\"prefix\">PR/%(y)s/</field>",
" <field name=\"padding\">5</field>",
" <field name=\"company_id\" eval=\"False\" />",
" </record>",
" </data>",
"</odoo>",
],
},
"field attributes": {
"prefix": "attributes xpath",
"body": [
"<xpath expr=\"//field[@name='validity_date']\" position=\"attributes\">",
" <attribute name=\"invisible\">1</attribute>",
"</xpath>"
],
},
"nocreate many2one": {
"prefix": "nocreate noopen",
"body": [
"options=\"{'no_open': True, 'no_create': True}\"",
],
},
"domain": {
"prefix": "domain",
"body": [
"domain=\"[('${1:Nama Field}','${2:=}','${3:Kriteria}')]\""
],
},
"attrs": {
"prefix": "attrs readonly",
"body": [
"attrs=\"{'readonly': [('state', '=', 'confirm')]}\"",
],
},
"Messaging di Form View": {
"prefix": "form messaging",
"body": [
"<div class=\"oe_chatter\">",
" <field name=\"message_follower_ids\" widget=\"mail_followers\"/>",
" <field name=\"message_ids\" widget=\"mail_thread\"/>",
"</div>",
],
},
"Simple Field": {
"prefix": "field simple",
"body": [
"<field name=\"$1\"/>"
],
},
"Domain Date Complex": {
"prefix": "domain date complex",
"body": [
"<search string=\"Invoices Analysis\">",
" <filter string=\"This Year\" name=\"thisyear\"",
" domain=\"['|', ('date', '=', False), '&amp;',('date','&lt;=', time.strftime('%%Y-12-31')),('date','&gt;=',time.strftime('%%Y-01-01'))]\"/>",
" <filter string=\"This Month\" name=\"this_month\"",
" domain=\"[('date', '&gt;=', context_today().strftime('%%Y-%%m-01'))]\"/>",
" <filter string=\"Last Month\" name=\"last_month\"",
" domain=\"['&amp;', ('date', '&gt;=', (context_today() - relativedelta(months=1)).strftime('%%Y-%%m-01')), ('date', '&lt;', context_today().strftime('%%Y-%%m-01'))]\"/>",
"</search>",
],
},
"Button Form Kanan": {
"prefix": "button form kanan",
"body": [
"<div class=\"oe_button_box\" name=\"button_box\">",
" <button class=\"oe_stat_button\" type=\"object\" ",
" string=\"Journal\" ",
" name=\"payment_request_get_journal\" ",
" help=\"Melihat Journal Terkait\" ",
" icon=\"fa-paste\">",
" </button>",
"</div>",
],
},
"Simple Button": {
"prefix": "button simple",
"body": [
"<button name=\"${1:waiting_to_post}\" string=\"${2:Approve}\"",
" states=\"waiting\"",
" type=\"object\" class=\"oe_highlight\"/>",
],
},
"Basic Structure": {
"prefix": "basic structure",
"body": [
"<?xml version=\"1.0\" encoding=\"utf-8\"?>",
"<odoo>",
" <data>",
" <menuitem id=\"dev_cost_main\" name=\"Dev Cost\" sequence=\"200\"/>",
"",
" <menuitem id=\"dev_cost_menu\" parent=\"dev_cost_main\" name=\"Dev Cost\" sequence=\"10\"/>",
" </data>",
"</odoo>"
],
},
"menuitem": {
"prefix": "menuitem",
"body": [
"<menuitem id=\"dev_cost_menu\" parent=\"dev_cost_main\" name=\"Dev Cost\" sequence=\"10\"/>",
],
},
"handle": {
"prefix": "handle",
"body": [
"<field name=\"sequence\" widget=\"handle\"/>"
],
},
"tree_view_ref": {
"prefix": "tree_view_ref",
"body": [
"context=\"{'tree_view_ref': 'account.invoice_tree', 'form_view_ref': 'account.invoice_form'}\"",
],
},
"title": {
"prefix": "title",
"body": [
"<div class=\"oe_title\">",
" <label string=\"Payment Request\"/>",
" <h1>",
" <field name=\"name\" readonly=\"1\"/>",
" </h1>",
"</div>",
],
},
"button sebelah field": {
"prefix": "button sebelah field",
"body": [
"<group>",
" <label for=\"partner_ids\"/>",
" <div class=\"o_row\">",
" <field name=\"partner_ids\" widget=\"many2many_tags\"",
" readonly=\"1\" nolabel=\"1\"",
" />",
" <button name=\"update_partner\" string=\"Update\" type=\"object\"",
" help=\"-\"",
" class=\"oe_inline fa fa-arrow-right oe_link\"/>",
" </div>",
"</group>",
],
},
"Priority sequence": {
"prefix": "Priority sequence",
"body": [
"<field name=\"priority\">30</field>"
],
},
"Search View": {
"prefix": "Search View",
"body": [
"<!-- Search view for the menuitem -->",
"<record id=\"${1:sale_order_line}_search\" model=\"ir.ui.view\">",
"<field name=\"name\">${2:sale.order.line}.search</field>",
" <field name=\"model\">${2:sale.order.line}</field>",
" <field name=\"arch\" type=\"xml\">",
" <search>",
" <field name=\"name\"/>",
" <field name=\"partner_id\" filter_domain=\"[('partner_id','child_of',self)]\"/>",
" <filter string=\"Closed\" domain=\"[('state','=', 'close')]\" help=\"Assets in closed state\"/>",
" <group expand=\"0\" string=\"Group By...\">",
" <filter string=\"Month\" domain=\"[]\" context=\"{'group_by':'date'}\"/>",
" <filter string=\"Category\" domain=\"[]\" context=\"{'group_by':'category_id'}\"/>",
" </group>",
" </search>",
" </field>",
"</record>",
],
},
"Page and Field": {
"prefix": "Page and Field",
"body": [
"<page string=\"$1\">",
" <field name=\"$2\"/>",
"</page>"
],
},
"Notebook and page": {
"prefix": "notebook",
"body": [
"<notebook>",
" <page string=\"$2\">",
" <field name=\"$1\"/>",
" </page>",
"</notebook>"
],
},
"Button Header": {
"prefix": "button header",
"body": [
"<button name=\"${1:get_post}\" string=\"${2:Post}\" type=\"object\" />"
],
},
"Force Save": {
"prefix": "force save",
"body": [
"force_save=\"1\" readonly=\"1\"",
],
},
"Button Inline": {
"prefix": "button Inline",
"body": [
"<button name=\"${1:get_post}\" string=\"${2:Post}\" type=\"object\"",
" class=\"oe_inline fa fa-arrow-right oe_link\"/>"
],
},
"Readonly": {
"prefix": "readonly 1",
"body": [
"readonly=\"1\""
],
},
"invisible simple": {
"prefix": "invisible simple",
"body": [
"invisible=\"1\""
],
},
"invisible complex": {
"prefix": "invisible complex",
"body": [
"attrs=\"{'invisible':[('payment_request_id','=',False)]}\""
],
},
"statusbar": {
"prefix": "statusbar",
"body": [
"<field name=\"state\" widget=\"statusbar\" statusbar_visible=\"draft,open\"/>",
],
},
"Wizard": {
"prefix": "wizard",
"body": [
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
"<odoo>",
" <data>",
" <record id=\"$1_wizard\" model=\"ir.ui.view\" >",
" <field name=\"name\">$2.wizard</field>",
" <field name=\"model\">$2.wizard</field>",
" <field name=\"arch\" type=\"xml\">",
" <form>",
" <div style=\"white-space: pre-line;\">",
" <p><h5>Sistem akan men-update data dari dokumen faktur pajak yang dipilih.</h5>",
" Fitur ini bisa digunakan untuk keperluan sbb. :",
" 1. Adanya perubahan Alamat PKP dari Perusahaan",
" 2. Adanya perubahan <b>Alamat Pajak</b> dari Customer</p>",
" </div>",
" <group>",
" <group>",
" <field name=\"name\"/>",
" </group>",
" <group>",
" </group>",
" </group>",
" <footer>",
" <!-- <button type=\"object\" name=\"process_wizard\" string=\"Process\" class=\"oe_highlight\"/> -->",
" or",
" <button string=\"Cancel\" class=\"oe_link\" special=\"cancel\" />",
" </footer>",
" </form>",
" </field>",
" </record>",
" <act_window",
" id=\"action_$1_wizard\"",
" name=\"Confirm\"",
" res_model=\"$2.wizard\"",
" src_model=\"${3:nama objek yg muncul di list view}\"",
" view_mode=\"form\"",
" multi=\"True\"",
" target=\"new\"",
" key2=\"client_action_multi\"",
" />",
" </data>",
"</odoo>"
],
},
"Action Domain": {
"prefix": "ir_action_window dengan domain",
"body": [
"<record id=\"$1_action\" model=\"ir.actions.act_window\">",
" <field name=\"name\">$3</field>",
" <field name=\"res_model\">$2</field>",
" <field name=\"view_mode\">tree,form</field>",
" <field name=\"priority\">1</field>",
" <field name=\"domain\">[('name', '=', 'prepaid_revenue')]</field>",
" <!-- <field name=\"domain\">[('kasir_session_id', '!=', False)]</field> -->",
" <!-- <field name=\"domain\">[('kasir_session_id', '=', False), ('type', 'in', ['out_invoice'])]</field> -->",
" <field name=\"context\">{}</field>",
" <field name=\"view_ids\" eval=\"[(5, 0, 0),",
" (0, 0, {'view_mode': 'tree', 'view_id': ref('account.invoice_tree')}),",
" (0, 0, {'view_mode': 'form', 'view_id': ref('account.invoice_form')})]\"/>",
" <field name=\"help\" type=\"html\">",
" <p class=\"oe_view_nocontent_create\">",
" Click to start preparing a new prepaid revenue.",
" </p><p>",
" This view can be used by accountants in order to collect information about prepaid revenues based on start date and end date. It then allows to generate the corresponding cutoff journal entry in one click.",
" </p>",
" </field>",
"</record>",
],
},
"One2many tree After": {
"prefix": "one2many tree after",
"body": [
"<xpath expr=\"/form/sheet/notebook/page[1]/field[@name='order_line']/tree/field[@name='discount']\" position=\"after\">",
" <field name=\"diskon_input\"/>",
"</xpath>"
],
},
"MenuItem":{
"prefix": "_menu_item",
"body":[
"<?xml version='1.0' encoding='UTF-8'?>",
"<odoo>",
" <data>",
" <menuitem id='${1:example_orm}_main' name='${3:Example ORM}' sequence='1'/>",
" <menuitem id='${2:example_orm}'_menu",
" parent='${1:example_orm}_main' name='${4:Example ORM}'/>",
" </data>",
"</odoo>"
],
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment