ooor 1.6.5 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.md +131 -88
- data/bin/ooor +4 -2
- data/lib/app/helpers/core_helpers.rb +137 -0
- data/lib/app/models/base64.rb +14 -25
- data/lib/app/models/common_service.rb +3 -15
- data/lib/app/models/db_service.rb +6 -17
- data/lib/app/models/ooor_client.rb +3 -15
- data/lib/app/models/open_object_resource.rb +40 -41
- data/lib/app/models/relation.rb +4 -16
- data/lib/app/models/serialization.rb +5 -0
- data/lib/app/models/type_casting.rb +8 -3
- data/lib/app/models/uml.rb +26 -35
- data/lib/app/ui/action_window.rb +13 -19
- data/lib/app/ui/client_base.rb +4 -21
- data/lib/app/ui/form_model.rb +4 -15
- data/lib/ooor.rb +50 -46
- data/spec/ooor_spec.rb +49 -29
- metadata +38 -37
- data/agpl-3.0-licence.txt +0 -661
- data/lib/app/ui/menu.rb +0 -34
data/lib/app/models/base64.rb
CHANGED
@@ -1,31 +1,20 @@
|
|
1
|
-
# OOOR:
|
2
|
-
# Copyright (C) 2009-
|
1
|
+
# OOOR: OpenObject On Ruby
|
2
|
+
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
|
3
3
|
# Author: Raphaël Valyi
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
# published by the Free Software Foundation, either version 3 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Affero General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Affero General Public License
|
16
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
4
|
+
# Licensed under the MIT license, see MIT-LICENSE file
|
5
|
+
|
6
|
+
autoload :Base64, 'base64'
|
17
7
|
|
18
|
-
require 'base64'
|
19
8
|
module Base64
|
20
9
|
def serialize_binary_from_file(binary_path)
|
21
|
-
|
22
|
-
|
10
|
+
return Base64.encode64(File.read(binary_path))
|
11
|
+
end
|
23
12
|
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
def serialize_binary_from_content(content)
|
14
|
+
return Base64.encode64(content)
|
15
|
+
end
|
27
16
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
17
|
+
def unserialize_binary(content)
|
18
|
+
return Base64.decode64(content)
|
19
|
+
end
|
20
|
+
end
|
@@ -1,19 +1,7 @@
|
|
1
|
-
# OOOR:
|
2
|
-
# Copyright (C) 2009-
|
1
|
+
# OOOR: OpenObject On Ruby
|
2
|
+
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
|
3
3
|
# Author: Raphaël Valyi
|
4
|
-
#
|
5
|
-
# This program is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU Affero General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Affero General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Affero General Public License
|
16
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
4
|
+
# Licensed under the MIT license, see MIT-LICENSE file
|
17
5
|
|
18
6
|
#proxies all 'common' class of OpenERP server/bin/service/web_service.py properly
|
19
7
|
module Ooor
|
@@ -1,19 +1,7 @@
|
|
1
|
-
# OOOR:
|
2
|
-
# Copyright (C) 2009-
|
1
|
+
# OOOR: OpenObject On Ruby
|
2
|
+
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
|
3
3
|
# Author: Raphaël Valyi
|
4
|
-
#
|
5
|
-
# This program is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU Affero General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Affero General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Affero General Public License
|
16
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
4
|
+
# Licensed under the MIT license, see MIT-LICENSE file
|
17
5
|
|
18
6
|
#proxies all 'db' class of OpenERP server/bin/service/web_service.py properly
|
19
7
|
module Ooor
|
@@ -23,7 +11,8 @@ module Ooor
|
|
23
11
|
@config[:database] = db_name
|
24
12
|
@config[:username] = 'admin'
|
25
13
|
@config[:passowrd] = user_password
|
26
|
-
|
14
|
+
sleep(3)
|
15
|
+
while get_progress('admin', process_id)[0] != 1
|
27
16
|
@logger.info "..."
|
28
17
|
sleep(0.5)
|
29
18
|
end
|
@@ -43,4 +32,4 @@ module Ooor
|
|
43
32
|
end
|
44
33
|
end
|
45
34
|
end
|
46
|
-
end
|
35
|
+
end
|
@@ -1,19 +1,7 @@
|
|
1
|
-
# OOOR:
|
2
|
-
# Copyright (C) 2009-
|
1
|
+
# OOOR: OpenObject On Ruby
|
2
|
+
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
|
3
3
|
# Author: Raphaël Valyi
|
4
|
-
#
|
5
|
-
# This program is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU Affero General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Affero General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Affero General Public License
|
16
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
4
|
+
# Licensed under the MIT license, see MIT-LICENSE file
|
17
5
|
|
18
6
|
require 'xmlrpc/client'
|
19
7
|
|
@@ -1,19 +1,7 @@
|
|
1
|
-
# OOOR:
|
2
|
-
# Copyright (C) 2009-
|
1
|
+
# OOOR: OpenObject On Ruby
|
2
|
+
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
|
3
3
|
# Author: Raphaël Valyi
|
4
|
-
#
|
5
|
-
# This program is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU Affero General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Affero General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Affero General Public License
|
16
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
4
|
+
# Licensed under the MIT license, see MIT-LICENSE file
|
17
5
|
|
18
6
|
require 'rubygems'
|
19
7
|
require 'active_resource'
|
@@ -23,11 +11,12 @@ require 'app/models/type_casting'
|
|
23
11
|
require 'app/models/relation'
|
24
12
|
require 'app/models/serialization'
|
25
13
|
|
14
|
+
autoload :UML, 'app/models/uml'
|
15
|
+
|
26
16
|
module Ooor
|
27
17
|
class OpenObjectResource < ActiveResource::Base
|
28
18
|
#PREDEFINED_INHERITS = {'product.product' => 'product_tmpl_id'}
|
29
19
|
#include ActiveModel::Validations
|
30
|
-
include UML
|
31
20
|
include TypeCasting
|
32
21
|
include Serialization
|
33
22
|
|
@@ -39,6 +28,10 @@ module Ooor
|
|
39
28
|
:fields, :fields_defined, :many2one_associations, :one2many_associations, :many2many_associations, :polymorphic_m2o_associations, :associations_keys,
|
40
29
|
:database, :user_id, :scope_prefix, :ooor, :association
|
41
30
|
|
31
|
+
def print_uml(options={})
|
32
|
+
UML.print_uml([self], options)
|
33
|
+
end
|
34
|
+
|
42
35
|
def class_name_from_model_key(model_key=self.openerp_model)
|
43
36
|
model_key.split('.').collect {|name_part| name_part.capitalize}.join
|
44
37
|
end
|
@@ -159,7 +152,7 @@ module Ooor
|
|
159
152
|
|
160
153
|
def old_wizard_step(wizard_name, ids, step='init', wizard_id=nil, form={}, context={}, report_type='pdf')
|
161
154
|
context = @ooor.global_context.merge(context)
|
162
|
-
|
155
|
+
cast_map_to_openerp!(form)
|
163
156
|
unless wizard_id
|
164
157
|
logger.debug "OOOR RPC: 'create old_wizard_step' #{wizard_name}"
|
165
158
|
wizard_id = cast_answer_to_ruby!(@ooor.get_rpc_client((@database && @site || @ooor.base_url) + "/wizard").call("create", @database || @ooor.config[:database], @user_id || @ooor.config[:user_id], @password || @ooor.config[:password], wizard_name))
|
@@ -213,7 +206,19 @@ module Ooor
|
|
213
206
|
return nil
|
214
207
|
end
|
215
208
|
|
216
|
-
|
209
|
+
def find(*arguments)
|
210
|
+
scope = arguments.slice!(0)
|
211
|
+
options = arguments.slice!(0) || {}
|
212
|
+
case scope
|
213
|
+
when :all then find_every(options)
|
214
|
+
when :first then find_every(options.merge(:limit => 1)).first
|
215
|
+
when :last then find_every(options).last
|
216
|
+
when :one then find_one(options)
|
217
|
+
else find_single(scope, options)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
#******************** finders low level implementation ********************
|
217
222
|
private
|
218
223
|
|
219
224
|
def find_every(options)
|
@@ -250,7 +255,7 @@ module Ooor
|
|
250
255
|
record.each_pair do |k,v|
|
251
256
|
r[k.to_sym] = v
|
252
257
|
end
|
253
|
-
active_resources <<
|
258
|
+
active_resources << new(r, [], context, true)
|
254
259
|
end
|
255
260
|
unless is_collection
|
256
261
|
return active_resources[0]
|
@@ -258,13 +263,6 @@ module Ooor
|
|
258
263
|
return active_resources
|
259
264
|
end
|
260
265
|
|
261
|
-
#overriden because loading default fields is all the rage but we don't want them when reading a record
|
262
|
-
def instantiate_record(record, prefix_options = {}, context = {})
|
263
|
-
new(record, [], context, true).tap do |resource|
|
264
|
-
resource.prefix_options = prefix_options
|
265
|
-
end
|
266
|
-
end
|
267
|
-
|
268
266
|
end
|
269
267
|
|
270
268
|
self.name = "OpenObjectResource"
|
@@ -307,24 +305,12 @@ module Ooor
|
|
307
305
|
if self.class.associations_keys.index(skey) || value.is_a?(Array)
|
308
306
|
associations[skey] = value #the association because we want the method to load the association through method missing
|
309
307
|
else
|
310
|
-
|
311
|
-
when Hash
|
312
|
-
resource = find_or_create_resource_for(key) #TODO check!
|
313
|
-
@attributes[skey] = resource@attributes[skey].new(value)
|
314
|
-
else
|
315
|
-
@attributes[skey] = value
|
316
|
-
end
|
308
|
+
@attributes[skey] = value
|
317
309
|
end
|
318
310
|
end
|
319
311
|
self
|
320
312
|
end
|
321
313
|
|
322
|
-
def load_association(model_key, ids, *arguments)
|
323
|
-
options = arguments.extract_options!
|
324
|
-
related_class = self.class.const_get(model_key, object_session)
|
325
|
-
related_class.send :find, ids, :fields => options[:fields] || options[:only] || [], :context => options[:context] || object_session
|
326
|
-
end
|
327
|
-
|
328
314
|
def available_fields
|
329
315
|
msg = "\n*** AVAILABLE FIELDS ON OBJECT #{self.class.name} ARE: ***"
|
330
316
|
msg << "\n\n" << self.class.fields.sort {|a,b| a[1]['type']<=>b[1]['type']}.map {|i| "#{i[1]['type']} --- #{i[0]}"}.join("\n")
|
@@ -369,10 +355,11 @@ module Ooor
|
|
369
355
|
#compatible with the Rails way but also supports OpenERP context
|
370
356
|
def update(context={}, reload=true)
|
371
357
|
rpc_execute('write', [self.id], to_openerp_hash!, context)
|
372
|
-
|
358
|
+
reload_fields(context) if reload
|
373
359
|
@persisted = true
|
374
360
|
end
|
375
361
|
|
362
|
+
|
376
363
|
#compatible with the Rails way but also supports OpenERP context
|
377
364
|
def destroy(context={})
|
378
365
|
rpc_execute('unlink', [self.id], context)
|
@@ -399,7 +386,7 @@ module Ooor
|
|
399
386
|
#wrapper for OpenERP exec_workflow Business Process Management engine
|
400
387
|
def wkf_action(action, context={}, reload=true)
|
401
388
|
self.class.rpc_exec_workflow_with_all(object_db, object_uid, object_pass, self.class.openerp_model, action, self.id) #FIXME looks like OpenERP exec_workflow doesn't accept context but it might be a bug
|
402
|
-
|
389
|
+
reload_fields(context) if reload
|
403
390
|
end
|
404
391
|
|
405
392
|
def old_wizard_step(wizard_name, step='init', wizard_id=nil, form={}, context={})
|
@@ -471,5 +458,17 @@ module Ooor
|
|
471
458
|
self.class.get_report_data(report_name, [self.id], report_type, context)
|
472
459
|
end
|
473
460
|
|
461
|
+
private
|
462
|
+
|
463
|
+
def load_association(model_key, ids, *arguments)
|
464
|
+
options = arguments.extract_options!
|
465
|
+
related_class = self.class.const_get(model_key, object_session)
|
466
|
+
related_class.send :find, ids, :fields => options[:fields] || options[:only] || [], :context => options[:context] || object_session
|
467
|
+
end
|
468
|
+
|
469
|
+
def reload_fields(context)
|
470
|
+
records = self.class.find(self.id, :context => context, :fields => @attributes.keys)
|
471
|
+
reload_from_record!(records)
|
472
|
+
end
|
474
473
|
end
|
475
474
|
end
|
data/lib/app/models/relation.rb
CHANGED
@@ -1,19 +1,7 @@
|
|
1
|
-
# OOOR:
|
2
|
-
# Copyright (C) 2009-
|
1
|
+
# OOOR: OpenObject On Ruby
|
2
|
+
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
|
3
3
|
# Author: Raphaël Valyi
|
4
|
-
#
|
5
|
-
# This program is free software: you can redistribute it and/or modify
|
6
|
-
# it under the terms of the GNU Affero General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Affero General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Affero General Public License
|
16
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
4
|
+
# Licensed under the MIT license, see MIT-LICENSE file
|
17
5
|
|
18
6
|
#TODO chainability of where via scopes
|
19
7
|
#TODO include relations for single read
|
@@ -142,4 +130,4 @@ module Ooor
|
|
142
130
|
end
|
143
131
|
|
144
132
|
end
|
145
|
-
end
|
133
|
+
end
|
@@ -1,3 +1,8 @@
|
|
1
|
+
# OOOR: OpenObject On Ruby
|
2
|
+
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
|
3
|
+
# Author: Raphaël Valyi
|
4
|
+
# Licensed under the MIT license, see MIT-LICENSE file
|
5
|
+
|
1
6
|
module Ooor
|
2
7
|
module TypeCasting
|
3
8
|
|
@@ -37,9 +42,9 @@ module Ooor
|
|
37
42
|
elsif !v.is_a?(Integer) && !v.is_a?(Float) && v.is_a?(Numeric) && v.respond_to?(:to_f)
|
38
43
|
return v.to_f
|
39
44
|
elsif !v.is_a?(Numeric) && !v.is_a?(Integer) && v.respond_to?(:sec) && v.respond_to?(:year)#really ensure that's a datetime type
|
40
|
-
return "
|
45
|
+
return "%d-%02d-%02d %02d:%02d:%02d" % [v.year, v.month, v.day, v.hour, v.min, v.sec]
|
41
46
|
elsif !v.is_a?(Numeric) && !v.is_a?(Integer) && v.respond_to?(:day) && v.respond_to?(:year)#really ensure that's a date type
|
42
|
-
return "
|
47
|
+
return "%d-%02d-%02d" % [v.year, v.month, v.day]
|
43
48
|
elsif v == "false" #may happen with OOORBIT
|
44
49
|
return false
|
45
50
|
else
|
@@ -59,7 +64,7 @@ module Ooor
|
|
59
64
|
if self.fields[k] && v.is_a?(String) && !v.empty?
|
60
65
|
case self.fields[k]['type']
|
61
66
|
when 'datetime'
|
62
|
-
map[k] =
|
67
|
+
map[k] = DateTime.parse(v)
|
63
68
|
when 'date'
|
64
69
|
map[k] = Date.parse(v)
|
65
70
|
end
|
data/lib/app/models/uml.rb
CHANGED
@@ -1,31 +1,18 @@
|
|
1
|
-
# OOOR:
|
2
|
-
# Copyright (C) 2009-
|
1
|
+
# OOOR: OpenObject On Ruby
|
2
|
+
# Copyright (C) 2009-2012 Akretion LTDA (<http://www.akretion.com>).
|
3
3
|
# Author: Raphaël Valyi
|
4
|
-
#
|
5
|
-
|
6
|
-
# it under the terms of the GNU Affero General Public License as
|
7
|
-
# published by the Free Software Foundation, either version 3 of the
|
8
|
-
# License, or (at your option) any later version.
|
9
|
-
#
|
10
|
-
# This program is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
-
# GNU Affero General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU Affero General Public License
|
16
|
-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
4
|
+
# Licensed under the MIT license, see MIT-LICENSE file
|
5
|
+
|
17
6
|
module Ooor
|
18
7
|
module UML
|
19
8
|
#usage: UML.print_uml or with options: UML.print_uml(:all, :detailed) or MyOpenObjectResource.print_uml or UML.print_uml([list_of_classes], :all, :detailed)
|
20
9
|
|
21
|
-
def
|
22
|
-
|
23
|
-
def print_uml(*options)
|
10
|
+
def print_uml(options={})
|
24
11
|
ooor = self.class.ooor
|
25
12
|
UML.print_uml(ooor.config[:models] && ooor.loaded_models.select {|model| ooor.config[:models].index(model.openerp_model)} || ooor.loaded_models, options)
|
26
13
|
end
|
27
14
|
|
28
|
-
def serve_uml(
|
15
|
+
def serve_uml(options={})#TODO port
|
29
16
|
ooor = self
|
30
17
|
require 'sinatra'
|
31
18
|
set :public, File.dirname(__FILE__) + '/../../'
|
@@ -44,12 +31,6 @@ module Ooor
|
|
44
31
|
Sinatra::Application.run!
|
45
32
|
end
|
46
33
|
|
47
|
-
module ClassMethods
|
48
|
-
def print_uml(*options)
|
49
|
-
UML.print_uml([self], options)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
34
|
def self.display_fields(clazz)
|
54
35
|
s = ""
|
55
36
|
clazz.reload_fields_definition if clazz.fields.empty?
|
@@ -58,12 +39,20 @@ module Ooor
|
|
58
39
|
s
|
59
40
|
end
|
60
41
|
|
61
|
-
def self.print_uml(classes,
|
62
|
-
options = options[0] if options[0].is_a?(Array)
|
63
|
-
local = (options.index(:all) == nil)
|
64
|
-
detailed = (options.index(:detailed) != nil) || local && (options.index(:nodetail) == nil)
|
42
|
+
def self.print_uml(classes, options={})
|
43
|
+
# options = options[0] if options[0].is_a?(Array)
|
44
|
+
# local = (options.index(:all) == nil)
|
45
|
+
# detailed = (options.index(:detailed) != nil) || local && (options.index(:nodetail) == nil)
|
46
|
+
return if classes.empty?
|
47
|
+
local = true
|
48
|
+
detailed = true
|
49
|
+
file_name = options[:file_name] || classes[0].name
|
50
|
+
if classes.size > 8
|
51
|
+
enabled_targets = classes.map {|i| i.openerp_model} #classes[0].ooor.config[:models] #defines the scope of the UML for option local
|
52
|
+
else
|
53
|
+
enabled_targets = classes[0].ooor.config[:models] #defines the scope of the UML for option local
|
54
|
+
end
|
65
55
|
|
66
|
-
enabled_targets = classes[0].ooor.config[:models] #defines the scope of the UML for option local
|
67
56
|
m2o_edges = {}
|
68
57
|
o2m_edges = {}
|
69
58
|
m2m_edges = {}
|
@@ -73,11 +62,13 @@ module Ooor
|
|
73
62
|
#back links from connex classes:
|
74
63
|
connex_classes += UML.collect_edges(true, local, connex_classes - classes, classes, m2o_edges, o2m_edges, m2m_edges)
|
75
64
|
|
76
|
-
File.open(
|
65
|
+
File.open("#{file_name}.dot", 'w') do |f|
|
77
66
|
f << <<-eos
|
78
67
|
digraph UMLbyOOOR {
|
79
68
|
fontname = "Helvetica"
|
69
|
+
#{classes.size < 5 && "layout = fdp" || ""}
|
80
70
|
fontsize = 11
|
71
|
+
splines = polyline
|
81
72
|
label = "*** generated by OOOR by www.akretion.com ***"
|
82
73
|
node [
|
83
74
|
fontname = "Helvetica"
|
@@ -96,7 +87,7 @@ module Ooor
|
|
96
87
|
#UML nodes definitions
|
97
88
|
((connex_classes - classes) + classes - [IrModel, IrModel.const_get('ir.model.fields')]).each do |model|
|
98
89
|
#f << " #{model} [ label = \"{#{model.name}#{detailed ? '|' + display_fields(model) : ''}}\" URL=\"/model/#{model.openerp_model}\"];\n"
|
99
|
-
f << "#{model}[label=<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" BGCOLOR=\"#ffffff\"><TR><TD COLSPAN=\"3\" BGCOLOR=\"#9bab96\" ALIGN=\"CENTER\">#{model.name}</TD></TR>#{display_fields(model)}</TABLE>> URL=\"/model/#{model.openerp_model}\"];\n"
|
90
|
+
f << "#{model}[label=<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" BGCOLOR=\"#ffffff\"><TR><TD COLSPAN=\"3\" BGCOLOR=\"#9bab96\" ALIGN=\"CENTER\">#{model.name}</TD></TR>#{(classes.index(model) || classes.size == 1) && display_fields(model) || ''}</TABLE>> URL=\"/model/#{model.openerp_model}\"];\n"
|
100
91
|
end
|
101
92
|
|
102
93
|
#many2one:
|
@@ -141,12 +132,12 @@ module Ooor
|
|
141
132
|
end
|
142
133
|
|
143
134
|
begin
|
144
|
-
cmd_line1 = "rm
|
135
|
+
cmd_line1 = "rm #{file_name}.png"
|
145
136
|
#system(cmd_line1)
|
146
137
|
rescue
|
147
138
|
end
|
148
139
|
#cmd_line2 = "dot -Tpng uml.dot -o uml.png"
|
149
|
-
cmd_line2 = "dot -Tcmapx -
|
140
|
+
cmd_line2 = "dot -Tcmapx -o#{file_name}.map -Tpng -o#{file_name}.png #{file_name}.dot"
|
150
141
|
system(cmd_line2)
|
151
142
|
end
|
152
143
|
|
@@ -216,4 +207,4 @@ module Ooor
|
|
216
207
|
end
|
217
208
|
end
|
218
209
|
end
|
219
|
-
end
|
210
|
+
end
|