Skip to content

Commit

Permalink
Merge pull request #5 from akretion/refactor-xml
Browse files Browse the repository at this point in the history
Update snippet
  • Loading branch information
sebastienbeau authored Oct 28, 2023
2 parents 25c88c9 + f90c5fb commit 11c85d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
41 changes: 14 additions & 27 deletions UltiSnips/python.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@ snippet module
"name": "${1:Module name}",
"summary": "${2:Module summary}",
"version": "${3:14.0}.1.0.0",
"development_status": "Alpha",
"category": "${4:Uncategorized}",
"website": "${5:www.akretion.com}",
"author": "${6: Akretion}",
"license": "AGPL-3",
"application": False,
"installable": True,
"external_dependencies": {
"python": [],
"bin": [],
Expand All @@ -81,8 +80,6 @@ snippet module
],
"demo": [${9}
],
"qweb": [${10}
]
}
endsnippet

Expand Down Expand Up @@ -289,42 +286,32 @@ ${3:Priority}),
#
endsnippet

snippet func "def search"
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
"""
${1:Comment}
"""
if context is None:
context = {}

res = super(${2:ClassName}, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
${3}
snippet fsearch "def search"
def search(self, args, offset=0, limit=None, order=None, count=False):
res = super().search(args, offset=offset, limit=limit, order=order, count=count)
return res
endsnippet

snippet func "def read"
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
if context is None:
context = {}
${1}
res = super(${2:ClassName}, self).read(cr, uid, ids, fields, context=context)
${3}
snippet fread "def read"
def read(self, fields=None, load='_classic_read'):
res = super().read(fields=fields, load=load)
return res
endsnippet

snippet fcreate "def create"
def create(self, vals):
@api.model_create_multi
def create(self, list_vals):
${1}
record = super(${2:ClassName}, self).create(vals)
${3}
return record
records = super().create(list_vals)
${2}
return records
endsnippet

snippet fwrite "def write"
def write(self, vals):
${1}
res = super(${2:ClassName}, self).write(vals)
${3}
res = super().write(vals)
${2}
return res
endsnippet

Expand Down
4 changes: 2 additions & 2 deletions UltiSnips/xml.snippets
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ snippet view_tfa "both (tree, form) + Action + Menu"
</field>
</record>

<record model="ir.actions.act_window" id="act_open_`!p snip.rv=format_snake(t[1])`_action">
<record model="ir.actions.act_window" id="`!p snip.rv=format_snake(t[1])`_action">
<field name="name">$2</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">$1</field>
Expand Down Expand Up @@ -464,7 +464,7 @@ snippet view_tfsa "both (tree, form, search) + Action + Menu"
endsnippet

snippet act_window
<record model="ir.actions.act_window" id="act_open_`!p snip.rv=format_snake(t[1])`_action">
<record model="ir.actions.act_window" id="`!p snip.rv=format_snake(t[1])`_action">
<field name="name">${2:Name}</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">${1:model_name}</field>
Expand Down

0 comments on commit 11c85d7

Please sign in to comment.