Added ir.model.access in manifest

This commit is contained in:
Fabien Meghazi 2014-05-30 10:45:57 +02:00
parent 36485190ac
commit 7f984dd6ef
5 changed files with 15 additions and 8 deletions

View File

@ -64,7 +64,7 @@ class Scaffold(Command):
logging.disable(logging.CRITICAL) logging.disable(logging.CRITICAL)
scaffold = ScaffoldModule(dest) scaffold = ScaffoldModule(dest)
if args.model: if args.model:
scaffold.add_model(args.model) scaffold.add_model(snake(args.model))
if args.controller: if args.controller:
scaffold.add_controller(args.controller) scaffold.add_controller(args.controller)
if args.web: if args.web:
@ -99,6 +99,7 @@ class ScaffoldModule(object):
self.render_file('models.jinja2', model_file, model=model) self.render_file('models.jinja2', model_file, model=model)
self.render_file('ir.model.access.jinja2', self.path('security', 'ir.model.access.csv'), self.render_file('ir.model.access.jinja2', self.path('security', 'ir.model.access.csv'),
if_exists='append', model=model) if_exists='append', model=model)
self.append_manifest_list('data', 'security/ir.model.access.csv')
def add_controller(self, controller): def add_controller(self, controller):
controller_module = snake(controller) controller_module = snake(controller)
@ -135,6 +136,7 @@ class ScaffoldModule(object):
return manifest return manifest
def append_manifest_list(self, key, value, unique=True): def append_manifest_list(self, key, value, unique=True):
# TODO: append value without altering serialized formatting
vals = self.get_manifest(key, []) vals = self.get_manifest(key, [])
if unique and value in vals: if unique and value in vals:
return return

View File

@ -1,6 +1,6 @@
{% if file_created -%}id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink{%- endif %} {% if file_created -%}id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink{%- endif %}
{% if model -%} {% if model -%}
access_{{ module_name|snake }}_{{ model|snake }},{{- '' -}} access_{{ module_name }}_{{ model }},{{- '' -}}
access_{{ module_name|snake }}_{{ model|snake }},{{- '' -}} access_{{ module_name }}_{{ model }},{{- '' -}}
model_{{ module_name|snake }}_{{ model|snake }},,1,0,0,0 model_{{ module_name }}_{{ model }},,1,0,0,0
{%- endif %} {%- endif %}

View File

@ -2,7 +2,7 @@
from openerp.osv import orm, fields from openerp.osv import orm, fields
class {{ model }}(orm.Model): class {{ model }}(orm.Model):
_name = "{{ module_name|snake }}.{{ model|snake }}" _name = "{{ module_name }}.{{ model }}"
_columns = { _columns = {
'name': fields.char(), 'name': fields.char(),

View File

@ -1,4 +1,4 @@
@charset "utf-8"; @charset "utf-8";
.openerp .oe_{{ module_name|snake }} { .openerp .oe_{{ module_name }} {
background: white; background: white;
} }

View File

@ -1,9 +1,14 @@
openerp.{{ module_name|snake }} = function (instance) { openerp.{{ module_name }} = function (instance) {
var _t = instance.web._t, var _t = instance.web._t,
_lt = instance.web._lt; _lt = instance.web._lt;
var QWeb = instance.web.qweb; var QWeb = instance.web.qweb;
instance.{{ module_name|snake }}.MyClientAction = null; // TODO: scaffold client action instance.web.WebClient.include({
show_application: function () {
console.log("Show application");
return this._super.apply(this, arguments);
};
});
}; };