Remove OSV and WizardOSV and move Cacheable into model

This commit is contained in:
Cédric Krier committed 2009-02-28 16:56:54 +01:00
1 parent e27a5e48e7
commit c9992e11d2
27 files changed
+95 -138

No files matched your search

+9 -9
View File
@@ -1,14 +1,14 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Action"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
from trytond.tools import file_open
from trytond.backend import TableHandler
import base64
import os
class Action(OSV):
class Action(ModelSQL, ModelView):
"Action"
_name = 'ir.action'
_description = __doc__
@@ -57,7 +57,7 @@ class Action(OSV):
Action()
class ActionKeyword(OSV):
class ActionKeyword(ModelSQL, ModelView):
"Action keyword"
_name = 'ir.action.keyword'
_description = __doc__
@@ -200,7 +200,7 @@ class ActionKeyword(OSV):
ActionKeyword()
class ActionReportOutputFormat(OSV):
class ActionReportOutputFormat(ModelSQL, ModelView):
"Output formats for reports"
_name = 'ir.action.report.outputformat'
_description = "Report Output Format"
@@ -211,7 +211,7 @@ class ActionReportOutputFormat(OSV):
ActionReportOutputFormat()
class ActionReport(OSV):
class ActionReport(ModelSQL, ModelView):
"Action report"
_name = 'ir.action.report'
_sequence = 'ir_action_id_seq'
@@ -350,7 +350,7 @@ class ActionReport(OSV):
ActionReport()
class ActionActWindow(OSV):
class ActionActWindow(ModelSQL, ModelView):
"Action act window"
_name = 'ir.action.act_window'
_sequence = 'ir_action_id_seq'
@@ -425,7 +425,7 @@ class ActionActWindow(OSV):
ActionActWindow()
class ActionActWindowView(OSV):
class ActionActWindowView(ModelSQL, ModelView):
"Action act window view"
_name = 'ir.action.act_window.view'
_rec_name = 'view'
@@ -450,7 +450,7 @@ class ActionActWindowView(OSV):
ActionActWindowView()
class ActionWizard(OSV):
class ActionWizard(ModelSQL, ModelView):
"Action wizard"
_name = 'ir.action.wizard'
_sequence = 'ir_action_id_seq'
@@ -481,7 +481,7 @@ class ActionWizard(OSV):
ActionWizard()
class ActionURL(OSV):
class ActionURL(ModelSQL, ModelView):
"Action URL"
_name = 'ir.action.url'
_sequence = 'ir_action_id_seq'
+3 -3
View File
@@ -1,13 +1,13 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Attachment"
from trytond.model import ModelView, ModelSQL, fields
from trytond.config import CONFIG
import os
import md5
import base64
from trytond.osv import fields, OSV
from trytond.config import CONFIG
class Attachment(OSV):
class Attachment(ModelSQL, ModelView):
"Attachment"
_name = 'ir.attachment'
_description = __doc__
+2 -2
View File
@@ -1,8 +1,8 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
from trytond.model import ModelSQL, fields
from trytond.osv import OSV, fields
class Cache(OSV):
class Cache(ModelSQL):
"Cache"
_name = 'ir.cache'
_description = __doc__
+3 -3
View File
@@ -7,9 +7,9 @@ SPEC: Execute "model.function(*eval(args))" periodically
max_repeat : number of execution or NULL if endlessly
"""
from mx import DateTime
from trytond.backend import Database
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
from mx import DateTime
import datetime
import traceback
import sys
@@ -23,7 +23,7 @@ _INTERVALTYPES = {
'minutes': lambda interval: DateTime.RelativeDateTime(minutes=interval),
}
class Cron(OSV):
class Cron(ModelSQL, ModelView):
"Cron"
_name = "ir.cron"
_description = __doc__
+2 -3
View File
@@ -1,11 +1,10 @@
#This file is part of Tryton. The COPYRIGHT file at the top level
#of this repository contains the full copyright notices and license terms.
from trytond.osv import OSV, fields
from trytond.model import Model
import datetime
class Date(OSV):
class Date(Model):
'Date'
_name = 'ir.date'
_description = __doc__
+2 -2
View File
@@ -1,13 +1,13 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Default"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
from decimal import Decimal
import mx.DateTime
import datetime
class Default(OSV):
class Default(ModelSQL, ModelView):
"Default"
_name = 'ir.default'
_description = __doc__
+3 -3
View File
@@ -1,10 +1,10 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Exports"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
class Export(OSV):
class Export(ModelSQL, ModelView):
"Export"
_name = "ir.export"
_description = __doc__
@@ -16,7 +16,7 @@ class Export(OSV):
Export()
class ExportLine(OSV):
class ExportLine(ModelSQL, ModelView):
"Export line"
_name = 'ir.export.line'
_description = __doc__
+2 -2
View File
@@ -1,10 +1,10 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
"Lang"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
import time
class Lang(OSV):
class Lang(ModelSQL, ModelView):
"Language"
_name = "ir.lang"
_description = __doc__
+7 -7
View File
@@ -1,15 +1,15 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"model"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
from trytond.tools import Cache
from trytond.report import Report
from trytond.wizard import Wizard, WizardOSV
from trytond.wizard import Wizard
import time
import base64
class Model(OSV):
class Model(ModelSQL, ModelView):
"Model"
_name = 'ir.model'
_description = __doc__
@@ -31,7 +31,7 @@ class Model(OSV):
Model()
class ModelField(OSV):
class ModelField(ModelSQL, ModelView):
"Model field"
_name = 'ir.model.field'
_description = __doc__
@@ -138,7 +138,7 @@ class ModelField(OSV):
ModelField()
class ModelAccess(OSV):
class ModelAccess(ModelSQL, ModelView):
"Model access"
_name = 'ir.model.access'
_description = __doc__
@@ -260,7 +260,7 @@ class ModelAccess(OSV):
ModelAccess()
class ModelData(OSV):
class ModelData(ModelSQL, ModelView):
"Model data"
_name = 'ir.model.data'
_description = __doc__
@@ -313,7 +313,7 @@ class ModelData(OSV):
ModelData()
class PrintModelGraphInit(WizardOSV):
class PrintModelGraphInit(ModelView):
'Print Model Graph Init'
_name = 'ir.model.print_model_graph.init'
_description = __doc__
+8 -8
View File
@@ -6,10 +6,10 @@ import re
import zipfile
import urllib
import zipimport
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
import trytond.tools as tools
from trytond.modules import MODULES_PATH, create_graph, get_module_list
from trytond.wizard import Wizard, WizardOSV
from trytond.wizard import Wizard
from trytond.backend import Database
from trytond.pool import Pool
@@ -124,7 +124,7 @@ def vercmp(ver1, ver2):
return revision1 - revision2
class Module(OSV):
class Module(ModelSQL, ModelView):
"Module"
_name = "ir.module.module"
_description = __doc__
@@ -444,7 +444,7 @@ class Module(OSV):
Module()
class ModuleDependency(OSV):
class ModuleDependency(ModelSQL, ModelView):
"Module dependency"
_name = "ir.module.module.dependency"
_description = __doc__
@@ -485,7 +485,7 @@ class ModuleDependency(OSV):
ModuleDependency()
class ModuleConfigWizardItem(OSV):
class ModuleConfigWizardItem(ModelSQL, ModelView):
"Config wizard to run after installing module"
_name = 'ir.module.module.config_wizard.item'
_description = __doc__
@@ -509,7 +509,7 @@ class ModuleConfigWizardItem(OSV):
ModuleConfigWizardItem()
class ModuleConfigWizardFirst(WizardOSV):
class ModuleConfigWizardFirst(ModelView):
'Module Config Wizard First'
_name = 'ir.module.module.config_wizard.first'
_description = __doc__
@@ -586,7 +586,7 @@ class ModuleConfigWizard(Wizard):
ModuleConfigWizard()
class ModuleInstallUpgradeInit(WizardOSV):
class ModuleInstallUpgradeInit(ModelView):
'Module Install Upgrade Init'
_name = 'ir.module.module.install_upgrade.init'
_description = __doc__
@@ -595,7 +595,7 @@ class ModuleInstallUpgradeInit(WizardOSV):
ModuleInstallUpgradeInit()
class ModuleInstallUpgradeStart(WizardOSV):
class ModuleInstallUpgradeStart(ModelView):
'Module Install Upgrade Start'
_name = 'ir.module.module.install_upgrade.start'
_description = __doc__
+2 -2
View File
@@ -1,10 +1,10 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
"Properties"
from trytond.osv import OSV, fields
from trytond.model import ModelView, ModelSQL, fields
from decimal import Decimal
class Property(OSV):
class Property(ModelSQL, ModelView):
"Property"
_name = 'ir.property'
_description = __doc__
+3 -3
View File
@@ -1,11 +1,11 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
"Rule"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
from trytond.tools import Cache
import time
class RuleGroup(OSV):
class RuleGroup(ModelSQL, ModelView):
"Rule group"
_name = 'ir.rule.group'
_description = __doc__
@@ -64,7 +64,7 @@ class RuleGroup(OSV):
RuleGroup()
class Rule(OSV):
class Rule(ModelSQL, ModelView):
"Rule"
_name = 'ir.rule'
_rec_name = 'field'
+3 -3
View File
@@ -1,11 +1,11 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import time
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
from string import Template
class SequenceType(OSV):
class SequenceType(ModelSQL, ModelView):
"Sequence type"
_name = 'ir.sequence.type'
_description = __doc__
@@ -15,7 +15,7 @@ class SequenceType(OSV):
SequenceType()
class Sequence(OSV):
class Sequence(ModelSQL, ModelView):
"Sequence"
_name = 'ir.sequence'
_description = __doc__
+11 -10
View File
@@ -10,8 +10,9 @@ from xml import dom
from xml.dom import minidom
from difflib import SequenceMatcher
import csv
from trytond.osv import fields, OSV, Cacheable
from trytond.wizard import Wizard, WizardOSV
from trytond.model import ModelView, ModelSQL, fields
from trytond.model.cacheable import Cacheable
from trytond.wizard import Wizard
from trytond import tools
from trytond.tools import file_open
import os
@@ -36,7 +37,7 @@ class TRYTON(csv.excel):
csv.register_dialect("TRYTON", TRYTON)
class Translation(OSV, Cacheable):
class Translation(ModelSQL, ModelView, Cacheable):
"Translation"
_name = "ir.translation"
_description = __doc__
@@ -539,7 +540,7 @@ class Translation(OSV, Cacheable):
Translation()
class ReportTranslationSetInit(WizardOSV):
class ReportTranslationSetInit(ModelView):
"Update Report Translation"
_name = 'ir.translation.set_report.init'
_description = __doc__
@@ -547,7 +548,7 @@ class ReportTranslationSetInit(WizardOSV):
ReportTranslationSetInit()
class ReportTranslationSetStart(WizardOSV):
class ReportTranslationSetStart(ModelView):
"Update Report Translation"
_name = 'ir.translation.set_report.start'
_description = __doc__
@@ -707,7 +708,7 @@ class ReportTranslationSet(Wizard):
ReportTranslationSet()
class TranslationCleanInit(WizardOSV):
class TranslationCleanInit(ModelView):
'Clean translation init'
_name = 'ir.translation.clean.init'
_description = __doc__
@@ -715,7 +716,7 @@ class TranslationCleanInit(WizardOSV):
TranslationCleanInit()
class TranslationCleanStart(WizardOSV):
class TranslationCleanStart(ModelView):
'Clean translation start'
_name = 'ir.translation.clean.start'
_description = __doc__
@@ -924,7 +925,7 @@ class TranslationClean(Wizard):
TranslationClean()
class TranslationUpdateInit(WizardOSV):
class TranslationUpdateInit(ModelView):
"Update translation - language"
_name = 'ir.translation.update.init'
_description = __doc__
@@ -1053,7 +1054,7 @@ class TranslationUpdate(Wizard):
TranslationUpdate()
class TranslationExportInit(WizardOSV):
class TranslationExportInit(ModelView):
"Export translation - language and module"
_name = 'ir.translation.export.init'
_description = __doc__
@@ -1083,7 +1084,7 @@ class TranslationExportInit(WizardOSV):
TranslationExportInit()
class TranslationExportStart(WizardOSV):
class TranslationExportStart(ModelView):
"Export translation - file"
_description = __doc__
_name = 'ir.translation.export.start'
+2 -2
View File
@@ -1,7 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"UI menu"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
def one_in(i, j):
"""Check the presence of an element of setA in setB
@@ -72,7 +72,7 @@ ICONS = [(x, x) for x in [
]]
class UIMenu(OSV):
class UIMenu(ModelSQL, ModelView):
"UI menu"
_name = 'ir.ui.menu'
_description = __doc__
+4 -4
View File
@@ -1,7 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"View"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
from difflib import SequenceMatcher
import os
import logging
@@ -9,7 +9,7 @@ from lxml import etree
from trytond.backend import TableHandler
class View(OSV):
class View(ModelSQL, ModelView):
"View"
_name = 'ir.ui.view'
_description = __doc__
@@ -189,7 +189,7 @@ class View(OSV):
View()
class ViewShortcut(OSV):
class ViewShortcut(ModelSQL, ModelView):
"View shortcut"
_name = 'ir.ui.view_sc'
_description = __doc__
@@ -219,7 +219,7 @@ class ViewShortcut(OSV):
ViewShortcut()
class ViewTreeWidth(OSV):
class ViewTreeWidth(ModelSQL, ModelView):
"View Tree Width"
_name = 'ir.ui.view_tree_width'
_description = __doc__
@@ -1,19 +1,8 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL
from trytond.backend import DatabaseIntegrityError
import copy
import sys
import traceback
from trytond.tools import Cache, find_language_context
import time
from trytond.tools import Cache
from threading import Lock
from trytond.config import CONFIG
import logging
class OSV(ModelSQL, ModelView):
pass
import time
class Cacheable(object):
-2
View File
@@ -1,2 +0,0 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
from osv import *
-3
View File
@@ -1,3 +0,0 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from trytond.model.fields import *
-23
View File
@@ -1,23 +0,0 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
# -*- coding: utf-8 -*-
from trytond.model import ModelView, ModelSQL
class ORM(ModelSQL, ModelView):
"""
Object relationnal mapping to postgresql module
. Hierarchical structure
. Constraints consistency, validations
. Object meta Data depends on its status
. Optimised processing by complex query (multiple actions at once)
. Default fields value
. Permissions optimisation
. Persistant object: DB postgresql
. Datas conversions
. Multi-level caching system
. 2 different inheritancies
. Fields:
- classicals (varchar, integer, boolean, ...)
- relations (one2many, many2one, many2many)
- functions
"""
+2 -2
View File
@@ -1,9 +1,9 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
"Group"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
class Group(OSV):
class Group(ModelSQL, ModelView):
"Group"
_name = "res.group"
_description = __doc__
+7 -6
View File
@@ -1,6 +1,7 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Request"
from trytond.osv import OSV, fields
from trytond.model import ModelView, ModelSQL, fields
import time
import datetime
@@ -17,7 +18,7 @@ _PRIORITIES = [
('2', 'High'),
]
class Request(OSV):
class Request(ModelSQL, ModelView):
"Request"
_name = 'res.request'
_table = 'res_request'
@@ -157,7 +158,7 @@ class Request(OSV):
Request()
class RequestLink(OSV):
class RequestLink(ModelSQL, ModelView):
"Request link"
_name = 'res.request.link'
_description = __doc__
@@ -180,7 +181,7 @@ class RequestLink(OSV):
RequestLink()
class RequestHistory(OSV):
class RequestHistory(ModelSQL, ModelView):
"Request history"
_name = 'res.request.history'
_description = __doc__
@@ -220,7 +221,7 @@ class RequestHistory(OSV):
RequestHistory()
class RequestReference(OSV):
class RequestReference(ModelSQL, ModelView):
"Request Reference"
_name = 'res.request.reference'
_description = __doc__
+6 -6
View File
@@ -2,13 +2,13 @@
#this repository contains the full copyright notices and license terms.
"User"
import copy
from trytond.osv import fields, OSV
from trytond.wizard import Wizard, WizardOSV
from trytond.model import ModelView, ModelSQL, fields
from trytond.wizard import Wizard
from lxml import etree
from trytond.tools import Cache
class User(OSV):
class User(ModelSQL, ModelView):
"User"
_name = "res.user"
_description = __doc__
@@ -299,7 +299,7 @@ class User(OSV):
User()
class Warning(OSV):
class Warning(ModelSQL, ModelView):
'User Warning'
_name = 'res.user.warning'
_description = __doc__
@@ -325,7 +325,7 @@ class Warning(OSV):
Warning()
class Group(OSV):
class Group(ModelSQL, ModelView):
_name = 'res.group'
users = fields.Many2Many(
'res.user', 'res_group_user_rel', 'gid', 'uid', 'Users',
@@ -334,7 +334,7 @@ class Group(OSV):
Group()
class UserConfigInit(WizardOSV):
class UserConfigInit(ModelView):
'User Config Init'
_name = 'res.user.config.init'
_description = __doc__
+2 -3
View File
@@ -1,11 +1,10 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
"Test for Tree"
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
class MPTT(OSV):
class MPTT(ModelSQL, ModelView):
'Modified Preorder Tree Traversal'
_name = 'tests.mptt'
_description = __doc__
+3 -3
View File
@@ -3,12 +3,12 @@
import os
import base64
import time
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
from trytond.version import PACKAGE, VERSION, WEBSITE
from trytond.report import Report
class Collection(OSV):
class Collection(ModelSQL, ModelView):
"Collection"
_name = "webdav.collection"
_description = __doc__
@@ -562,7 +562,7 @@ class Collection(OSV):
Collection()
class Attachment(OSV):
class Attachment(ModelSQL, ModelView):
_name = 'ir.attachment'
def __init__(self):
-4
View File
@@ -198,7 +198,3 @@ class Wizard(object):
return self.execute(cursor, user, wiz_id, data, next_state,
context=context)
return res
class WizardOSV(ModelView):
pass
+7 -7
View File
@@ -1,14 +1,14 @@
#This file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms.
"Workflow"
import os
from trytond.osv import fields, OSV
from trytond.model import ModelView, ModelSQL, fields
from trytond.report import Report
from trytond.tools import exec_command_pipe
import expr
import base64
class Workflow(OSV):
class Workflow(ModelSQL, ModelView):
"Workflow"
_name = "workflow"
_table = "wkf"
@@ -31,7 +31,7 @@ class Workflow(OSV):
Workflow()
class WorkflowActivity(OSV):
class WorkflowActivity(ModelSQL, ModelView):
"Workflow activity"
_name = "workflow.activity"
_table = "wkf_activity"
@@ -91,7 +91,7 @@ class WorkflowActivity(OSV):
WorkflowActivity()
class WorkflowTransition(OSV):
class WorkflowTransition(ModelSQL, ModelView):
"Workflow transition"
_table = "wkf_transition"
_name = "workflow.transition"
@@ -115,7 +115,7 @@ class WorkflowTransition(OSV):
WorkflowTransition()
class WorkflowInstance(OSV):
class WorkflowInstance(ModelSQL, ModelView):
"Workflow instance"
_table = "wkf_instance"
_name = "workflow.instance"
@@ -231,7 +231,7 @@ class WorkflowInstance(OSV):
WorkflowInstance()
class WorkflowWorkitem(OSV):
class WorkflowWorkitem(ModelSQL, ModelView):
"Workflow workitem"
_table = "wkf_workitem"
_name = "workflow.workitem"
@@ -436,7 +436,7 @@ class WorkflowWorkitem(OSV):
WorkflowWorkitem()
class WorkflowTrigger(OSV):
class WorkflowTrigger(ModelSQL, ModelView):
"Workflow trigger"
_table = "wkf_trigger"
_name = "workflow.trigger"