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