Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Coopdevs OCB mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coopdevs
Odoo
Coopdevs OCB mirror
Commits
729258ed
Commit
729258ed
authored
10 years ago
by
Xavier Morel
Browse files
Options
Downloads
Patches
Plain Diff
[IMP] scaffold: use the module name for the first controller and model
parent
6dcf6bb6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
openerpcommand/scaffold.py
+12
-5
12 additions, 5 deletions
openerpcommand/scaffold.py
with
12 additions
and
5 deletions
openerpcommand/scaffold.py
+
12
−
5
View file @
729258ed
...
...
@@ -17,8 +17,15 @@ def run(args):
env
.
filters
[
'
snake
'
]
=
snake
args
.
dependency
=
'
web
'
if
args
.
controller
else
'
base
'
module_name
=
snake
(
args
.
module
)
module
=
functools
.
partial
(
os
.
path
.
join
,
args
.
modules_dir
,
snake
(
args
.
module
))
os
.
path
.
join
,
args
.
modules_dir
,
module_name
)
if
args
.
controller
is
True
:
args
.
controller
=
module_name
if
args
.
model
is
True
:
args
.
model
=
module_name
if
os
.
path
.
exists
(
module
()):
message
=
"
The path `%s` already exists.
"
%
module
()
...
...
@@ -53,13 +60,13 @@ def add_parser(subparsers):
controller
=
parser
.
add_mutually_exclusive_group
()
controller
.
add_argument
(
'
--controller
'
,
type
=
identifier
,
help
=
"
The name of the controller to generate
(default: %(default)s)
"
)
help
=
"
The name of the controller to generate
"
)
controller
.
add_argument
(
'
--no-controller
'
,
dest
=
'
controller
'
,
action
=
'
store_const
'
,
const
=
None
,
help
=
"
Do not generate a controller
"
)
model
=
parser
.
add_mutually_exclusive_group
()
model
.
add_argument
(
'
--model
'
,
type
=
identifier
,
help
=
"
The name of the model to generate
(default: %(default)s)
"
)
help
=
"
The name of the model to generate
"
)
model
.
add_argument
(
'
--no-model
'
,
dest
=
'
model
'
,
action
=
'
store_const
'
,
const
=
None
,
help
=
"
Do not generate a model
"
)
...
...
@@ -73,13 +80,13 @@ def add_parser(subparsers):
help
=
"
Website of the module author
"
)
mod
.
add_argument
(
'
--category
'
,
default
=
"
Uncategorized
"
,
help
=
"
Broad categories to which the module belongs, used for
"
"
filtering within OpenERP and on apps.openerp.com.
"
"
filtering within OpenERP and on apps.openerp.com.
"
"
Defaults to %(default)s
"
)
mod
.
add_argument
(
'
--summary
'
,
default
=
""
,
help
=
"
Short (1 phrase/line) summary of the module
'
s purpose, used as
"
"
subtitle on modules listing or apps.openerp.com
"
)
parser
.
set_defaults
(
run
=
run
,
controller
=
'
my_controller
'
,
model
=
'
my_model
'
)
parser
.
set_defaults
(
run
=
run
,
controller
=
True
,
model
=
True
)
def
snake
(
s
):
"""
snake cases ``s``
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment