Merge lp:~camptocamp/openobject-server/trunk-proposed-cleanups into lp:openobject-server

Proposed by Alexandre Fayolle - camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-server/trunk-proposed-cleanups
Merge into: lp:openobject-server
Diff against target: 1413 lines (+142/-196)
40 files modified
openerp/addons/base/ir/ir_actions.py (+17/-27)
openerp/addons/base/ir/ir_attachment.py (+2/-2)
openerp/addons/base/ir/ir_config_parameter.py (+2/-2)
openerp/addons/base/ir/ir_cron.py (+2/-2)
openerp/addons/base/ir/ir_default.py (+2/-3)
openerp/addons/base/ir/ir_exports.py (+7/-9)
openerp/addons/base/ir/ir_filters.py (+2/-3)
openerp/addons/base/ir/ir_mail_server.py (+2/-2)
openerp/addons/base/ir/ir_model.py (+10/-11)
openerp/addons/base/ir/ir_rule.py (+2/-3)
openerp/addons/base/ir/ir_sequence.py (+3/-3)
openerp/addons/base/ir/ir_translation.py (+2/-2)
openerp/addons/base/ir/ir_ui_menu.py (+3/-3)
openerp/addons/base/ir/ir_ui_view.py (+5/-5)
openerp/addons/base/ir/ir_values.py (+2/-2)
openerp/addons/base/ir/wizard/wizard_menu.py (+2/-2)
openerp/addons/base/ir/workflow/workflow.py (+7/-13)
openerp/addons/base/module/module.py (+2/-2)
openerp/addons/base/module/wizard/base_export_language.py (+2/-2)
openerp/addons/base/module/wizard/base_import_language.py (+2/-2)
openerp/addons/base/module/wizard/base_language_install.py (+2/-2)
openerp/addons/base/module/wizard/base_module_configuration.py (+2/-3)
openerp/addons/base/module/wizard/base_module_import.py (+2/-2)
openerp/addons/base/module/wizard/base_module_scan.py (+2/-3)
openerp/addons/base/module/wizard/base_module_update.py (+2/-2)
openerp/addons/base/module/wizard/base_module_upgrade.py (+2/-2)
openerp/addons/base/module/wizard/base_update_translations.py (+2/-2)
openerp/addons/base/res/ir_property.py (+2/-3)
openerp/addons/base/res/res_bank.py (+9/-13)
openerp/addons/base/res/res_company.py (+3/-4)
openerp/addons/base/res/res_config.py (+10/-14)
openerp/addons/base/res/res_country.py (+3/-3)
openerp/addons/base/res/res_currency.py (+4/-7)
openerp/addons/base/res/res_lang.py (+2/-3)
openerp/addons/base/res/res_partner.py (+4/-4)
openerp/addons/base/res/res_request.py (+4/-7)
openerp/addons/base/res/res_users.py (+6/-7)
openerp/osv/orm.py (+1/-1)
openerp/tests/addons/test_uninstall/models.py (+2/-3)
openerp/tools/amount_to_text_en.py (+0/-11)
To merge this branch: bzr merge lp:~camptocamp/openobject-server/trunk-proposed-cleanups
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp (community) code review Approve
Xavier (Open ERP) (community) Approve
Review via email: mp+102833@code.launchpad.net

Description of the change

Refactoring: replace deprecated osv.osv base class with openerp.osv.orm.Model
             remove deprecated instantiation of model classes
             fix a couple of problems found on the runbot (part of lp:1050267)

The change was made with some shell scripts, heavy use of pylint, some eyeballing and the runbot.

To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

Why not keep the simpler import (from osv import orm, fields) and extend from orm.Model?

review: Needs Information
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

No special reason, that's closer to the style I spontaneously write. I have no strong feeling about this, though, so if it helps getting this proposal merged I can update the changeset, and take the opportunity to update it to the latest trunk head.

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

> Why not keep the simpler import (from osv import orm, fields) and extend from
> orm.Model?

Hello Xavier,

I've updated the merge proposal. I've also set you as reviewer for https://code.launchpad.net/~c2c/openobject-addons/trunk-proposed-cleanups/+merge/102832 which is very similar, but works on the addons rather than on the server.

Both changeset have been tested on the runbot and produce a "green" result, which is encouraging. I had to go a bit beyond the original scope of the patches to achieve this, as some problems were breaking the tests.

If these two MP are accepted (which I hope), it would be great if the message was sent internally and if the merging policy for trunk was updated to require the merged changeset to match this (use orm.Model, don't instantiate the model).

Thanks for your time.

Revision history for this message
Cristian Salamea (ovnicraft) wrote :

> Why not keep the simpler import (from osv import orm, fields) and extend from
> orm.Model?

IMO refactor must include CamelCase for clases, i am agree to extend from orm.Model but we can:

from Osv import Orm, Fields

class MyObject(Orm.Model):
    pass

looks pythonic.

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

> > Why not keep the simpler import (from osv import orm, fields) and extend
> from
> > orm.Model?
>
> IMO refactor must include CamelCase for clases, i am agree to extend from
> orm.Model but we can:
>
> from Osv import Orm, Fields
>
> class MyObject(Orm.Model):
> pass
>
> looks pythonic.

@ovnicraft I'm totally opposed to renaming the module with non all-lowercase names (in other word, NO to "from Osv import Orm, Fields")

As for renaming class stock_picking to class StockPicking, I'm not sure. I could do this in another merge request, but I'd rather have this one integrated as soon as possible, because maintaining the patch branch against the trunk is quite costly.

4158. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-09-17

[MRG] from trunk

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

updated my branch with latest trunk. Tests are green

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

For the record, extract from chat with Stéphane Wirtel:

(10:19:02) Stephane Wirtel: simple question, dans ton merge de lundi, tu utilises orm.Model au lieu d'osv.Model, tu as une raison ?
(10:32:18) alf: utiliser le module dans lequel la classe est définie
(10:32:59) alf: plutôt que osv qui ne fait qu'importer Model depuis orm
(10:33:45) alf: ça évite de casser tout le code le jour où on supprime l'import de Model dans osv.py parce qu'il n'est pas utilisé dans ce module
(10:34:58) alf: en général c'est une bonne pratique de ne pas se reposer sur ces imports "transitifs"
(10:35:22) alf: à part pour les trucs qui sont définis dans __init__.py parce que dans ce cas on peut penser qu'il s'agit de l'api du package

rough translation:

SW: simple question, in your MP you use orm.Model instead of osv.Model. Why?

ME: to use the module in which the class is defined (orm) rather than osv which is importing the class from orm. This avoids breaking all the code when Model is no longer imported in osv.py (e.g. because it is no longer used in that module). As a general rule, it is a good practice not to rely on these 'transitive' imports, apart from things which are imported in __init__.py because these can be considered as the package's API.

more details:

What I call a transitive import is A.py defines foo. B import foo from A (and does stuff with it). C import foo from B and does stuff with it. There are several problems with this:

1. changing the import in B can have unexpected side effects which are difficult to anticipate (B's unittest will probably still pass, but C's unittest will suddenly break)
2. (removing the import and) redefining foo in B can break C in subtle ways
3. when working on C, if you want to look for the definition of foo, you have to work your way through the whole import chain. Here we are dealing with a simple chain, but I've seen longer chains (sometimes with "import *" embedded for extra pleasure and it gets very messy very quickly)
4. this way of doing imports makes it easy to create import loops (and there are enough of these in openerp so far)

It would be quite different if the Model, etc... classes were exported by the osv package and not the osv module: in that architecture, the whole osv package's API would be well defined in the __init__.py file and all the submodules would be implementation details with which the common addon developper is not supposed to mess.

4159. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-10-03

[MRG] from trunk

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

updated the branch to the latest trunk. tests are green

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) :
review: Approve
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

Reading the MP in its current state should give an idea of what the goal is. Maintaining this patch against trunk is time consuming, I'm going to stop doing so, but of course I'll gladly update the patch for a clean merge once I get a signal that the merge is going to happen.

Revision history for this message
Antony Lesuisse (OpenERP) (al-openerp) wrote :

Can you rebase on trunk since all imports have been cleaned

4160. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-12-19

update to trunk

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

@al-openerp: Thanks for getting back on this. I'm doing this and making sure this branch and its friend on openobject-addons are green on runbot, and I'll ping you once this is in a mergeable state.

4161. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-12-20

[FIX] missing import and alias in super call

4162. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-12-20

[REF] a few more osv.osv->orm.Model replacements

4163. By Alexandre Fayolle - camptocamp on 2012-12-20

[MRG] update to current trunk

Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

@al-openerp: this branch as well as its cousin branch on the openobject-addons project have been updated to a recent trunk version, and the runbot is green.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Just a little one that should be changed otherwise LGTM

191 +class ir_attachment(osv.Model):

review: Approve (code review)
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

@yvaucher-c2c: that's the case in the latest head, AFAICT

Revision history for this message
David BEAL (ak) (davidbeal) wrote :

Really good job Alexandre,

I hope OpenERP will hear your proposal, otherwise OpenERP 26 will have a lot unvalid code

A lot of developer add yet class call in their module (nice module however). It is not useful since 2.5 years

http://bazaar.launchpad.net/~openerp-india/openerp-india/trunk/view/head:/quotation_template/quotation_template.py#L101

Please update your snippets and don't copy/paste

OpenERP is a really good solution, easy to understand/extend, I would like it will continue to be like up to 50 years further.

Perhaps only one solution => break compatibility shorter with older code

Thanks for all those which contribute to clean code

Revision history for this message
Antony Lesuisse (OpenERP) (al-openerp) wrote :

Can you rebase on trunk, think only the osv.osv -> osv.Model changes will remain.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

@Alexandre l.191 is osv.Model instead of orm.Model my comment wasn't clear enough

Unmerged revisions

4163. By Alexandre Fayolle - camptocamp on 2012-12-20

[MRG] update to current trunk

4162. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-12-20

[REF] a few more osv.osv->orm.Model replacements

4161. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-12-20

[FIX] missing import and alias in super call

4160. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-12-19

update to trunk

4159. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-10-03

[MRG] from trunk

4158. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-09-17

[MRG] from trunk

4157. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-09-13

[REF] get rid of deprecated model class instanciation

4156. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-09-13

[FIX] fix name errors and add missing imports

4155. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-09-13

[FIX] remove dead code

4154. By Alexandre Fayolle @ camptocamp <email address hidden> on 2012-09-13

[REVERT] revert the past 5 commits

there are some circular imports, and theses changes broke a lot of things... I'll to a safer change

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/addons/base/ir/ir_actions.py'
2--- openerp/addons/base/ir/ir_actions.py 2012-12-17 14:47:53 +0000
3+++ openerp/addons/base/ir/ir_actions.py 2012-12-20 14:23:22 +0000
4@@ -27,7 +27,7 @@
5
6 from openerp import SUPERUSER_ID
7 from openerp import netsvc, tools
8-from openerp.osv import fields, osv
9+from openerp.osv import fields, osv, orm
10 from openerp.report.report_sxw import report_sxw, report_rml
11 from openerp.tools.config import config
12 from openerp.tools.safe_eval import safe_eval as eval
13@@ -35,7 +35,7 @@
14
15 _logger = logging.getLogger(__name__)
16
17-class actions(osv.osv):
18+class actions(orm.Model):
19 _name = 'ir.actions.actions'
20 _table = 'ir_actions'
21 _order = 'name'
22@@ -50,10 +50,9 @@
23 _defaults = {
24 'usage': lambda *a: False,
25 }
26-actions()
27-
28-
29-class report_xml(osv.osv):
30+
31+
32+class report_xml(orm.Model):
33
34 def _report_content(self, cursor, user, ids, name, arg, context=None):
35 res = {}
36@@ -150,9 +149,8 @@
37 'attachment': False,
38 }
39
40-report_xml()
41
42-class act_window(osv.osv):
43+class act_window(orm.Model):
44 _name = 'ir.actions.act_window'
45 _table = 'ir_act_window'
46 _inherit = 'ir.actions.actions'
47@@ -274,7 +272,6 @@
48 res_id = dataobj.browse(cr, uid, data_id, context).res_id
49 return self.read(cr, uid, res_id, [], context)
50
51-act_window()
52
53 VIEW_TYPES = [
54 ('tree', 'Tree'),
55@@ -283,7 +280,7 @@
56 ('calendar', 'Calendar'),
57 ('gantt', 'Gantt'),
58 ('kanban', 'Kanban')]
59-class act_window_view(osv.osv):
60+class act_window_view(orm.Model):
61 _name = 'ir.actions.act_window.view'
62 _table = 'ir_act_window_view'
63 _rec_name = 'view_id'
64@@ -304,9 +301,8 @@
65 cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'act_window_view_unique_mode_per_action\'')
66 if not cr.fetchone():
67 cr.execute('CREATE UNIQUE INDEX act_window_view_unique_mode_per_action ON ir_act_window_view (act_window_id, view_mode)')
68-act_window_view()
69
70-class act_wizard(osv.osv):
71+class act_wizard(orm.Model):
72 _name = 'ir.actions.wizard'
73 _inherit = 'ir.actions.actions'
74 _table = 'ir_act_wizard'
75@@ -324,9 +320,8 @@
76 'type': 'ir.actions.wizard',
77 'multi': False,
78 }
79-act_wizard()
80
81-class act_url(osv.osv):
82+class act_url(orm.Model):
83 _name = 'ir.actions.act_url'
84 _table = 'ir_act_url'
85 _inherit = 'ir.actions.actions'
86@@ -346,7 +341,6 @@
87 'type': 'ir.actions.act_url',
88 'target': 'new'
89 }
90-act_url()
91
92 def model_get(self, cr, uid, context=None):
93 wkf_pool = self.pool.get('workflow')
94@@ -363,15 +357,14 @@
95
96 return res
97
98-class ir_model_fields(osv.osv):
99+class ir_model_fields(orm.Model):
100 _inherit = 'ir.model.fields'
101 _rec_name = 'field_description'
102 _columns = {
103 'complete_name': fields.char('Complete Name', size=64, select=1),
104 }
105-ir_model_fields()
106
107-class server_object_lines(osv.osv):
108+class server_object_lines(orm.Model):
109 _name = 'ir.server.object.lines'
110 _sequence = 'ir_actions_id_seq'
111 _columns = {
112@@ -389,12 +382,11 @@
113 _defaults = {
114 'type': 'equation',
115 }
116-server_object_lines()
117
118 ##
119 # Actions that are run on the server side
120 #
121-class actions_server(osv.osv):
122+class actions_server(orm.Model):
123
124 def _select_signals(self, cr, uid, context=None):
125 cr.execute("""SELECT distinct w.osv, t.signal FROM wkf w, wkf_activity a, wkf_transition t
126@@ -715,6 +707,8 @@
127 expr = exp.value
128 res[exp.col1.name] = expr
129
130+ obj_pool = None
131+ res_id = False
132 obj_pool = self.pool.get(action.srcmodel_id.model)
133 res_id = obj_pool.create(cr, uid, res)
134 if action.record_id:
135@@ -737,23 +731,21 @@
136
137 return False
138
139-actions_server()
140
141-class act_window_close(osv.osv):
142+class act_window_close(orm.Model):
143 _name = 'ir.actions.act_window_close'
144 _inherit = 'ir.actions.actions'
145 _table = 'ir_actions'
146 _defaults = {
147 'type': 'ir.actions.act_window_close',
148 }
149-act_window_close()
150
151 # This model use to register action services.
152 TODO_STATES = [('open', 'To Do'),
153 ('done', 'Done')]
154 TODO_TYPES = [('manual', 'Launch Manually'),('once', 'Launch Manually Once'),
155 ('automatic', 'Launch Automatically')]
156-class ir_actions_todo(osv.osv):
157+class ir_actions_todo(orm.Model):
158 """
159 Configuration Wizards
160 """
161@@ -849,9 +841,8 @@
162 'todo': len(total) - len(done)
163 }
164
165-ir_actions_todo()
166
167-class act_client(osv.osv):
168+class act_client(orm.Model):
169 _name = 'ir.actions.client'
170 _inherit = 'ir.actions.actions'
171 _table = 'ir_act_client'
172@@ -892,6 +883,5 @@
173 'context': '{}',
174
175 }
176-act_client()
177
178 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
179
180=== modified file 'openerp/addons/base/ir/ir_attachment.py'
181--- openerp/addons/base/ir/ir_attachment.py 2012-12-20 02:37:21 +0000
182+++ openerp/addons/base/ir/ir_attachment.py 2012-12-20 14:23:22 +0000
183@@ -25,9 +25,9 @@
184 import re
185
186 from openerp import tools
187-from openerp.osv import fields,osv
188+from openerp.osv import fields, osv, orm
189
190-class ir_attachment(osv.osv):
191+class ir_attachment(osv.Model):
192 """Attachments are used to link binary files or url to any openerp document.
193
194 External attachment storage
195
196=== modified file 'openerp/addons/base/ir/ir_config_parameter.py'
197--- openerp/addons/base/ir/ir_config_parameter.py 2012-12-10 15:27:23 +0000
198+++ openerp/addons/base/ir/ir_config_parameter.py 2012-12-20 14:23:22 +0000
199@@ -26,7 +26,7 @@
200 import datetime
201
202 from openerp import SUPERUSER_ID
203-from openerp.osv import osv, fields
204+from openerp.osv import fields, orm
205 from openerp.tools import misc, config
206
207 """
208@@ -38,7 +38,7 @@
209 "web.base.url": lambda: "http://localhost:%s" % config.get('xmlrpc_port'),
210 }
211
212-class ir_config_parameter(osv.osv):
213+class ir_config_parameter(orm.Model):
214 """Per-database storage of configuration key-value pairs."""
215
216 _name = 'ir.config_parameter'
217
218=== modified file 'openerp/addons/base/ir/ir_cron.py'
219--- openerp/addons/base/ir/ir_cron.py 2012-12-17 14:47:53 +0000
220+++ openerp/addons/base/ir/ir_cron.py 2012-12-20 14:23:22 +0000
221@@ -26,7 +26,7 @@
222
223 import openerp
224 from openerp import netsvc
225-from openerp.osv import fields, osv
226+from openerp.osv import fields, osv, orm
227 from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
228 from openerp.tools.safe_eval import safe_eval as eval
229 from openerp.tools.translate import _
230@@ -45,7 +45,7 @@
231 'minutes': lambda interval: relativedelta(minutes=interval),
232 }
233
234-class ir_cron(osv.osv):
235+class ir_cron(orm.Model):
236 """ Model describing cron jobs (also called actions or tasks).
237 """
238
239
240=== modified file 'openerp/addons/base/ir/ir_default.py'
241--- openerp/addons/base/ir/ir_default.py 2012-12-10 15:27:23 +0000
242+++ openerp/addons/base/ir/ir_default.py 2012-12-20 14:23:22 +0000
243@@ -19,9 +19,9 @@
244 #
245 ##############################################################################
246
247-from openerp.osv import fields, osv
248+from openerp.osv import fields, orm
249
250-class ir_default(osv.osv):
251+class ir_default(orm.Model):
252 _name = 'ir.default'
253 _columns = {
254 'field_tbl': fields.char('Object',size=64),
255@@ -43,7 +43,6 @@
256 _defaults = {
257 'company_id': _get_company_id,
258 }
259-ir_default()
260
261
262 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
263
264=== modified file 'openerp/addons/base/ir/ir_exports.py'
265--- openerp/addons/base/ir/ir_exports.py 2012-12-10 15:27:23 +0000
266+++ openerp/addons/base/ir/ir_exports.py 2012-12-20 14:23:22 +0000
267@@ -19,10 +19,10 @@
268 #
269 ##############################################################################
270
271-from openerp.osv import fields,osv
272-
273-
274-class ir_exports(osv.osv):
275+from openerp.osv import fields, orm
276+
277+
278+class ir_exports(orm.Model):
279 _name = "ir.exports"
280 _order = 'name'
281 _columns = {
282@@ -31,17 +31,15 @@
283 'export_fields': fields.one2many('ir.exports.line', 'export_id',
284 'Export ID'),
285 }
286-ir_exports()
287-
288-
289-class ir_exports_line(osv.osv):
290+
291+
292+class ir_exports_line(orm.Model):
293 _name = 'ir.exports.line'
294 _order = 'id'
295 _columns = {
296 'name': fields.char('Field Name', size=64),
297 'export_id': fields.many2one('ir.exports', 'Export', select=True, ondelete='cascade'),
298 }
299-ir_exports_line()
300
301 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
302
303
304=== modified file 'openerp/addons/base/ir/ir_filters.py'
305--- openerp/addons/base/ir/ir_filters.py 2012-12-17 14:47:53 +0000
306+++ openerp/addons/base/ir/ir_filters.py 2012-12-20 14:23:22 +0000
307@@ -20,10 +20,10 @@
308 ##############################################################################
309
310 from openerp import exceptions
311-from openerp.osv import osv, fields
312+from openerp.osv import fields, orm
313 from openerp.tools.translate import _
314
315-class ir_filters(osv.osv):
316+class ir_filters(orm.Model):
317 _name = 'ir.filters'
318 _description = 'Filters'
319
320@@ -142,6 +142,5 @@
321 'is_default': False
322 }
323
324-ir_filters()
325
326 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
327
328=== modified file 'openerp/addons/base/ir/ir_mail_server.py'
329--- openerp/addons/base/ir/ir_mail_server.py 2012-12-17 14:47:53 +0000
330+++ openerp/addons/base/ir/ir_mail_server.py 2012-12-20 14:23:22 +0000
331@@ -31,7 +31,7 @@
332 import smtplib
333 import threading
334
335-from openerp.osv import osv, fields
336+from openerp.osv import osv, fields, orm
337 from openerp.tools.translate import _
338 from openerp.tools import html2text
339 import openerp.tools as tools
340@@ -159,7 +159,7 @@
341 return COMMASPACE.join(extract_rfc2822_addresses(header_text_utf8))
342
343
344-class ir_mail_server(osv.osv):
345+class ir_mail_server(orm.Model):
346 """Represents an SMTP server, able to send outgoing emails, with SSL and TLS capabilities."""
347 _name = "ir.mail_server"
348
349
350=== modified file 'openerp/addons/base/ir/ir_model.py'
351--- openerp/addons/base/ir/ir_model.py 2012-12-14 13:25:33 +0000
352+++ openerp/addons/base/ir/ir_model.py 2012-12-20 14:23:22 +0000
353@@ -27,8 +27,7 @@
354 import openerp
355 from openerp import SUPERUSER_ID
356 from openerp import netsvc, pooler, tools
357-from openerp.osv import fields,osv
358-from openerp.osv.orm import Model
359+from openerp.osv import fields, osv, orm
360 from openerp.tools.safe_eval import safe_eval as eval
361 from openerp.tools import config
362 from openerp.tools.translate import _
363@@ -56,12 +55,12 @@
364 installed_modules = set(x['name'] for x in installed_module_names)
365
366 result = {}
367- xml_ids = osv.osv._get_xml_ids(self, cr, uid, ids)
368+ xml_ids = orm.Model._get_xml_ids(self, cr, uid, ids)
369 for k,v in xml_ids.iteritems():
370 result[k] = ', '.join(sorted(installed_modules & set(xml_id.split('.')[0] for xml_id in v)))
371 return result
372
373-class ir_model(osv.osv):
374+class ir_model(orm.Model):
375 _name = 'ir.model'
376 _description = "Models"
377 _order = 'model'
378@@ -198,7 +197,7 @@
379 return res
380
381 def instanciate(self, cr, user, model, context=None):
382- class x_custom_model(osv.osv):
383+ class x_custom_model(orm.Model):
384 pass
385 x_custom_model._name = model
386 x_custom_model._module = False
387@@ -212,7 +211,7 @@
388 x_custom_model._rec_name = x_name
389 a._rec_name = x_name
390
391-class ir_model_fields(osv.osv):
392+class ir_model_fields(orm.Model):
393 _name = 'ir.model.fields'
394 _description = "Fields"
395
396@@ -468,7 +467,7 @@
397 obj._auto_init(cr, ctx)
398 return res
399
400-class ir_model_constraint(Model):
401+class ir_model_constraint(orm.Model):
402 """
403 This model tracks PostgreSQL foreign keys and constraints used by OpenERP
404 models.
405@@ -537,7 +536,7 @@
406
407 self.unlink(cr, uid, ids, context)
408
409-class ir_model_relation(Model):
410+class ir_model_relation(orm.Model):
411 """
412 This model tracks PostgreSQL tables used to implement OpenERP many2many
413 relations.
414@@ -590,7 +589,7 @@
415
416 cr.commit()
417
418-class ir_model_access(osv.osv):
419+class ir_model_access(orm.Model):
420 _name = 'ir.model.access'
421 _columns = {
422 'name': fields.char('Name', size=64, required=True, select=True),
423@@ -769,7 +768,7 @@
424 res = super(ir_model_access, self).unlink(cr, uid, *args, **argv)
425 return res
426
427-class ir_model_data(osv.osv):
428+class ir_model_data(orm.Model):
429 """Holds external identifier keys for records in the database.
430 This has two main uses:
431
432@@ -832,7 +831,7 @@
433 ]
434
435 def __init__(self, pool, cr):
436- osv.osv.__init__(self, pool, cr)
437+ orm.Model.__init__(self, pool, cr)
438 self.doinit = True
439 # also stored in pool to avoid being discarded along with this osv instance
440 if getattr(pool, 'model_data_reference_ids', None) is None:
441
442=== modified file 'openerp/addons/base/ir/ir_rule.py'
443--- openerp/addons/base/ir/ir_rule.py 2012-12-17 14:30:29 +0000
444+++ openerp/addons/base/ir/ir_rule.py 2012-12-20 14:23:22 +0000
445@@ -22,11 +22,11 @@
446
447 from openerp import SUPERUSER_ID
448 from openerp import tools
449-from openerp.osv import fields, osv, expression
450+from openerp.osv import fields, osv, orm, expression
451 from openerp.tools.safe_eval import safe_eval as eval
452 from openerp.tools.misc import unquote as unquote
453
454-class ir_rule(osv.osv):
455+class ir_rule(orm.Model):
456 _name = 'ir.rule'
457 _order = 'name'
458 _MODES = ['read', 'write', 'create', 'unlink']
459@@ -172,7 +172,6 @@
460 self.clear_cache(cr,uid)
461 return res
462
463-ir_rule()
464
465 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
466
467
468=== modified file 'openerp/addons/base/ir/ir_sequence.py'
469--- openerp/addons/base/ir/ir_sequence.py 2012-12-17 14:47:53 +0000
470+++ openerp/addons/base/ir/ir_sequence.py 2012-12-20 14:23:22 +0000
471@@ -23,12 +23,12 @@
472 import time
473
474 import openerp
475-from openerp.osv import osv
476+from openerp.osv import osv, orm
477 from openerp.tools.translate import _
478
479 _logger = logging.getLogger(__name__)
480
481-class ir_sequence_type(openerp.osv.osv.osv):
482+class ir_sequence_type(orm.Model):
483 _name = 'ir.sequence.type'
484 _order = 'name'
485 _columns = {
486@@ -44,7 +44,7 @@
487 cr.execute('select code, name from ir_sequence_type')
488 return cr.fetchall()
489
490-class ir_sequence(openerp.osv.osv.osv):
491+class ir_sequence(orm.Model):
492 """ Sequence model.
493
494 The sequence model allows to define and use so-called sequence objects.
495
496=== modified file 'openerp/addons/base/ir/ir_translation.py'
497--- openerp/addons/base/ir/ir_translation.py 2012-12-17 14:47:53 +0000
498+++ openerp/addons/base/ir/ir_translation.py 2012-12-20 14:23:22 +0000
499@@ -23,7 +23,7 @@
500
501 from openerp import tools
502 import openerp.modules
503-from openerp.osv import fields, osv
504+from openerp.osv import fields, osv, orm
505 from openerp.tools.translate import _
506
507 _logger = logging.getLogger(__name__)
508@@ -145,7 +145,7 @@
509 cr.execute("DROP TABLE %s" % self._table_name)
510 return True
511
512-class ir_translation(osv.osv):
513+class ir_translation(orm.Model):
514 _name = "ir.translation"
515 _log_access = False
516
517
518=== modified file 'openerp/addons/base/ir/ir_ui_menu.py'
519--- openerp/addons/base/ir/ir_ui_menu.py 2012-12-17 14:47:53 +0000
520+++ openerp/addons/base/ir/ir_ui_menu.py 2012-12-20 14:23:22 +0000
521@@ -3,7 +3,7 @@
522 #
523 # OpenERP, Open Source Management Solution
524 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
525-# Copyright (C) 2010-2012 OpenERP SA (<http://openerp.com>).
526+# Copyright (C) 2010-2011 OpenERP SA (<http://openerp.com>).
527 #
528 # This program is free software: you can redistribute it and/or modify
529 # it under the terms of the GNU Affero General Public License as
530@@ -26,7 +26,7 @@
531 from openerp.tools.safe_eval import safe_eval as eval
532 from openerp import tools
533 import openerp.modules
534-from openerp.osv import fields, osv
535+from openerp.osv import fields, osv, orm
536 from openerp.tools.translate import _
537 from openerp import SUPERUSER_ID
538
539@@ -38,7 +38,7 @@
540 return True
541 return False
542
543-class ir_ui_menu(osv.osv):
544+class ir_ui_menu(orm.Model):
545 _name = 'ir.ui.menu'
546
547 def __init__(self, *args, **kwargs):
548
549=== modified file 'openerp/addons/base/ir/ir_ui_view.py'
550--- openerp/addons/base/ir/ir_ui_view.py 2012-12-17 14:47:53 +0000
551+++ openerp/addons/base/ir/ir_ui_view.py 2012-12-20 14:23:22 +0000
552@@ -24,14 +24,14 @@
553 import os
554
555 from openerp import tools
556-from openerp.osv import fields,osv
557+from openerp.osv import fields, osv, orm
558 from openerp.tools import graph
559 from openerp.tools.safe_eval import safe_eval as eval
560 from openerp.tools.view_validation import valid_view
561
562 _logger = logging.getLogger(__name__)
563
564-class view_custom(osv.osv):
565+class view_custom(orm.Model):
566 _name = 'ir.ui.view.custom'
567 _order = 'create_date desc' # search(limit=1) should return the last customization
568 _columns = {
569@@ -46,7 +46,7 @@
570 if not cr.fetchone():
571 cr.execute('CREATE INDEX ir_ui_view_custom_user_id_ref_id ON ir_ui_view_custom (user_id, ref_id)')
572
573-class view(osv.osv):
574+class view(orm.Model):
575 _name = 'ir.ui.view'
576
577 def _type_field(self, cr, uid, ids, name, args, context=None):
578@@ -99,7 +99,7 @@
579 else:
580 inferred_type = etree.fromstring(values['arch'].encode('utf8')).tag
581 values['name'] = "%s %s" % (values['model'], inferred_type)
582- return super(osv.osv, self).create(cr, uid, values, context)
583+ return super(orm.Model, self).create(cr, uid, values, context)
584
585 def _relaxng(self):
586 if not self._relaxng_validator:
587@@ -273,7 +273,7 @@
588 'blank_nodes': blank_nodes,
589 'node_parent_field': _Model_Field,}
590
591-class view_sc(osv.osv):
592+class view_sc(orm.Model):
593 _name = 'ir.ui.view_sc'
594 _columns = {
595 'name': fields.char('Shortcut Name', size=64), # Kept for backwards compatibility only - resource name used instead (translatable)
596
597=== modified file 'openerp/addons/base/ir/ir_values.py'
598--- openerp/addons/base/ir/ir_values.py 2012-12-17 14:47:53 +0000
599+++ openerp/addons/base/ir/ir_values.py 2012-12-20 14:23:22 +0000
600@@ -20,7 +20,7 @@
601 ##############################################################################
602 import pickle
603
604-from openerp.osv import osv, fields
605+from openerp.osv import osv, fields, orm
606 from openerp.osv.orm import except_orm
607
608 EXCLUDED_FIELDS = set((
609@@ -37,7 +37,7 @@
610 ]
611
612
613-class ir_values(osv.osv):
614+class ir_values(orm.Model):
615 """Holds internal model-specific action bindings and user-defined default
616 field values. definitions. This is a legacy internal model, mixing
617 two different concepts, and will likely be updated or replaced in a
618
619=== modified file 'openerp/addons/base/ir/wizard/wizard_menu.py'
620--- openerp/addons/base/ir/wizard/wizard_menu.py 2012-12-10 15:27:23 +0000
621+++ openerp/addons/base/ir/wizard/wizard_menu.py 2012-12-20 14:23:22 +0000
622@@ -19,9 +19,9 @@
623 #
624 ##############################################################################
625
626-from openerp.osv import fields, osv
627+from openerp.osv import fields, osv, orm
628
629-class wizard_model_menu(osv.osv_memory):
630+class wizard_model_menu(orm.TransientModel):
631 _name = 'wizard.ir.model.menu.create'
632 _columns = {
633 'menu_id': fields.many2one('ir.ui.menu', 'Parent Menu', required=True),
634
635=== modified file 'openerp/addons/base/ir/workflow/workflow.py'
636--- openerp/addons/base/ir/workflow/workflow.py 2012-10-12 12:24:19 +0000
637+++ openerp/addons/base/ir/workflow/workflow.py 2012-12-20 14:23:22 +0000
638@@ -19,11 +19,11 @@
639 #
640 ##############################################################################
641
642-from openerp.osv import fields, osv
643+from openerp.osv import fields, osv, orm
644 from openerp.tools.translate import _
645 from openerp import netsvc
646
647-class workflow(osv.osv):
648+class workflow(orm.Model):
649 _name = "workflow"
650 _table = "wkf"
651 _order = "name"
652@@ -66,9 +66,8 @@
653 wf_service.clear_cache(cr, user)
654 return super(workflow, self).create(cr, user, vals, context=context)
655
656-workflow()
657
658-class wkf_activity(osv.osv):
659+class wkf_activity(orm.Model):
660 _name = "workflow.activity"
661 _table = "wkf_activity"
662 _order = "name"
663@@ -100,9 +99,8 @@
664 _('Please make sure no workitems refer to an activity before deleting it!'))
665 super(wkf_activity, self).unlink(cr, uid, ids, context=context)
666
667-wkf_activity()
668
669-class wkf_transition(osv.osv):
670+class wkf_transition(orm.Model):
671 _table = "wkf_transition"
672 _name = "workflow.transition"
673 _rec_name = 'signal'
674@@ -125,9 +123,8 @@
675 _defaults = {
676 'condition': lambda *a: 'True',
677 }
678-wkf_transition()
679
680-class wkf_instance(osv.osv):
681+class wkf_instance(orm.Model):
682 _table = "wkf_instance"
683 _name = "workflow.instance"
684 _rec_name = 'res_type'
685@@ -147,9 +144,8 @@
686 if not cr.fetchone():
687 cr.execute('CREATE INDEX wkf_instance_res_id_wkf_id_index ON wkf_instance (res_id, wkf_id)')
688
689-wkf_instance()
690
691-class wkf_workitem(osv.osv):
692+class wkf_workitem(orm.Model):
693 _table = "wkf_workitem"
694 _name = "workflow.workitem"
695 _log_access = False
696@@ -161,9 +157,8 @@
697 'inst_id': fields.many2one('workflow.instance', 'Instance', required=True, ondelete="cascade", select=True),
698 'state': fields.char('Status', size=64, select=True),
699 }
700-wkf_workitem()
701
702-class wkf_triggers(osv.osv):
703+class wkf_triggers(orm.Model):
704 _table = "wkf_triggers"
705 _name = "workflow.triggers"
706 _log_access = False
707@@ -178,7 +173,6 @@
708 cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'wkf_triggers_res_id_model_index\'')
709 if not cr.fetchone():
710 cr.execute('CREATE INDEX wkf_triggers_res_id_model_index ON wkf_triggers (res_id, model)')
711-wkf_triggers()
712
713
714 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
715
716=== modified file 'openerp/addons/base/module/module.py'
717--- openerp/addons/base/module/module.py 2012-12-17 14:30:29 +0000
718+++ openerp/addons/base/module/module.py 2012-12-20 14:23:22 +0000
719@@ -46,7 +46,7 @@
720 'nodestroy':True,
721 }
722
723-class module_category(osv.osv):
724+class module_category(orm.Model):
725 _name = "ir.module.category"
726 _description = "Application"
727
728@@ -662,7 +662,7 @@
729 if not mod.description:
730 _logger.warning('module %s: description is empty !', mod.name)
731
732-class module_dependency(osv.osv):
733+class module_dependency(orm.Model):
734 _name = "ir.module.module.dependency"
735 _description = "Module dependency"
736
737
738=== modified file 'openerp/addons/base/module/wizard/base_export_language.py'
739--- openerp/addons/base/module/wizard/base_export_language.py 2012-12-10 15:27:23 +0000
740+++ openerp/addons/base/module/wizard/base_export_language.py 2012-12-20 14:23:22 +0000
741@@ -23,13 +23,13 @@
742 import cStringIO
743
744 from openerp import tools
745-from openerp.osv import fields,osv
746+from openerp.osv import fields, osv, orm
747 from openerp.tools.translate import _
748 from openerp.tools.misc import get_iso_codes
749
750 NEW_LANG_KEY = '__new__'
751
752-class base_language_export(osv.osv_memory):
753+class base_language_export(orm.TransientModel):
754 _name = "base.language.export"
755
756 def _get_languages(self, cr, uid, context):
757
758=== modified file 'openerp/addons/base/module/wizard/base_import_language.py'
759--- openerp/addons/base/module/wizard/base_import_language.py 2012-12-10 15:27:23 +0000
760+++ openerp/addons/base/module/wizard/base_import_language.py 2012-12-20 14:23:22 +0000
761@@ -23,9 +23,9 @@
762 from tempfile import TemporaryFile
763
764 from openerp import tools
765-from openerp.osv import osv, fields
766+from openerp.osv import osv, fields, orm
767
768-class base_language_import(osv.osv_memory):
769+class base_language_import(orm.TransientModel):
770 """ Language Import """
771
772 _name = "base.language.import"
773
774=== modified file 'openerp/addons/base/module/wizard/base_language_install.py'
775--- openerp/addons/base/module/wizard/base_language_install.py 2012-12-10 15:27:23 +0000
776+++ openerp/addons/base/module/wizard/base_language_install.py 2012-12-20 14:23:22 +0000
777@@ -20,10 +20,10 @@
778 ##############################################################################
779
780 from openerp import tools
781-from openerp.osv import osv, fields
782+from openerp.osv import osv, fields, orm
783 from openerp.tools.translate import _
784
785-class base_language_install(osv.osv_memory):
786+class base_language_install(orm.TransientModel):
787 """ Install Language"""
788
789 _name = "base.language.install"
790
791=== modified file 'openerp/addons/base/module/wizard/base_module_configuration.py'
792--- openerp/addons/base/module/wizard/base_module_configuration.py 2012-12-10 15:27:23 +0000
793+++ openerp/addons/base/module/wizard/base_module_configuration.py 2012-12-20 14:23:22 +0000
794@@ -19,10 +19,10 @@
795 #
796 ##############################################################################
797
798-from openerp.osv import osv
799+from openerp.osv import orm
800 from openerp.tools.translate import _
801
802-class base_module_configuration(osv.osv_memory):
803+class base_module_configuration(orm.TransientModel):
804
805 _name = "base.module.configuration"
806
807@@ -48,6 +48,5 @@
808 config_pool = self.pool.get('res.config')
809 return config_pool.start(cr, uid, ids, context=context)
810
811-base_module_configuration()
812
813 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
814
815=== modified file 'openerp/addons/base/module/wizard/base_module_import.py'
816--- openerp/addons/base/module/wizard/base_module_import.py 2012-12-10 15:27:23 +0000
817+++ openerp/addons/base/module/wizard/base_module_import.py 2012-12-20 14:23:22 +0000
818@@ -25,12 +25,12 @@
819 import zipfile
820
821 from openerp import tools
822-from openerp.osv import osv, fields
823+from openerp.osv import osv, fields, orm
824 from openerp.tools.translate import _
825
826 ADDONS_PATH = tools.config['addons_path'].split(",")[-1]
827
828-class base_module_import(osv.osv_memory):
829+class base_module_import(orm.TransientModel):
830 """ Import Module """
831
832 _name = "base.module.import"
833
834=== modified file 'openerp/addons/base/module/wizard/base_module_scan.py'
835--- openerp/addons/base/module/wizard/base_module_scan.py 2012-12-17 14:30:29 +0000
836+++ openerp/addons/base/module/wizard/base_module_scan.py 2012-12-20 14:23:22 +0000
837@@ -24,9 +24,9 @@
838 import zipfile
839
840 from openerp import tools
841-from openerp.osv import osv
842+from openerp.osv import orm
843
844-class base_module_scan(osv.osv_memory):
845+class base_module_scan(orm.TransientModel):
846 """ scan module """
847
848 _name = "base.module.scan"
849@@ -69,6 +69,5 @@
850 mod_obj.write(cr, uid, [mod['id']], {'state': 'uninstalled'})
851 return {}
852
853-base_module_scan()
854
855 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
856
857=== modified file 'openerp/addons/base/module/wizard/base_module_update.py'
858--- openerp/addons/base/module/wizard/base_module_update.py 2012-12-10 15:27:23 +0000
859+++ openerp/addons/base/module/wizard/base_module_update.py 2012-12-20 14:23:22 +0000
860@@ -19,9 +19,9 @@
861 #
862 ##############################################################################
863
864-from openerp.osv import osv, fields
865+from openerp.osv import osv, fields, orm
866
867-class base_module_update(osv.osv_memory):
868+class base_module_update(orm.TransientModel):
869 """ Update Module """
870
871 _name = "base.module.update"
872
873=== modified file 'openerp/addons/base/module/wizard/base_module_upgrade.py'
874--- openerp/addons/base/module/wizard/base_module_upgrade.py 2012-11-02 09:31:10 +0000
875+++ openerp/addons/base/module/wizard/base_module_upgrade.py 2012-12-20 14:23:22 +0000
876@@ -20,10 +20,10 @@
877 ##############################################################################
878
879 from openerp import pooler
880-from openerp.osv import osv, fields
881+from openerp.osv import osv, fields, orm
882 from openerp.tools.translate import _
883
884-class base_module_upgrade(osv.osv_memory):
885+class base_module_upgrade(orm.TransientModel):
886 """ Module Upgrade """
887
888 _name = "base.module.upgrade"
889
890=== modified file 'openerp/addons/base/module/wizard/base_update_translations.py'
891--- openerp/addons/base/module/wizard/base_update_translations.py 2012-12-10 15:27:23 +0000
892+++ openerp/addons/base/module/wizard/base_update_translations.py 2012-12-20 14:23:22 +0000
893@@ -22,10 +22,10 @@
894 import cStringIO
895
896 from openerp import tools
897-from openerp.osv import osv, fields
898+from openerp.osv import osv, fields, orm
899 from openerp.tools.translate import _
900
901-class base_update_translations(osv.osv_memory):
902+class base_update_translations(orm.TransientModel):
903 def _get_languages(self, cr, uid, context):
904 lang_obj = self.pool.get('res.lang')
905 ids = lang_obj.search(cr, uid, ['&', ('active', '=', True), ('translatable', '=', True),])
906
907=== modified file 'openerp/addons/base/res/ir_property.py'
908--- openerp/addons/base/res/ir_property.py 2012-12-10 15:27:23 +0000
909+++ openerp/addons/base/res/ir_property.py 2012-12-20 14:23:22 +0000
910@@ -21,14 +21,14 @@
911
912 import time
913
914-from openerp.osv import osv,fields
915+from openerp.osv import osv, fields, orm
916 from openerp.tools.misc import attrgetter
917
918 # -------------------------------------------------------------------------
919 # Properties
920 # -------------------------------------------------------------------------
921
922-class ir_property(osv.osv):
923+class ir_property(orm.Model):
924 _name = 'ir.property'
925
926 def _models_field_get(self, cr, uid, field_key, field_value, context=None):
927@@ -188,7 +188,6 @@
928 '|', ('company_id', '=', cid), ('company_id', '=', False)]
929 return domain
930
931-ir_property()
932
933
934
935
936=== modified file 'openerp/addons/base/res/res_bank.py'
937--- openerp/addons/base/res/res_bank.py 2012-12-10 15:27:23 +0000
938+++ openerp/addons/base/res/res_bank.py 2012-12-20 14:23:22 +0000
939@@ -19,10 +19,10 @@
940 #
941 ##############################################################################
942
943-from openerp.osv import fields, osv
944+from openerp.osv import fields, osv, orm
945 from openerp.tools.translate import _
946
947-class Bank(osv.osv):
948+class Bank(orm.Model):
949 _description='Bank'
950 _name = 'res.bank'
951 _order = 'name'
952@@ -51,10 +51,9 @@
953 result.append((bank.id, (bank.bic and (bank.bic + ' - ') or '') + bank.name))
954 return result
955
956-Bank()
957-
958-
959-class res_partner_bank_type(osv.osv):
960+
961+
962+class res_partner_bank_type(orm.Model):
963 _description='Bank Account Type'
964 _name = 'res.partner.bank.type'
965 _order = 'name'
966@@ -67,9 +66,8 @@
967 _defaults = {
968 'format_layout': lambda *args: "%(bank_name)s: %(acc_number)s"
969 }
970-res_partner_bank_type()
971
972-class res_partner_bank_type_fields(osv.osv):
973+class res_partner_bank_type_fields(orm.Model):
974 _description='Bank type fields'
975 _name = 'res.partner.bank.type.field'
976 _order = 'name'
977@@ -80,10 +78,9 @@
978 'readonly': fields.boolean('Readonly'),
979 'size': fields.integer('Max. Size'),
980 }
981-res_partner_bank_type_fields()
982-
983-
984-class res_partner_bank(osv.osv):
985+
986+
987+class res_partner_bank(orm.Model):
988 '''Bank Accounts'''
989 _name = "res.partner.bank"
990 _rec_name = "acc_number"
991@@ -234,6 +231,5 @@
992 result['state_id'] = part.state_id.id
993 return {'value': result}
994
995-res_partner_bank()
996
997 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
998
999=== modified file 'openerp/addons/base/res/res_company.py'
1000--- openerp/addons/base/res/res_company.py 2012-12-17 12:59:02 +0000
1001+++ openerp/addons/base/res/res_company.py 2012-12-20 14:23:22 +0000
1002@@ -23,12 +23,12 @@
1003
1004 import openerp
1005 from openerp import SUPERUSER_ID, tools
1006-from openerp.osv import fields, osv
1007+from openerp.osv import fields, osv, orm
1008 from openerp.tools.translate import _
1009 from openerp.tools.safe_eval import safe_eval as eval
1010 from openerp.tools import image_resize_image
1011
1012-class multi_company_default(osv.osv):
1013+class multi_company_default(orm.Model):
1014 """
1015 Manage multi company default value
1016 """
1017@@ -68,9 +68,8 @@
1018 default['name'] = company.name + _(' (copy)')
1019 return super(multi_company_default, self).copy(cr, uid, id, default, context=context)
1020
1021-multi_company_default()
1022
1023-class res_company(osv.osv):
1024+class res_company(orm.Model):
1025 _name = "res.company"
1026 _description = 'Companies'
1027 _order = 'name'
1028
1029=== modified file 'openerp/addons/base/res/res_config.py'
1030--- openerp/addons/base/res/res_config.py 2012-12-17 14:47:53 +0000
1031+++ openerp/addons/base/res/res_config.py 2012-12-20 14:23:22 +0000
1032@@ -22,13 +22,13 @@
1033 from operator import attrgetter
1034
1035 from openerp import pooler
1036-from openerp.osv import osv, fields
1037+from openerp.osv import osv, fields, orm
1038 from openerp.tools import ustr
1039 from openerp.tools.translate import _
1040
1041 _logger = logging.getLogger(__name__)
1042
1043-class res_config_configurable(osv.osv_memory):
1044+class res_config_configurable(orm.TransientModel):
1045 ''' Base classes for new-style configuration items
1046
1047 Configuration items should inherit from this class, implement
1048@@ -150,9 +150,8 @@
1049 if next: return next
1050 return self.next(cr, uid, ids, context=context)
1051
1052-res_config_configurable()
1053
1054-class res_config_installer(osv.osv_memory):
1055+class res_config_installer(orm.TransientModel):
1056 """ New-style configuration base specialized for addons selection
1057 and installation.
1058
1059@@ -308,7 +307,7 @@
1060
1061 hooks_results = set()
1062 for module in base:
1063- hook = getattr(self, '_if_%s'% module, None)
1064+ hook = getattr(self, '_if_%s' % module, None)
1065 if hook:
1066 hooks_results.update(hook(cr, uid, ids, context=None) or set())
1067
1068@@ -361,13 +360,11 @@
1069 cr.commit() #TOFIX: after remove this statement, installation wizard is fail
1070 new_db, self.pool = pooler.restart_pool(cr.dbname, update_module=True)
1071
1072-res_config_installer()
1073-
1074 DEPRECATION_MESSAGE = 'You are using an addon using old-style configuration '\
1075 'wizards (ir.actions.configuration.wizard). Old-style configuration '\
1076 'wizards have been deprecated.\n'\
1077 'The addon should be migrated to res.config objects.'
1078-class ir_actions_configuration_wizard(osv.osv_memory):
1079+class ir_actions_configuration_wizard(orm.TransientModel):
1080 ''' Compatibility configuration wizard
1081
1082 The old configuration wizard has been replaced by res.config, but in order
1083@@ -397,16 +394,15 @@
1084 def execute(self, cr, uid, ids, context=None):
1085 _logger.warning(DEPRECATION_MESSAGE)
1086
1087-ir_actions_configuration_wizard()
1088-
1089-
1090-
1091-class res_config_settings(osv.osv_memory):
1092+
1093+
1094+
1095+class res_config_settings(orm.TransientModel):
1096 """ Base configuration wizard for application settings. It provides support for setting
1097 default values, assigning groups to employee users, and installing modules.
1098 To make such a 'settings' wizard, define a model like::
1099
1100- class my_config_wizard(osv.osv_memory):
1101+ class my_config_wizard(orm.TransientModel):
1102 _name = 'my.settings'
1103 _inherit = 'res.config.settings'
1104 _columns = {
1105
1106=== modified file 'openerp/addons/base/res/res_country.py'
1107--- openerp/addons/base/res/res_country.py 2012-12-10 15:27:23 +0000
1108+++ openerp/addons/base/res/res_country.py 2012-12-20 14:23:22 +0000
1109@@ -19,7 +19,7 @@
1110 #
1111 ##############################################################################
1112
1113-from openerp.osv import fields, osv
1114+from openerp.osv import fields, orm
1115
1116 def location_name_search(self, cr, user, name='', args=None, operator='ilike',
1117 context=None, limit=100):
1118@@ -39,7 +39,7 @@
1119 locations = self.name_get(cr, user, ids, context)
1120 return sorted(locations, key=lambda (id, name): ids.index(id))
1121
1122-class Country(osv.osv):
1123+class Country(orm.Model):
1124 _name = 'res.country'
1125 _description = 'Country'
1126 _columns = {
1127@@ -83,7 +83,7 @@
1128 context=context)
1129
1130
1131-class CountryState(osv.osv):
1132+class CountryState(orm.Model):
1133 _description="Country state"
1134 _name = 'res.country.state'
1135 _columns = {
1136
1137=== modified file 'openerp/addons/base/res/res_currency.py'
1138--- openerp/addons/base/res/res_currency.py 2012-12-17 14:47:53 +0000
1139+++ openerp/addons/base/res/res_currency.py 2012-12-20 14:23:22 +0000
1140@@ -23,13 +23,13 @@
1141 import time
1142
1143 from openerp import tools
1144-from openerp.osv import fields, osv
1145+from openerp.osv import fields, osv, orm
1146 from openerp.tools import float_round, float_is_zero, float_compare
1147 from openerp.tools.translate import _
1148
1149 CURRENCY_DISPLAY_PATTERN = re.compile(r'(\w+)\s*(?:\((.*)\))?')
1150
1151-class res_currency(osv.osv):
1152+class res_currency(orm.Model):
1153 def _current_rate(self, cr, uid, ids, name, arg, context=None):
1154 if context is None:
1155 context = {}
1156@@ -219,18 +219,16 @@
1157 else:
1158 return from_amount * rate
1159
1160-res_currency()
1161
1162-class res_currency_rate_type(osv.osv):
1163+class res_currency_rate_type(orm.Model):
1164 _name = "res.currency.rate.type"
1165 _description = "Currency Rate Type"
1166 _columns = {
1167 'name': fields.char('Name', size=64, required=True, translate=True),
1168 }
1169
1170-res_currency_rate_type()
1171
1172-class res_currency_rate(osv.osv):
1173+class res_currency_rate(orm.Model):
1174 _name = "res.currency.rate"
1175 _description = "Currency Rate"
1176
1177@@ -245,7 +243,6 @@
1178 }
1179 _order = "name desc"
1180
1181-res_currency_rate()
1182
1183 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1184
1185
1186=== modified file 'openerp/addons/base/res/res_lang.py'
1187--- openerp/addons/base/res/res_lang.py 2012-12-17 14:47:53 +0000
1188+++ openerp/addons/base/res/res_lang.py 2012-12-20 14:23:22 +0000
1189@@ -25,13 +25,13 @@
1190 import re
1191
1192 from openerp import tools
1193-from openerp.osv import fields, osv
1194+from openerp.osv import fields, osv, orm
1195 from openerp.tools.safe_eval import safe_eval as eval
1196 from openerp.tools.translate import _
1197
1198 _logger = logging.getLogger(__name__)
1199
1200-class lang(osv.osv):
1201+class lang(orm.Model):
1202 _name = "res.lang"
1203 _description = "Languages"
1204
1205@@ -226,7 +226,6 @@
1206 # _percent_re = re.compile(r'%(?:\((?P<key>.*?)\))?'
1207 # r'(?P<modifiers>[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')
1208
1209-lang()
1210
1211 def original_group(s, grouping, thousands_sep=''):
1212
1213
1214=== modified file 'openerp/addons/base/res/res_partner.py'
1215--- openerp/addons/base/res/res_partner.py 2012-12-19 10:25:39 +0000
1216+++ openerp/addons/base/res/res_partner.py 2012-12-20 14:23:22 +0000
1217@@ -28,7 +28,7 @@
1218 import openerp
1219 from openerp import SUPERUSER_ID
1220 from openerp import pooler, tools
1221-from openerp.osv import osv, fields
1222+from openerp.osv import osv, fields, orm
1223 from openerp.tools.translate import _
1224
1225 class format_address(object):
1226@@ -75,7 +75,7 @@
1227 def _tz_get(self,cr,uid, context=None):
1228 return [(x, x) for x in pytz.all_timezones]
1229
1230-class res_partner_category(osv.osv):
1231+class res_partner_category(orm.Model):
1232
1233 def name_get(self, cr, uid, ids, context=None):
1234 """Return the categories' display name, including their direct
1235@@ -141,7 +141,7 @@
1236 _parent_order = 'name'
1237 _order = 'parent_left'
1238
1239-class res_partner_title(osv.osv):
1240+class res_partner_title(orm.Model):
1241 _name = 'res.partner.title'
1242 _order = 'name'
1243 _columns = {
1244@@ -162,7 +162,7 @@
1245 POSTAL_ADDRESS_FIELDS = ('street', 'street2', 'zip', 'city', 'state_id', 'country_id')
1246 ADDRESS_FIELDS = POSTAL_ADDRESS_FIELDS + ('email', 'phone', 'fax', 'mobile', 'website', 'ref', 'lang')
1247
1248-class res_partner(osv.osv, format_address):
1249+class res_partner(orm.Model, format_address):
1250 _description = 'Partner'
1251 _name = "res.partner"
1252
1253
1254=== modified file 'openerp/addons/base/res/res_request.py'
1255--- openerp/addons/base/res/res_request.py 2012-12-17 14:47:53 +0000
1256+++ openerp/addons/base/res/res_request.py 2012-12-20 14:23:22 +0000
1257@@ -21,7 +21,7 @@
1258
1259 import time
1260
1261-from openerp.osv import osv, fields
1262+from openerp.osv import osv, fields, orm
1263
1264 def _links_get(self, cr, uid, context=None):
1265 obj = self.pool.get('res.request.link')
1266@@ -29,7 +29,7 @@
1267 res = obj.read(cr, uid, ids, ['object', 'name'], context)
1268 return [(r['object'], r['name']) for r in res]
1269
1270-class res_request(osv.osv):
1271+class res_request(orm.Model):
1272 _name = 'res.request'
1273
1274 def request_send(self, cr, uid, ids, *args):
1275@@ -85,9 +85,8 @@
1276 }
1277 _order = 'priority desc, trigger_date, create_date desc'
1278 _table = 'res_request'
1279-res_request()
1280
1281-class res_request_link(osv.osv):
1282+class res_request_link(orm.Model):
1283 _name = 'res.request.link'
1284 _columns = {
1285 'name': fields.char('Name', size=64, required=True, translate=True),
1286@@ -98,9 +97,8 @@
1287 'priority': 5,
1288 }
1289 _order = 'priority'
1290-res_request_link()
1291
1292-class res_request_history(osv.osv):
1293+class res_request_history(orm.Model):
1294 _name = 'res.request.history'
1295 _columns = {
1296 'name': fields.char('Summary', size=128, states={'active':[('readonly',True)],'waiting':[('readonly',True)]}, required=True),
1297@@ -116,7 +114,6 @@
1298 'act_to': lambda obj,cr,uid,context=None: uid,
1299 'date_sent': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
1300 }
1301-res_request_history()
1302
1303
1304 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1305
1306=== modified file 'openerp/addons/base/res/res_users.py'
1307--- openerp/addons/base/res/res_users.py 2012-12-19 10:13:15 +0000
1308+++ openerp/addons/base/res/res_users.py 2012-12-20 14:23:22 +0000
1309@@ -28,13 +28,13 @@
1310 from openerp import SUPERUSER_ID
1311 from openerp import pooler, tools
1312 import openerp.exceptions
1313-from openerp.osv import fields,osv
1314+from openerp.osv import fields, osv, orm
1315 from openerp.osv.orm import browse_record
1316 from openerp.tools.translate import _
1317
1318 _logger = logging.getLogger(__name__)
1319
1320-class groups(osv.osv):
1321+class groups(orm.Model):
1322 _name = "res.groups"
1323 _description = "Access Groups"
1324 _rec_name = 'full_name'
1325@@ -101,9 +101,8 @@
1326 self.pool.get('ir.model.access').call_cache_clearing_methods(cr)
1327 return res
1328
1329-groups()
1330
1331-class res_users(osv.osv):
1332+class res_users(orm.Model):
1333 """ User class. A res.users record models an OpenERP user and is different
1334 from an employee.
1335
1336@@ -531,7 +530,7 @@
1337
1338
1339
1340-class groups_implied(osv.osv):
1341+class groups_implied(orm.Model):
1342 _inherit = 'res.groups'
1343
1344 def _get_trans_implied(self, cr, uid, ids, field, arg, context=None):
1345@@ -641,7 +640,7 @@
1346
1347
1348
1349-class groups_view(osv.osv):
1350+class groups_view(orm.Model):
1351 _inherit = 'res.groups'
1352
1353 def create(self, cr, uid, values, context=None):
1354@@ -739,7 +738,7 @@
1355 res.append((False, 'boolean', others))
1356 return res
1357
1358-class users_view(osv.osv):
1359+class users_view(orm.Model):
1360 _inherit = 'res.users'
1361
1362 def create(self, cr, uid, values, context=None):
1363
1364=== modified file 'openerp/osv/orm.py'
1365--- openerp/osv/orm.py 2012-12-18 22:39:59 +0000
1366+++ openerp/osv/orm.py 2012-12-20 14:23:22 +0000
1367@@ -5236,7 +5236,7 @@
1368
1369 OpenERP models are created by inheriting from this class::
1370
1371- class user(Model):
1372+ class user(orm.Model):
1373 ...
1374
1375 The system will later instantiate the class once per database (on
1376
1377=== modified file 'openerp/tests/addons/test_uninstall/models.py'
1378--- openerp/tests/addons/test_uninstall/models.py 2012-06-01 15:45:44 +0000
1379+++ openerp/tests/addons/test_uninstall/models.py 2012-12-20 14:23:22 +0000
1380@@ -1,9 +1,8 @@
1381 # -*- coding: utf-8 -*-
1382 import openerp
1383-from openerp.osv import fields
1384-from openerp.osv.orm import Model
1385+from openerp.osv import fields, orm
1386
1387-class test_uninstall_model(Model):
1388+class test_uninstall_model(orm.Model):
1389 """
1390 This model uses different types of columns to make it possible to test
1391 the uninstall feature of OpenERP.
1392
1393=== modified file 'openerp/tools/amount_to_text_en.py'
1394--- openerp/tools/amount_to_text_en.py 2012-12-14 13:44:55 +0000
1395+++ openerp/tools/amount_to_text_en.py 2012-12-20 14:23:22 +0000
1396@@ -118,17 +118,6 @@
1397 lang = 'en'
1398 return _translate_funcs[lang](abs(nbr), currency)
1399
1400-if __name__=='__main__':
1401- from sys import argv
1402-
1403- lang = 'nl'
1404- if len(argv) < 2:
1405- for i in range(1,200):
1406- print i, ">>", int_to_text(i, lang)
1407- for i in range(200,999999,139):
1408- print i, ">>", int_to_text(i, lang)
1409- else:
1410- print int_to_text(int(argv[1]), lang)
1411
1412
1413 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: