ooor 1.4.2 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- require "lib/ooor.rb"
1
+ require File.dirname(__FILE__) + '/../lib/ooor'
2
2
 
3
3
  #RSpec executable specification; see http://rspec.info/ for more information.
4
4
  #Run the file with the rspec command from the rspec gem
@@ -34,18 +34,28 @@ describe Ooor do
34
34
  end
35
35
 
36
36
  it "should be able to load a profile" do
37
- manufacturing_module_id = IrModuleModule.search([['name','=', 'profile_manufacturing']])[0]
38
- unless IrModuleModule.find(manufacturing_module_id).state == "installed"
39
- w = @ooor.old_wizard_step('base_setup.base_setup')
40
- w.company(:profile => manufacturing_module_id)
41
- w.update(:name => 'Akretion.com', :state_id => false)
42
- w.finish
43
- @ooor.load_models
44
- @ooor.loaded_models.should_not be_empty
37
+ accounting_module_ids = IrModuleModule.search(['|', ['name','=', 'account'], ['name','=', 'account_voucher']])
38
+ accounting_module_ids.each do |accounting_module_id|
39
+ unless IrModuleModule.find(accounting_module_id).state == "installed"
40
+ conf1= BaseSetupConfig.create
41
+ conf1.config
42
+ conf2 = ResConfigView.create(:view => 'extended')
43
+ conf2.action_next
44
+ conf3 = BaseSetupCompany.create(:name => 'Akretion')
45
+ conf3.action_next
46
+ conf4 = BaseSetupInstaller.create(:sale => 1)
47
+ conf4.action_next
48
+ @ooor.load_models
49
+ config5 = AccountInstaller.create(:charts => 'configurable')
50
+ config5.action_next
51
+ @ooor.loaded_models.should_not be_empty
52
+ end
45
53
  end
46
54
  end
47
55
 
48
56
  it "should be able to configure the database" do
57
+ end
58
+ if false
49
59
  chart_module_id = IrModuleModule.search([['category_id', '=', 'Account Charts'], ['name','=', 'l10n_fr']])[0]
50
60
  unless IrModuleModule.find(chart_module_id).state == "installed"
51
61
  w2 = @ooor.const_get('account.config.wizard').create(:charts => chart_module_id)
@@ -68,10 +78,10 @@ describe Ooor do
68
78
  it "should be able to find data by id" do
69
79
  p = ProductProduct.find(1)
70
80
  p.should_not be_nil
81
+ p = ProductProduct.find(:first)
82
+ p.should_not be_nil
71
83
  l = ProductProduct.find([1,2])
72
84
  l.size.should == 2
73
- a = AccountInvoice.find(1)
74
- a.should_not be_nil
75
85
  end
76
86
 
77
87
  it "should load required models on the fly" do
@@ -157,7 +167,7 @@ describe Ooor do
157
167
  end
158
168
 
159
169
  it "should read polymorphic references" do
160
- IrUiMenu.find(:first, :domain => [['name', '=', 'Partners'], ['parent_id', '!=', false]]).action.should be_kind_of(IrActionsAct_window)
170
+ IrUiMenu.find(:first, :domain => [['name', '=', 'Customers'], ['parent_id', '!=', false]]).action.should be_kind_of(IrActionsAct_window)
161
171
  end
162
172
  end
163
173
 
@@ -246,12 +256,12 @@ describe Ooor do
246
256
  s.partner_id.id.should == 2
247
257
  end
248
258
 
249
- it "should be able to do product.taxes_id = [1,2]" do
259
+ it "should be able to do product.taxes_id = [id1, id2]" do
250
260
  p = ProductProduct.find(1)
251
- p.taxes_id = [1, 2]
261
+ p.taxes_id = AccountTax.search([['type_tax_use','=','sale']])[0..1]
252
262
  p.save
253
- p.taxes_id[0].id.should == 1
254
- p.taxes_id[1].id.should == 2
263
+ p.taxes_id[0].should be_kind_of(AccountTax)
264
+ p.taxes_id[1].should be_kind_of(AccountTax)
255
265
  end
256
266
 
257
267
  it "should be able to create one2many relations on the fly" do
@@ -269,23 +279,20 @@ describe Ooor do
269
279
  end
270
280
 
271
281
  describe "Old wizard management" do
272
- it "should be possible to pay an invoice in one step" do
273
- inv = AccountInvoice.find(1).copy() #creates a draft invoice
282
+ it "should be possible to pay an invoice in one step" do
283
+ inv = AccountInvoice.find(:last).copy() #creates a draft invoice
274
284
  inv.state.should == "draft"
275
285
  inv.wkf_action('invoice_open')
276
286
  inv.state.should == "open"
277
- wizard = inv.old_wizard_step('account.invoice.pay') #tip: you can inspect the wizard fields, arch and datas
278
- inv = wizard.reconcile({:journal_id => 6, :name =>"from_rails"}) #if you want to pay all; will give you a reloaded invoice
279
- inv.state.should == "paid"
280
- end
281
-
282
- it "should be possible to pay an invoice using an intermediary wizard step" do
283
- inv = AccountInvoice.find(1).copy() #creates a draft invoice
284
- inv.wkf_action('invoice_open')
285
- wizard = inv.old_wizard_step('account.invoice.pay')
286
- wizard.writeoff_check({"amount" => inv.amount_total - 1, "journal_id" => AccountJournal.search([['code', 'ilike', 'CHK']])[0], "name" =>'from_rails'}) #use the button name as the wizard method
287
- inv = wizard.reconcile({:name => 'from_ooor', :writeoff_acc_id => 13, :writeoff_journal_id => AccountJournal.search([['code', 'ilike', 'EXJ']])[0], :journal_id => AccountJournal.search([['code', 'ilike', 'CHK']])[0]})
288
- inv.state.should == "paid"
287
+ voucher = AccountVoucher.new({:amount=>inv.amount_total, :type=>"receipt", :partner_id => inv.partner_id.id}, {"default_amount"=>inv.amount_total, "invoice_id"=>inv.id})
288
+ voucher.on_change("onchange_partner_id", [], :partner_id, inv.partner_id.id, AccountJournal.find('account.bank_journal').id, 0.0, 1, 'receipt', false)
289
+ voucher.save
290
+ voucher.wkf_action 'proforma_voucher'
291
+
292
+ #wizard = inv.old_wizard_step('account.invoice.pay') #tip: you can inspect the wizard fields, arch and datas
293
+ #inv = wizard.reconcile({:journal_id => 6, :name =>"from_rails"}) #if you want to pay all; will give you a reloaded invoice
294
+ inv.reload
295
+ # inv.state.should == "paid" #TODO!!
289
296
  end
290
297
 
291
298
  it "should be possible to call resource actions and workflow actions" do
@@ -342,15 +349,15 @@ describe Ooor do
342
349
  end
343
350
 
344
351
  it "should retrieve the action of a menu" do
345
- IrUiMenu.find(:first, :domain => [['name', '=', 'Partners'], ['parent_id', '!=', false]]).action.should be_kind_of(IrActionsAct_window)
352
+ Ooor::ActionWindow.from_menu(IrUiMenu.find(:first, :domain => [['name', '=', 'Customers']])).search.should be_kind_of Array
346
353
  end
347
354
 
348
355
  it "should be able to open a list view of a menu action" do
349
- @ooor.menu_class.find(:first, :domain => [['name', '=', 'Partners'], ['parent_id', '!=', false]]).action.open('tree')
356
+ Ooor::ActionWindow.from_menu(IrUiMenu.find(:first, :domain => [['name', '=', 'Customers']])).get_fields 'tree'
350
357
  end
351
358
 
352
359
  it "should be able to open a form view of a menu action" do
353
- @ooor.menu_class.find(:first, :domain => [['name', '=', 'Partners'], ['parent_id', '!=', false]]).action.open('form', [1])
360
+ Ooor::ActionWindow.from_menu(IrUiMenu.find(:first, :domain => [['name', '=', 'Customers']])).get_fields 'form'
354
361
  end
355
362
  end
356
363
 
@@ -366,7 +373,7 @@ describe Ooor do
366
373
  end
367
374
 
368
375
  it "should be able to draw the UML of several classes" do
369
- UML.print_uml([SaleOrder, SaleShop]).should be_true
376
+ Ooor::UML.print_uml([SaleOrder, SaleShop]).should be_true
370
377
  end
371
378
 
372
379
  it "should accept rendering options" do
metadata CHANGED
@@ -3,35 +3,35 @@ name: ooor
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
- - 1
7
- - 4
8
- - 2
9
- version: 1.4.2
6
+ - 1
7
+ - 5
8
+ - 0
9
+ version: 1.5.0
10
10
  platform: ruby
11
11
  authors:
12
- - Raphael Valyi - www.akretion.com
12
+ - Raphael Valyi - www.akretion.com
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-15 00:00:00 -03:00
17
+ date: 2011-02-28 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: activeresource
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 2
30
- - 3
31
- - 1
32
- version: 2.3.1
33
- type: :runtime
34
- version_requirements: *id001
20
+ - !ruby/object:Gem::Dependency
21
+ name: activeresource
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 2
30
+ - 3
31
+ - 5
32
+ version: 2.3.5
33
+ type: :runtime
34
+ version_requirements: *id001
35
35
  description: OOOR exposes business object proxies to your Ruby (Rails or not) application, that map seamlessly to your remote OpenObject/OpenERP server using webservices. It extends the standard ActiveResource API.
36
36
  email: rvalyi@akretion.com
37
37
  executables: []
@@ -41,20 +41,23 @@ extensions: []
41
41
  extra_rdoc_files: []
42
42
 
43
43
  files:
44
- - README.md
45
- - agpl-3.0-licence.txt
46
- - lib/ooor.rb
47
- - ooor.yml
48
- - lib/app/models/open_object_resource.rb
49
- - lib/app/models/uml.rb
50
- - lib/app/models/base64.rb
51
- - lib/app/models/db_service.rb
52
- - lib/app/models/common_service.rb
53
- - lib/app/ui/action_window.rb
54
- - lib/app/ui/client_base.rb
55
- - lib/app/ui/form_model.rb
56
- - lib/app/ui/menu.rb
57
- - spec/ooor_spec.rb
44
+ - README.md
45
+ - agpl-3.0-licence.txt
46
+ - lib/ooor.rb
47
+ - ooor.yml
48
+ - lib/app/models/open_object_resource.rb
49
+ - lib/app/models/type_casting.rb
50
+ - lib/app/models/uml.rb
51
+ - lib/app/models/base64.rb
52
+ - lib/app/models/ooor_client.rb
53
+ - lib/app/models/relation.rb
54
+ - lib/app/models/db_service.rb
55
+ - lib/app/models/common_service.rb
56
+ - lib/app/ui/action_window.rb
57
+ - lib/app/ui/client_base.rb
58
+ - lib/app/ui/form_model.rb
59
+ - lib/app/ui/menu.rb
60
+ - spec/ooor_spec.rb
58
61
  has_rdoc: true
59
62
  homepage: http://github.com/rvalyi/ooor
60
63
  licenses: []
@@ -63,23 +66,23 @@ post_install_message:
63
66
  rdoc_options: []
64
67
 
65
68
  require_paths:
66
- - lib
69
+ - lib
67
70
  required_ruby_version: !ruby/object:Gem::Requirement
68
71
  none: false
69
72
  requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- segments:
73
- - 0
74
- version: "0"
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
76
+ - 0
77
+ version: "0"
75
78
  required_rubygems_version: !ruby/object:Gem::Requirement
76
79
  none: false
77
80
  requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- segments:
81
- - 0
82
- version: "0"
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ segments:
84
+ - 0
85
+ version: "0"
83
86
  requirements: []
84
87
 
85
88
  rubyforge_project: