forked from OpenCode/geany-openerp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnippets.conf
133 lines (109 loc) · 10 KB
/
snippets.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Geany's snippets configuration file
#
# use \n or %newline% for a new line (it will be replaced by the used EOL char(s) - LF, CR/LF, CR).
# use \t or %ws% for an indentation step, it will be replaced according to the current document's indent mode.
# use \s to force whitespace at beginning or end of a value ('key= value' won't work, use 'key=\svalue').
# use %key% for all keys defined in the [Special] section.
# use %cursor% to define where the cursor should be placed after completion. You can define multiple
# %cursor% wildcards and use the "Move cursor in snippet" to jump to the next defined cursor
# position in the completed snippet.
# You can define a section for each supported filetype to overwrite default settings, the section
# name must match exactly the internal filetype name, run 'geany --ft-names' for a full list.
#
# Additionally, you can use most of the template wildcards like {developer}, {command:...},
# or {date} in the snippets.
# See the documentation for details.
# For a list of available filetype names, execute:
# geany --ft-names
# Default is used for all filetypes and keys can be overwritten by [filetype] sections
[Default]
if=if (%cursor%)%block_cursor%
else=else%block_cursor%
for=for (i = 0; i < %cursor%; i++)%block_cursor%
while=while (%cursor%)%block_cursor%
do=do\n{\n\t%cursor%\n} while (%cursor%)\n%cursor%
switch=switch (%cursor%)%brace_open%case %cursor%:\n\t\t%cursor%\n\t\tbreak;\n\tdefault:\n\t\t%cursor%\n%brace_close%%cursor%
try=try%block%\ncatch (%cursor%)%block_cursor%
# special keys to be used in other snippets, cannot be used "standalone"
# can be used by %key%, e.g. %brace_open%
# nesting of special keys is not supported (e.g. brace_open=\n{\n%brace_close% won't work)
# key "wordchars" is very special, it defines the word delimiting characters when looking for
# a word to auto complete, leave commented to use the default wordchars
[Special]
brace_open=\n{\n\t
brace_close=}\n
block=\n{\n\t%cursor%\n}
block_cursor=\n{\n\t%cursor%\n}\n%cursor%
#wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
# Optional keybindings to insert snippets
# Note: these can be overridden by Geany's configurable keybindings
[Keybindings]
#for=<Ctrl>7
[Python]
for=for i in xrange(%cursor%):\n\t
if=if %cursor%:\n\t
elif=elif %cursor%:\n\t
else=else:\n\t
while=while %cursor%:\n\t
try=try:\n\t%cursor%\nexcept Exception, ex:\n\t
with=with %cursor%:\n\t
#List comprehension l = lc<tab>
lc=[i**2 for i in range(10) if i%2==0]
# with walrus
walrus=discount = 0.0\nif (mo := re.search(r'(\d+)% discount', "10% discount")):\n\tdiscount = float(mo.group(1)) / 100.0\n\n
filtered=records.filtered(lambda r: r.company_id == user.company_id)
with_=with_user(user)\nwith_company(company)\nwith_env(env)\nwith_context(context)\n
# =====================================================================
# START OPENERP PYTHON SNIPPETS LIST
from=from odoo import api, fields, models, _\nfrom odoo.exceptions import UserError\n\nimport logging\n\n_logger = logging.getLogger(__name__)\n\n
class=class %cursor%(models.Model):\n\n\t_name = ""\n\t_description = ""\n
class_in=class %cursor%(models.Model):\n\t_inherit = ""\n\n
char=fields.Char(string='%cursor%', size=64, trim=True, )
integ=fields.Integer(string='%cursor%')
bool=fields.Boolean(string='%cursor%')
float=fields.Float(string='%cursor%')
html=fields.Html(string='%cursor%')
text=fields.Text(string='%cursor%')
date=fields.Date(string='%cursor%') # fields.date.add|context_today|end_of|start_of|substract|to_date|to_string|today
datetime=fields.Datetime(string='%cursor%') # fields.datetime.add|context_timestamp|end_of|now|start_of|substract|to_datetime|to_string|today
select=fields.Selection(selection=[('%cursor%','string'),('value','string')],string='')
o2m=fields.One2many(comodel_name='%cursor%',inverse_name='',string="",help="") # domain|context|auto_join|limit
m2o=fields.Many2one(comodel_name='%cursor%',string="",help="") # domain|context|ondelete="'set null', 'restrict', 'cascade'"|auto_join|delegate
m2m=fields.Many2many(comodel_name='%cursor%',string='%cursor%',help="") # relation|column1|column2
super=super(class_name%cursor%,self).function(cr, uid, ids, context)
raise=raise Warning(_('%cursor%'), _(''))
search=self.env['model.model%cursor%'].search([('id','=',var)],offset=0,limit=1,order='name',count=False)
browse=self.env['model.model%cursor%'].browse(id)
create=self.env['model.model%cursor%'].create(self,{})
write=self.env['model.model%cursor%'].%cursor%write(self,{})
unlink=self.env['model.model%cursor%'].search([]).unlink()
[email protected]\ndef create(self,val):\n\tres = super(class_name%cursor%,self).create(val)\n\treturn res
log=_logger.warning(f"{%cursor%=}")
manifest={\n\t'name': '',\n\t'version': '',\n\t'category': '',\n\t'description': """""",\n\t'author': '',\n\t'website': '',\n\t'license': 'AGPL-3',\n\t"depends" : [],\n\t"init_xml" : [],\n\t"update_xml" : [],\n\t"demo_xml" : [],\n\t"active": False,\n\t"installable": True\n}
# END OPENERP PYTHON SNIPPETS LIST
# =====================================================================
# =====================================================================
# START OPENERP XML SNIPPETS LIST
[XML]
field=<field name="%cursor%" />
tree=<record id="%cursor%" model="ir.ui.view">\n\t<field name="name"></field>\n\t<field name="model">model.model</field>\n\t<field name="type">tree</field>\n\t<field name="arch" type="xml">\n\t\t<tree string="">\n\t\t\t<field name="name"/>\n\t\t</tree>\n\t</field>\n</record>
tree_in=<record id="" model="ir.ui.view">\n\t<field name="name"></field>\n\t<field name="model"></field>\n\t<field name="inherit_id" ref="%cursor%"/>\n\t<field name="arch" type="xml">\n\t\t<field name="name" optional="show" />\n\t</field>\n</record>
form=<record id="%cursor%" model="ir.ui.view">\n\t<field name="name">model.form</field>\n\t<field name="model">model</field>\n\t<field name="arch" type="xml">\n\t\t<form string="" class="o_form_">\n\t\t<header>\n\t\t<button name="" string="" type="object" class="oe_highlight" /><button name="%(portal.portal_share_action)d" string="Share" type="action" class="oe_highlight oe_read_only"/><field name="stage_id" widget="statusbar" options="{'clickable': '1', 'fold_field': 'fold'}"/></header><sheet string=""> <div class="oe_button_box" name="button_box"/>\n\t\t<div class="oe_title pr-0">\n\t\t<h1 class="d-flex flex-row justify-content-between">\n\t\t<field name="name" class="text-truncate" placeholder="XXX Title..."/>\n\t\t <field name="kanban_state" widget="state_selection" class="ml-auto"/></h1>\n\t\t</div>\n\t\t<group>\n\t\t\t<group>\n\t\t\t</group>\n\t\t\n\t\t\t<group>\n\t\t\t</group>\n\t\t</group>\n\t\t</sheet>\n\t<div class="oe_chatter">\n\t<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>\n\t<field name="activity_ids" widget="mail_activity"/>\n\t<field name="message_ids" widget="mail_thread"/>\n\t</div>\n</form>\n</field>\n</record>
form_in=<record id="" model="ir.ui.view">\n\t<field name="name">NAME</field>\n\t<field name="model"></field>\n\t<field name="inherit_id" ref=""/>\n\t<field name="arch" type="xml">\n\t\t<field name="name" />\n\t</field>\n</record>
xpath=<xpath expr="%cursor%" position="%cursor%">\n\t\n</xpath>
menu=<menuitem\n\tid="%cursor%"\n\tname=""\n\tstring=""\n\taction=""\n\tparent=""/>
search=<record id="%cursor%" model="ir.ui.view">\n\t<field name="name"></field>\n\t<field name="model"></field>\n\t<field name="type">search</field>\n\t<field name="arch" type="xml">\n\t\t<search string="">\n\t\t\t<field name="name" string="Lead" filter_domain="['|','|','|',('partner_name', 'ilike', self),('email_from', 'ilike', self), ('contact_name', 'ilike', self), ('name', 'ilike', self)]" /><separator />\n\t\t\t<filter string="My Leads" name="assigned_to_me" domain="[('user_id', '=', uid)]" help="Leads that are assigned to me" />\n\t\t\t<group expand="0" string="Group By">\n\t\t\t\t<filter string="Salesperson" name="salesperson" context="{'group_by':'user_id'}" />\n\t\t\t</group>\n\t\t</search>\n\t</field>\n</record>
search_in=<record id="%cursor%" model="ir.ui.view">\n\t<field name="name"></field>\n\t<field name="model"></field>\n\t<field name="inherit_id" ref=""/>\n\t<field name="arch" type="xml">\n\t\t<field name="X" position="after"><field name="Y" /></field>\n\t\t<filter name="X" position="after"><filter name="Y" /></filter>\n\t\t<xpath expr="//group" position="inside"><filter string="Salesperson" name="salesperson" context="{'group_by':'user_id'}" /></xpath>\n\t</field>\n</record>
action=<record id="%cursor%" model="ir.actions.act_window">\n\t<field name="name"></field>\n\t<field name="type">ir.actions.act_window</field>\n\t<field name="res_model"></field>\n\t<field name="view_type">form</field>\n\t<field name="view_mode">tree,form</field>\n\t<field name="view_id" ref=""/>\n\t<field name="help"></field>\n</record>
button=<button name="%cursor%" states="" string="" type="object" icon=""/>
button_action=<button name="%(%cursor%)d" states="" string="" type="action" icon=""/>
notebook=<notebook>\n\t<page string="%cursor%">\n\t</page>\n</notebook>
filter=<filter domain="[('%cursor%', '', '')]" icon="" string="" help=""/>
group_by=<filter string="%cursor%" context="{'group_by':'%cursor%'}"/>
context=<field name="context">{'%cursor%':}</field>
domain=<field name="domain">[('%cursor%','','')]</field>
attrs=attrs="{'invisible':[('%cursor%','','')],'readonly':[('','','')],'required':[('','','')]}"
cron=<record id="%cursor%" model="ir.cron">\n\t<field name="name">Name of Cron-job</field>\n\t<field name="model_id" ref="project.model_project_project"/>\n\t<field name="state">code</field>\n\t<field name="code">model.cron_job()</field>\n\t<field name="interval_type">days</field>\n\t<field name="numbercall">-1</field>\n</record>
server=<record id="ir_actions_server_project_sample" model="ir.actions.server">\n\t<field name="name">My action</field>\n\t<field name="model_id" ref="project.model_project_project"/>\n\t<field name="state">code</field>\n\t<field name="code">action = model.my_action()</field>\n</record>
# END OPENERP XML SNIPPETS LIST
# =====================================================================