Merge branch 'master' of openobject-server into mdv-gpl3-py26

Conflicts:

	bin/tools/translate.py

bzr revid: p_christ@hol.gr-20090128135050-bb1ueo5ovziijg00
This commit is contained in:
P. Christeas 2009-01-28 15:50:50 +02:00
commit caa5ca5ae2
71 changed files with 178243 additions and 135646 deletions

View File

@ -618,6 +618,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, **kwargs):
ver = release.major_version + '.' + package.data.get('version', '1.0') ver = release.major_version + '.' + package.data.get('version', '1.0')
# Set new modules and dependencies # Set new modules and dependencies
modobj.write(cr, 1, [mid], {'state': 'installed', 'latest_version': ver}) modobj.write(cr, 1, [mid], {'state': 'installed', 'latest_version': ver})
cr.commit()
# Update translations for all installed languages # Update translations for all installed languages
modobj.update_translations(cr, 1, [mid], None) modobj.update_translations(cr, 1, [mid], None)
cr.commit() cr.commit()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -102,36 +102,40 @@
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Sequences"> <form string="Sequences">
<separator colspan="4" string="Configuration"/> <group col="6" colspan="4">
<field colspan="4" name="name" select="1"/> <field name="name" select="1"/>
<field name="code" select="1"/> <field name="code" select="1"/>
<field name="active" select="1"/> <field name="active" select="2"/>
<field name="prefix"/>
<field name="suffix"/>
<field name="padding"/>
<field name="number_increment"/>
<field name="number_next"/>
<separator colspan="4" string="Legend (for prefix, suffix)"/>
<group col="8" colspan="4">
<group>
<label colspan="4" string="Year with century: %%(year)s"/>
<label colspan="4" string="Year without century: %%(y)s"/>
<label colspan="4" string="Month: %%(month)s"/>
<label colspan="4" string="Day: %%(day)s"/>
</group>
<group>
<label colspan="4" string="Day of the year: %%(doy)s"/>
<label colspan="4" string="Week of the year: %%(woy)s"/>
<label colspan="4" string="Day of the week (0:Monday): %%(weekday)s"/>
</group>
<group>
<label colspan="4" string="Hour 00->24: %%(h24)s"/>
<label colspan="4" string="Hour 00->12: %%(h12)s"/>
<label colspan="4" string="Minute: %%(min)s"/>
<label colspan="4" string="Seconde: %%(sec)s"/>
</group>
</group> </group>
<separator colspan="4" string=""/> <notebook>
<page string="Sequence">
<field name="prefix"/>
<field name="suffix"/>
<field name="padding"/>
<field name="number_increment"/>
<field name="number_next"/>
<separator colspan="4" string="Legend (for prefix, suffix)"/>
<group col="8" colspan="4">
<group>
<label colspan="4" string="Year with century: %%(year)s"/>
<label colspan="4" string="Year without century: %%(y)s"/>
<label colspan="4" string="Month: %%(month)s"/>
<label colspan="4" string="Day: %%(day)s"/>
</group>
<group>
<label colspan="4" string="Day of the year: %%(doy)s"/>
<label colspan="4" string="Week of the year: %%(woy)s"/>
<label colspan="4" string="Day of the week (0:Monday): %%(weekday)s"/>
</group>
<group>
<label colspan="4" string="Hour 00->24: %%(h24)s"/>
<label colspan="4" string="Hour 00->12: %%(h12)s"/>
<label colspan="4" string="Minute: %%(min)s"/>
<label colspan="4" string="Seconde: %%(sec)s"/>
</group>
</group>
</page>
</notebook>
</form> </form>
</field> </field>
</record> </record>

View File

@ -50,7 +50,7 @@ class report_custom(osv.osv):
'model':fields.char('Object', size=64, required=True), 'model':fields.char('Object', size=64, required=True),
'report_id': fields.integer('Report Ref.', required=True), 'report_id': fields.integer('Report Ref.', required=True),
'usage': fields.char('Action Usage', size=32), 'usage': fields.char('Action Usage', size=32),
'multi': fields.boolean('On multiple doc.', help="If set to true, the action will not be displayed on the right toolbar of a form views.") 'multi': fields.boolean('On multiple doc.', help="If set to true, the action will not be displayed on the right toolbar of a form view.")
} }
_defaults = { _defaults = {
'multi': lambda *a: False, 'multi': lambda *a: False,
@ -112,7 +112,7 @@ class report_xml(osv.osv):
'header': fields.boolean('Add RML header', 'header': fields.boolean('Add RML header',
help="Add or not the coporate RML header"), help="Add or not the coporate RML header"),
'multi': fields.boolean('On multiple doc.', 'multi': fields.boolean('On multiple doc.',
help="If set to true, the action will not be displayed on the right toolbar of a form views."), help="If set to true, the action will not be displayed on the right toolbar of a form view."),
'report_type': fields.selection([ 'report_type': fields.selection([
('pdf', 'pdf'), ('pdf', 'pdf'),
('html', 'html'), ('html', 'html'),
@ -122,8 +122,8 @@ class report_xml(osv.osv):
('odt', 'odt'), ('odt', 'odt'),
], string='Type', required=True), ], string='Type', required=True),
'groups_id': fields.many2many('res.groups', 'res_groups_report_rel', 'uid', 'gid', 'Groups'), 'groups_id': fields.many2many('res.groups', 'res_groups_report_rel', 'uid', 'gid', 'Groups'),
'attachment': fields.char('Save As Attachment Prefix', size=128, help='This is the filename of the attachment to store the printing result. Keep empty to not save the printed reports. You can use python expression using the object and time variables.'), 'attachment': fields.char('Save As Attachment Prefix', size=128, help='This is the filename of the attachment used to store the printing result. Keep empty to not save the printed reports. You can use a python expression with the object and time variables.'),
'attachment_use': fields.boolean('Reload from Attachment', help='If you check this, the second time the user print with same attachment name, it returns the previour report.') 'attachment_use': fields.boolean('Reload from Attachment', help='If you check this, then the second time the user prints with same attachment name, it returns the previous report.')
} }
_defaults = { _defaults = {
'type': lambda *a: 'ir.actions.report.xml', 'type': lambda *a: 'ir.actions.report.xml',
@ -187,8 +187,8 @@ class act_window(osv.osv):
'res_model': fields.char('Object', size=64), 'res_model': fields.char('Object', size=64),
'src_model': fields.char('Source Object', size=64), 'src_model': fields.char('Source Object', size=64),
'target': fields.selection([('current','Current Window'),('new','New Window')], 'Target Window'), 'target': fields.selection([('current','Current Window'),('new','New Window')], 'Target Window'),
'view_type': fields.selection((('tree','Tree'),('form','Form')),string='Type of view'), 'view_type': fields.selection((('tree','Tree'),('form','Form')),string='View Type'),
'view_mode': fields.char('Mode of view', size=250), 'view_mode': fields.char('View Mode', size=250),
'usage': fields.char('Action Usage', size=32), 'usage': fields.char('Action Usage', size=32),
'view_ids': fields.one2many('ir.actions.act_window.view', 'act_window_id', 'Views'), 'view_ids': fields.one2many('ir.actions.act_window.view', 'act_window_id', 'Views'),
'views': fields.function(_views_get_fnc, method=True, type='binary', string='Views'), 'views': fields.function(_views_get_fnc, method=True, type='binary', string='Views'),
@ -221,10 +221,10 @@ class act_window_view(osv.osv):
('form', 'Form'), ('form', 'Form'),
('graph', 'Graph'), ('graph', 'Graph'),
('calendar', 'Calendar'), ('calendar', 'Calendar'),
('gantt', 'Gantt')), string='Type of view', required=True), ('gantt', 'Gantt')), string='View Type', required=True),
'act_window_id': fields.many2one('ir.actions.act_window', 'Action', ondelete='cascade'), 'act_window_id': fields.many2one('ir.actions.act_window', 'Action', ondelete='cascade'),
'multi': fields.boolean('On multiple doc.', 'multi': fields.boolean('On Multiple Doc.',
help="If set to true, the action will not be displayed on the right toolbar of a form views."), help="If set to true, the action will not be displayed on the right toolbar of a form view."),
} }
_defaults = { _defaults = {
'multi': lambda *a: False, 'multi': lambda *a: False,
@ -234,13 +234,14 @@ act_window_view()
class act_wizard(osv.osv): class act_wizard(osv.osv):
_name = 'ir.actions.wizard' _name = 'ir.actions.wizard'
_inherit = 'ir.actions.actions'
_table = 'ir_act_wizard' _table = 'ir_act_wizard'
_sequence = 'ir_actions_id_seq' _sequence = 'ir_actions_id_seq'
_columns = { _columns = {
'name': fields.char('Wizard info', size=64, required=True, translate=True), 'name': fields.char('Wizard Info', size=64, required=True, translate=True),
'type': fields.char('Action type', size=32, required=True), 'type': fields.char('Action Type', size=32, required=True),
'wiz_name': fields.char('Wizard name', size=64, required=True), 'wiz_name': fields.char('Wizard Name', size=64, required=True),
'multi': fields.boolean('Action on multiple doc.', help="If set to true, the wizard will not be displayed on the right toolbar of a form views."), 'multi': fields.boolean('Action on Multiple Doc.', help="If set to true, the wizard will not be displayed on the right toolbar of a form view."),
'groups_id': fields.many2many('res.groups', 'res_groups_wizard_rel', 'uid', 'gid', 'Groups'), 'groups_id': fields.many2many('res.groups', 'res_groups_wizard_rel', 'uid', 'gid', 'Groups'),
'model': fields.char('Object', size=64), 'model': fields.char('Object', size=64),
} }
@ -257,7 +258,7 @@ class act_url(osv.osv):
_columns = { _columns = {
'name': fields.char('Action Name', size=64, translate=True), 'name': fields.char('Action Name', size=64, translate=True),
'type': fields.char('Action Type', size=32, required=True), 'type': fields.char('Action Type', size=32, required=True),
'url': fields.text('Action Url',required=True), 'url': fields.text('Action URL',required=True),
'target': fields.selection(( 'target': fields.selection((
('new', 'New Window'), ('new', 'New Window'),
('self', 'This Window')), ('self', 'This Window')),
@ -385,8 +386,8 @@ class actions_server(osv.osv):
_sequence = 'ir_actions_id_seq' _sequence = 'ir_actions_id_seq'
_order = 'sequence' _order = 'sequence'
_columns = { _columns = {
'name': fields.char('Action Name', required=True, size=64, help="Easy to Refer action by name i.e. One Sales Order -> Many Invoice"), 'name': fields.char('Action Name', required=True, size=64, help="Easy to Refer action by name e.g. One Sales Order -> Many Invoices"),
'condition' : fields.char('Condition', size=256, required=True, help="Condition that is to be test before execute action, i.e : object.list_price > object.cost_price"), 'condition' : fields.char('Condition', size=256, required=True, help="Condition that is to be tested before action is executed, e.g. object.list_price > object.cost_price"),
'state': fields.selection([ 'state': fields.selection([
('client_action','Client Action'), ('client_action','Client Action'),
('dummy','Dummy'), ('dummy','Dummy'),
@ -398,28 +399,28 @@ class actions_server(osv.osv):
('object_create','Create Object'), ('object_create','Create Object'),
('object_write','Write Object'), ('object_write','Write Object'),
('other','Multi Actions'), ('other','Multi Actions'),
], 'Action Type', required=True, size=32, help="Type of the Action that is to be execute"), ], 'Action Type', required=True, size=32, help="Type of the Action that is to be executed"),
'code':fields.text('Python Code', help="python code to be execute"), 'code':fields.text('Python Code', help="Python code to be executed"),
'sequence': fields.integer('Sequence', help="Important when you deal with the multi action, the execution order will be decided based on this, low number higher priority"), 'sequence': fields.integer('Sequence', help="Important when you deal with multiple actions, the execution order will be decided based on this, low number is higher priority."),
'model_id': fields.many2one('ir.model', 'Object', required=True, help="select the obect on which the action will work (read, write, create)"), 'model_id': fields.many2one('ir.model', 'Object', required=True, help="Select the obect on which the action will work (read, write, create)."),
'action_id': fields.many2one('ir.actions.actions', 'Client Action', help="Select the Ation Window, Report, Wizard to be execute"), 'action_id': fields.many2one('ir.actions.actions', 'Client Action', help="Select the Action Window, Report, Wizard to be executed."),
'trigger_name': fields.selection(_select_signals, string='Trigger Name', size=128, help="Select the Signal name that is to be "), 'trigger_name': fields.selection(_select_signals, string='Trigger Name', size=128, help="Select the Signal name that is to be used as the trigger."),
'wkf_model_id': fields.many2one('ir.model', 'Workflow on', help="Workflow to be execute on which model"), 'wkf_model_id': fields.many2one('ir.model', 'Workflow On', help="Workflow to be executed on this model."),
'trigger_obj_id': fields.many2one('ir.model.fields','Trigger On', help="select the object from the model on which the workflow will execute"), 'trigger_obj_id': fields.many2one('ir.model.fields','Trigger On', help="Select the object from the model on which the workflow will executed."),
'email': fields.char('Email Address', size=512, help="provides the fiels that will refer to the tiny to fetch the email address, i.e. you select the invoice, then `object.invoice_address_id.email` is the field which give the correct address"), 'email': fields.char('Email Address', size=512, help="Provides the fields that will be used to fetch the email address, e.g. when you select the invoice, then `object.invoice_address_id.email` is the field which gives the correct address"),
'subject': fields.char('Subject', size=1024, translate=True, help="Specify the subject, you can use the fields from the object. like `Hello [[ object.partner_id.name ]]`"), 'subject': fields.char('Subject', size=1024, translate=True, help="Specify the subject. You can use fields from the object, e.g. `Hello [[ object.partner_id.name ]]`"),
'message': fields.text('Message', translate=True, help="Specify the Message, you can use the fields from the object. like `Dear [[ object.partner_id.name ]]`"), 'message': fields.text('Message', translate=True, help="Specify the message. You can use the fields from the object. e.g. `Dear [[ object.partner_id.name ]]`"),
'mobile': fields.char('Mobile No', size=512, help="provides the fiels that will refer to the tiny to fetch the mobile number, i.e. you select the invoice, then `object.invoice_address_id.mobile` is the field which give the correct mobile number"), 'mobile': fields.char('Mobile No', size=512, help="Provides fields that be used to fetch the mobile number, e.g. you select the invoice, then `object.invoice_address_id.mobile` is the field which gives the correct mobile number"),
'sms': fields.char('SMS', size=160, translate=True), 'sms': fields.char('SMS', size=160, translate=True),
'child_ids': fields.many2many('ir.actions.server', 'rel_server_actions', 'server_id', 'action_id', 'Others Actions'), 'child_ids': fields.many2many('ir.actions.server', 'rel_server_actions', 'server_id', 'action_id', 'Other Actions'),
'usage': fields.char('Action Usage', size=32), 'usage': fields.char('Action Usage', size=32),
'type': fields.char('Action Type', size=32, required=True), 'type': fields.char('Action Type', size=32, required=True),
'srcmodel_id': fields.many2one('ir.model', 'Model', help="In which object you want to create / write the object if its empty refer to the Object field"), 'srcmodel_id': fields.many2one('ir.model', 'Model', help="Object in which you want to create / write the object. If it is empty then refer to the Object field."),
'fields_lines': fields.one2many('ir.server.object.lines', 'server_id', 'Fields Mapping'), 'fields_lines': fields.one2many('ir.server.object.lines', 'server_id', 'Field Mappings.'),
'record_id':fields.many2one('ir.model.fields', 'Create Id', help="Provide the field name from where the record id stores after the create operations, if its empty, you can not track the new record"), 'record_id':fields.many2one('ir.model.fields', 'Create Id', help="Provide the field name where the record id is stored after the create operations. If it is empty, you can not track the new record."),
'write_id':fields.char('Write Id', size=256, help="Provide the field name from where the record id refer for the write operation, if its empty it will refer to the active id of the object"), 'write_id':fields.char('Write Id', size=256, help="Provide the field name that the record id refers to for the write operation. If it is empty it will refer to the active id of the object."),
'loop_action':fields.many2one('ir.actions.server', 'Loop Action', help="select the action, which will be executes. Loop action will not be avaliable inside loop"), 'loop_action':fields.many2one('ir.actions.server', 'Loop Action', help="Select the action that will be executed. Loop action will not be avaliable inside loop."),
'expression':fields.char('Loop Expression', size=512, help="enter the field/expression that will return the list, i.e. select the sale order in Object, and we can have loop on sales order line. Expression = `object.order_line`"), 'expression':fields.char('Loop Expression', size=512, help="Enter the field/expression that will return the list. E.g. select the sale order in Object, and you can have loop on the sales order line. Expression = `object.order_line`."),
} }
_defaults = { _defaults = {
'state': lambda *a: 'dummy', 'state': lambda *a: 'dummy',
@ -670,12 +671,8 @@ actions_server()
class act_window_close(osv.osv): class act_window_close(osv.osv):
_name = 'ir.actions.act_window_close' _name = 'ir.actions.act_window_close'
_inherit = 'ir.actions.actions'
_table = 'ir_actions' _table = 'ir_actions'
_sequence = 'ir_actions_id_seq'
_columns = {
'name': fields.char('Action Name', size=64, translate=True),
'type': fields.char('Action Type', size=32, required=True),
}
_defaults = { _defaults = {
'type': lambda *a: 'ir.actions.act_window_close', 'type': lambda *a: 'ir.actions.act_window_close',
} }

View File

@ -47,9 +47,9 @@ class ir_cron(osv.osv, netsvc.Agent):
'interval_number': fields.integer('Interval Number'), 'interval_number': fields.integer('Interval Number'),
'interval_type': fields.selection( [('minutes', 'Minutes'), 'interval_type': fields.selection( [('minutes', 'Minutes'),
('hours', 'Hours'), ('work_days','Work Days'), ('days', 'Days'),('weeks', 'Weeks'), ('months', 'Months')], 'Interval Unit'), ('hours', 'Hours'), ('work_days','Work Days'), ('days', 'Days'),('weeks', 'Weeks'), ('months', 'Months')], 'Interval Unit'),
'numbercall': fields.integer('Number of calls', help='Number of time the function is called,\na negative number indicates that the function will always be called'), 'numbercall': fields.integer('Number of Calls', help='Number of time the function is called,\na negative number indicates that the function will always be called'),
'doall' : fields.boolean('Repeat missed'), 'doall' : fields.boolean('Repeat Missed'),
'nextcall' : fields.datetime('Next call date', required=True), 'nextcall' : fields.datetime('Next Call Date', required=True),
'model': fields.char('Object', size=64), 'model': fields.char('Object', size=64),
'function': fields.char('Function', size=64), 'function': fields.char('Function', size=64),
'args': fields.text('Arguments'), 'args': fields.text('Arguments'),

View File

@ -26,7 +26,7 @@ class ir_default(osv.osv):
_name = 'ir.default' _name = 'ir.default'
_columns = { _columns = {
'field_tbl': fields.char('Object',size=64), 'field_tbl': fields.char('Object',size=64),
'field_name': fields.char('Object field',size=64), 'field_name': fields.char('Object Field',size=64),
'value': fields.char('Default Value',size=64), 'value': fields.char('Default Value',size=64),
'uid': fields.many2one('res.users', 'Users'), 'uid': fields.many2one('res.users', 'Users'),
'page': fields.char('View',size=64), 'page': fields.char('View',size=64),

View File

@ -26,10 +26,10 @@ from osv import fields,osv
class ir_exports(osv.osv): class ir_exports(osv.osv):
_name = "ir.exports" _name = "ir.exports"
_columns = { _columns = {
'name': fields.char('Export name', size=128), 'name': fields.char('Export Name', size=128),
'resource': fields.char('Resource', size=128), 'resource': fields.char('Resource', size=128),
'export_fields': fields.one2many('ir.exports.line', 'export_id', 'export_fields': fields.one2many('ir.exports.line', 'export_id',
'Export Id'), 'Export ID'),
} }
ir_exports() ir_exports()
@ -37,8 +37,8 @@ ir_exports()
class ir_exports_line(osv.osv): class ir_exports_line(osv.osv):
_name = 'ir.exports.line' _name = 'ir.exports.line'
_columns = { _columns = {
'name': fields.char('Field name', size=64), 'name': fields.char('Field Name', size=64),
'export_id': fields.many2one('ir.exports', 'Exportation', select=True, ondelete='cascade'), 'export_id': fields.many2one('ir.exports', 'Export', select=True, ondelete='cascade'),
} }
ir_exports_line() ir_exports_line()

View File

@ -40,10 +40,10 @@ class ir_model(osv.osv):
_rec_name = 'name' _rec_name = 'name'
_columns = { _columns = {
'name': fields.char('Object Name', size=64, translate=True, required=True), 'name': fields.char('Object Name', size=64, translate=True, required=True),
'model': fields.char('Object Name', size=64, required=True, search=1), 'model': fields.char('Object', size=64, required=True, select=1),
'info': fields.text('Information'), 'info': fields.text('Information'),
'field_id': fields.one2many('ir.model.fields', 'model_id', 'Fields', required=True), 'field_id': fields.one2many('ir.model.fields', 'model_id', 'Fields', required=True),
'state': fields.selection([('manual','Custom Object'),('base','Base Object')],'Manualy Created',readonly=1), 'state': fields.selection([('manual','Custom Object'),('base','Base Object')],'Manually Created',readonly=True),
'access_ids': fields.one2many('ir.model.access', 'model_id', 'Access'), 'access_ids': fields.one2many('ir.model.access', 'model_id', 'Access'),
} }
_defaults = { _defaults = {
@ -94,18 +94,14 @@ ir_model()
class ir_model_grid(osv.osv): class ir_model_grid(osv.osv):
_name = 'ir.model.grid' _name = 'ir.model.grid'
_table = 'ir_model' _table = 'ir_model'
_inherit = 'ir.model'
_description = "Objects Security Grid" _description = "Objects Security Grid"
_rec_name = 'name'
_columns = {
'name': fields.char('Object', size=64),
'model': fields.char('Object Name', size=64),
}
def create(self, cr, uid, vals, context=None): def create(self, cr, uid, vals, context=None):
raise osv.except_osv('Error !', 'You cannot add an entry to this view !') raise osv.except_osv('Error !', 'You cannot add an entry to this view !')
def unlink(self, *args, **argv): def unlink(self, *args, **argv):
raise osv.except_osv('Error !', 'You cannot add an entry to this view !') raise osv.except_osv('Error !', 'You cannot delete an entry of this view !')
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'): def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
result = super(osv.osv, self).read(cr, uid, ids, fields, context, load) result = super(osv.osv, self).read(cr, uid, ids, fields, context, load)
@ -199,7 +195,7 @@ class ir_model_fields(osv.osv):
'model': fields.char('Object Name', size=64, required=True), 'model': fields.char('Object Name', size=64, required=True),
'relation': fields.char('Object Relation', size=64), 'relation': fields.char('Object Relation', size=64),
'relation_field': fields.char('Relation Field', size=64), 'relation_field': fields.char('Relation Field', size=64),
'model_id': fields.many2one('ir.model', 'Object id', required=True, select=True, ondelete='cascade'), 'model_id': fields.many2one('ir.model', 'Object ID', required=True, select=True, ondelete='cascade'),
'field_description': fields.char('Field Label', required=True, size=256), 'field_description': fields.char('Field Label', required=True, size=256),
'ttype': fields.selection(_get_fields_type, 'Field Type',size=64, required=True), 'ttype': fields.selection(_get_fields_type, 'Field Type',size=64, required=True),
'selection': fields.char('Field Selection',size=128), 'selection': fields.char('Field Selection',size=128),
@ -208,7 +204,7 @@ class ir_model_fields(osv.osv):
'select_level': fields.selection([('0','Not Searchable'),('1','Always Searchable'),('2','Advanced Search')],'Searchable', required=True), 'select_level': fields.selection([('0','Not Searchable'),('1','Always Searchable'),('2','Advanced Search')],'Searchable', required=True),
'translate': fields.boolean('Translate'), 'translate': fields.boolean('Translate'),
'size': fields.integer('Size'), 'size': fields.integer('Size'),
'state': fields.selection([('manual','Custom Field'),('base','Base Field')],'Manualy Created', required=True, readonly=True), 'state': fields.selection([('manual','Custom Field'),('base','Base Field')],'Manually Created', required=True, readonly=True),
'on_delete': fields.selection([('cascade','Cascade'),('set null','Set NULL')], 'On delete', help='On delete property for many2one fields'), 'on_delete': fields.selection([('cascade','Cascade'),('set null','Set NULL')], 'On delete', help='On delete property for many2one fields'),
'domain': fields.char('Domain', size=256), 'domain': fields.char('Domain', size=256),
'groups': fields.many2many('res.groups', 'ir_model_fields_group_rel', 'field_id', 'group_id', 'Groups'), 'groups': fields.many2many('res.groups', 'ir_model_fields_group_rel', 'field_id', 'group_id', 'Groups'),
@ -366,7 +362,8 @@ class ir_model_access(osv.osv):
except ValueError: except ValueError:
pass pass
def call_cache_clearing_methods(self): def call_cache_clearing_methods(self, cr):
self.check.clear_cache(cr.dbname) # clear the cache of check function
for model, method in self.__cache_clearing_methods: for model, method in self.__cache_clearing_methods:
getattr(self.pool.get(model), method)() getattr(self.pool.get(model), method)()
@ -374,21 +371,18 @@ class ir_model_access(osv.osv):
# Check rights on actions # Check rights on actions
# #
def write(self, cr, uid, *args, **argv): def write(self, cr, uid, *args, **argv):
self.call_cache_clearing_methods() self.call_cache_clearing_methods(cr)
res = super(ir_model_access, self).write(cr, uid, *args, **argv) res = super(ir_model_access, self).write(cr, uid, *args, **argv)
self.check.clear_cache(cr.dbname) # clear the cache of check function
return res return res
def create(self, cr, uid, *args, **argv): def create(self, cr, uid, *args, **argv):
self.call_cache_clearing_methods() self.call_cache_clearing_methods(cr)
res = super(ir_model_access, self).create(cr, uid, *args, **argv) res = super(ir_model_access, self).create(cr, uid, *args, **argv)
self.check.clear_cache(cr.dbname) # clear the cache of check function
return res return res
def unlink(self, cr, uid, *args, **argv): def unlink(self, cr, uid, *args, **argv):
self.call_cache_clearing_methods() self.call_cache_clearing_methods(cr)
res = super(ir_model_access, self).unlink(cr, uid, *args, **argv) res = super(ir_model_access, self).unlink(cr, uid, *args, **argv)
self.check.clear_cache(cr.dbname) # clear the cache of check function
return res return res
ir_model_access() ir_model_access()
@ -588,7 +582,7 @@ class ir_model_config(osv.osv):
_name = 'ir.model.config' _name = 'ir.model.config'
_columns = { _columns = {
'password': fields.char('Password', size=64), 'password': fields.char('Password', size=64),
'password_check': fields.char('confirmation', size=64), 'password_check': fields.char('Confirmation', size=64),
} }
def action_cancel(self, cr, uid, ids, context={}): def action_cancel(self, cr, uid, ids, context={}):

View File

@ -33,7 +33,7 @@ class report_custom(osv.osv):
'name': fields.char('Report Name', size=64, required=True, translate=True), 'name': fields.char('Report Name', size=64, required=True, translate=True),
'model_id': fields.many2one('ir.model','Object', required=True, change_default=True), 'model_id': fields.many2one('ir.model','Object', required=True, change_default=True),
'type': fields.selection([('table','Tabular'),('pie','Pie Chart'),('bar','Bar Chart'),('line','Line Plot')], "Report Type", size=64, required='True'), 'type': fields.selection([('table','Tabular'),('pie','Pie Chart'),('bar','Bar Chart'),('line','Line Plot')], "Report Type", size=64, required='True'),
'title': fields.char("Report title", size=64, required='True', translate=True), 'title': fields.char("Report Title", size=64, required='True', translate=True),
'print_format': fields.selection((('A4','a4'),('A5','a5')), 'Print format', required=True), 'print_format': fields.selection((('A4','a4'),('A5','a5')), 'Print format', required=True),
'print_orientation': fields.selection((('landscape','Landscape'),('portrait','Portrait')), 'Print orientation', required=True, size=16), 'print_orientation': fields.selection((('landscape','Landscape'),('portrait','Portrait')), 'Print orientation', required=True, size=16),
'repeat_header': fields.boolean('Repeat Header'), 'repeat_header': fields.boolean('Repeat Header'),
@ -134,19 +134,19 @@ class report_custom_fields(osv.osv):
_columns = { _columns = {
'name': fields.char('Name', size=64, required=True), 'name': fields.char('Name', size=64, required=True),
'report_id': fields.many2one('ir.report.custom', 'Report Ref', select=True), 'report_id': fields.many2one('ir.report.custom', 'Report Ref', select=True),
'field_child0': fields.many2one('ir.model.fields', 'field child0', required=True), 'field_child0': fields.many2one('ir.model.fields', 'Field child0', required=True),
'fc0_operande': fields.many2one('ir.model.fields', 'Constraint'), 'fc0_operande': fields.many2one('ir.model.fields', 'Constraint'),
'fc0_condition': fields.char('Condition', size=64), 'fc0_condition': fields.char('Condition', size=64),
'fc0_op': fields.selection((('>','>'),('<','<'),('==','='),('in','in'),('gety,==','(year)=')), 'Relation'), 'fc0_op': fields.selection((('>','>'),('<','<'),('==','='),('in','in'),('gety,==','(year)=')), 'Relation'),
'field_child1': fields.many2one('ir.model.fields', 'field child1'), 'field_child1': fields.many2one('ir.model.fields', 'Field child1'),
'fc1_operande': fields.many2one('ir.model.fields', 'Constraint'), 'fc1_operande': fields.many2one('ir.model.fields', 'Constraint'),
'fc1_condition': fields.char('condition', size=64), 'fc1_condition': fields.char('condition', size=64),
'fc1_op': fields.selection((('>','>'),('<','<'),('==','='),('in','in'),('gety,==','(year)=')), 'Relation'), 'fc1_op': fields.selection((('>','>'),('<','<'),('==','='),('in','in'),('gety,==','(year)=')), 'Relation'),
'field_child2': fields.many2one('ir.model.fields', 'field child2'), 'field_child2': fields.many2one('ir.model.fields', 'Field child2'),
'fc2_operande': fields.many2one('ir.model.fields', 'Constraint'), 'fc2_operande': fields.many2one('ir.model.fields', 'Constraint'),
'fc2_condition': fields.char('condition', size=64), 'fc2_condition': fields.char('condition', size=64),
'fc2_op': fields.selection((('>','>'),('<','<'),('==','='),('in','in'),('gety,==','(year)=')), 'Relation'), 'fc2_op': fields.selection((('>','>'),('<','<'),('==','='),('in','in'),('gety,==','(year)=')), 'Relation'),
'field_child3': fields.many2one('ir.model.fields', 'field child3'), 'field_child3': fields.many2one('ir.model.fields', 'Field child3'),
'fc3_operande': fields.many2one('ir.model.fields', 'Constraint'), 'fc3_operande': fields.many2one('ir.model.fields', 'Constraint'),
'fc3_condition': fields.char('condition', size=64), 'fc3_condition': fields.char('condition', size=64),
'fc3_op': fields.selection((('>','>'),('<','<'),('==','='),('in','in'),('gety,==','(year)=')), 'Relation'), 'fc3_op': fields.selection((('>','>'),('<','<'),('==','='),('in','in'),('gety,==','(year)=')), 'Relation'),
@ -154,10 +154,10 @@ class report_custom_fields(osv.osv):
'sequence': fields.integer('Sequence', required=True), 'sequence': fields.integer('Sequence', required=True),
'width': fields.integer('Fixed Width'), 'width': fields.integer('Fixed Width'),
'operation': fields.selection((('none', 'None'),('calc_sum','Calculate Sum'),('calc_avg','Calculate Average'),('calc_count','Calculate Count'),('calc_max', 'Get Max'))), 'operation': fields.selection((('none', 'None'),('calc_sum','Calculate Sum'),('calc_avg','Calculate Average'),('calc_count','Calculate Count'),('calc_max', 'Get Max'))),
'groupby' : fields.boolean('Group by'), 'groupby' : fields.boolean('Group By'),
'bgcolor': fields.char('Background Color', size=64), 'bgcolor': fields.char('Background Color', size=64),
'fontcolor': fields.char('Font color', size=64), 'fontcolor': fields.char('Font color', size=64),
'cumulate': fields.boolean('Cumulate') 'cumulate': fields.boolean('Accumulate')
} }
_defaults = { _defaults = {
'alignment': lambda *a: 'left', 'alignment': lambda *a: 'left',

View File

@ -31,7 +31,7 @@ class ir_rule_group(osv.osv):
_columns = { _columns = {
'name': fields.char('Name', size=128, select=1), 'name': fields.char('Name', size=128, select=1),
'model_id': fields.many2one('ir.model', 'Object',select=1, required=True), 'model_id': fields.many2one('ir.model', 'Object',select=1, required=True),
'global': fields.boolean('Global', select=1, help="Make the rule global or it needs to be put on a group or user"), 'global': fields.boolean('Global', select=1, help="Make the rule global, otherwise it needs to be put on a group or user"),
'rules': fields.one2many('ir.rule', 'rule_group', 'Tests', help="The rule is satisfied if at least one test is True"), 'rules': fields.one2many('ir.rule', 'rule_group', 'Tests', help="The rule is satisfied if at least one test is True"),
'groups': fields.many2many('res.groups', 'group_rule_group_rel', 'rule_group_id', 'group_id', 'Groups'), 'groups': fields.many2many('res.groups', 'group_rule_group_rel', 'rule_group_id', 'group_id', 'Groups'),
'users': fields.many2many('res.users', 'user_rule_group_rel', 'rule_group_id', 'user_id', 'Users'), 'users': fields.many2many('res.users', 'user_rule_group_rel', 'rule_group_id', 'user_id', 'Users'),

View File

@ -69,7 +69,7 @@ class ir_sequence(osv.osv):
'sec': time.strftime('%S'), 'sec': time.strftime('%S'),
} }
def get_id(self, cr, uid, sequence_id, test='id=%s'): def get_id(self, cr, uid, sequence_id, test='id=%s', context={}):
cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True FOR UPDATE', (sequence_id,)) cr.execute('select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where '+test+' and active=True FOR UPDATE', (sequence_id,))
res = cr.dictfetchone() res = cr.dictfetchone()
if res: if res:

View File

@ -225,10 +225,10 @@ class ir_ui_menu(osv.osv):
_columns = { _columns = {
'name': fields.char('Menu', size=64, required=True, translate=True), 'name': fields.char('Menu', size=64, required=True, translate=True),
'sequence': fields.integer('Sequence'), 'sequence': fields.integer('Sequence'),
'child_id' : fields.one2many('ir.ui.menu', 'parent_id','Child ids'), 'child_id' : fields.one2many('ir.ui.menu', 'parent_id','Child IDs'),
'parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', select=True), 'parent_id': fields.many2one('ir.ui.menu', 'Parent Menu', select=True),
'groups_id': many2many_unique('res.groups', 'ir_ui_menu_group_rel', 'groups_id': many2many_unique('res.groups', 'ir_ui_menu_group_rel',
'menu_id', 'gid', 'Groups', help="If you put groups, the visibility of this menu will be based on these groups. "\ 'menu_id', 'gid', 'Groups', help="If you have groups, the visibility of this menu will be based on these groups. "\
"If this field is empty, Open ERP will compute visibility based on the related object's read access."), "If this field is empty, Open ERP will compute visibility based on the related object's read access."),
'complete_name': fields.function(_get_full_name, method=True, 'complete_name': fields.function(_get_full_name, method=True,
string='Complete Name', type='char', size=128), string='Complete Name', type='char', size=128),

View File

@ -42,7 +42,7 @@ def _check_xml(self, cr, uid, ids, context={}):
class view_custom(osv.osv): class view_custom(osv.osv):
_name = 'ir.ui.view.custom' _name = 'ir.ui.view.custom'
_columns = { _columns = {
'ref_id': fields.many2one('ir.ui.view', 'Orignal View'), 'ref_id': fields.many2one('ir.ui.view', 'Original View'),
'user_id': fields.many2one('res.users', 'User'), 'user_id': fields.many2one('res.users', 'User'),
'arch': fields.text('View Architecture', required=True), 'arch': fields.text('View Architecture', required=True),
} }
@ -62,7 +62,7 @@ class view(osv.osv):
('gantt', 'Gantt')), 'View Type', required=True), ('gantt', 'Gantt')), 'View Type', required=True),
'arch': fields.text('View Architecture', required=True), 'arch': fields.text('View Architecture', required=True),
'inherit_id': fields.many2one('ir.ui.view', 'Inherited View', ondelete='cascade'), 'inherit_id': fields.many2one('ir.ui.view', 'Inherited View', ondelete='cascade'),
'field_parent': fields.char('Childs Field',size=64), 'field_parent': fields.char('Child Field',size=64),
} }
_defaults = { _defaults = {
'arch': lambda *a: '<?xml version="1.0"?>\n<tree string="Unknwown">\n\t<field name="name"/>\n</tree>', 'arch': lambda *a: '<?xml version="1.0"?>\n<tree string="Unknwown">\n\t<field name="name"/>\n</tree>',

View File

@ -79,7 +79,7 @@ class ir_values(osv.osv):
help="The kind of action or button in the client side that will trigger the action."), help="The kind of action or button in the client side that will trigger the action."),
'meta': fields.text('Meta Datas'), 'meta': fields.text('Meta Datas'),
'meta_unpickle': fields.function(_value_unpickle, fnct_inv=_value_pickle, 'meta_unpickle': fields.function(_value_unpickle, fnct_inv=_value_pickle,
method=True, type='text', string='Meta Datas'), method=True, type='text', string='Metadata'),
'res_id': fields.integer('Object ID', help="Keep 0 if the action must appear on all resources."), 'res_id': fields.integer('Object ID', help="Keep 0 if the action must appear on all resources."),
'user_id': fields.many2one('res.users', 'User', ondelete='cascade'), 'user_id': fields.many2one('res.users', 'User', ondelete='cascade'),
'company_id': fields.many2one('res.company', 'Company') 'company_id': fields.many2one('res.company', 'Company')

View File

@ -110,8 +110,8 @@ class wkf_activity(osv.osv):
'flow_stop': fields.boolean('Flow Stop'), 'flow_stop': fields.boolean('Flow Stop'),
'subflow_id': fields.many2one('workflow', 'Subflow'), 'subflow_id': fields.many2one('workflow', 'Subflow'),
'signal_send': fields.char('Signal (subflow.*)', size=32), 'signal_send': fields.char('Signal (subflow.*)', size=32),
'out_transitions': fields.one2many('workflow.transition', 'act_from', 'Outgoing transitions'), 'out_transitions': fields.one2many('workflow.transition', 'act_from', 'Outgoing Transitions'),
'in_transitions': fields.one2many('workflow.transition', 'act_to', 'Incoming transitions'), 'in_transitions': fields.one2many('workflow.transition', 'act_to', 'Incoming Transitions'),
} }
_defaults = { _defaults = {
'kind': lambda *a: 'dummy', 'kind': lambda *a: 'dummy',

View File

@ -140,7 +140,7 @@ class maintenance_contract_wizard(osv.osv_memory):
contract = self.read(cr, uid, ids, ['name', 'password'])[0] contract = self.read(cr, uid, ids, ['name', 'password'])[0]
contract_info = remote_contact(contract['name'], contract['password'], modules) contract_info = remote_contract(contract['name'], contract['password'], modules)
is_ok = contract_info['status'] in ('partial', 'full') is_ok = contract_info['status'] in ('partial', 'full')
if is_ok: if is_ok:

View File

@ -43,12 +43,12 @@ class module_repository(osv.osv):
_description = "Module Repository" _description = "Module Repository"
_columns = { _columns = {
'name': fields.char('Name', size=128), 'name': fields.char('Name', size=128),
'url': fields.char('Url', size=256, required=True), 'url': fields.char('URL', size=256, required=True),
'sequence': fields.integer('Sequence', required=True), 'sequence': fields.integer('Sequence', required=True),
'filter': fields.char('Filter', size=128, required=True, 'filter': fields.char('Filter', size=128, required=True,
help='Regexp to search module on the repository webpage:\n' help='Regexp to search module on the repository webpage:\n'
'- The first parenthesis must match the name of the module.\n' '- The first parenthesis must match the name of the module.\n'
'- The second parenthesis must match all the version number.\n' '- The second parenthesis must match the whole version number.\n'
'- The last parenthesis must match the extension of the module.'), '- The last parenthesis must match the extension of the module.'),
'active': fields.boolean('Active'), 'active': fields.boolean('Active'),
} }
@ -76,8 +76,8 @@ class module_category(osv.osv):
_columns = { _columns = {
'name': fields.char("Name", size=128, required=True), 'name': fields.char("Name", size=128, required=True),
'parent_id': fields.many2one('ir.module.category', 'Parent Category', select=True), 'parent_id': fields.many2one('ir.module.category', 'Parent Category', select=True),
'child_ids': fields.one2many('ir.module.category', 'parent_id', 'Parent Category'), 'child_ids': fields.one2many('ir.module.category', 'parent_id', 'Child Categories'),
'module_nr': fields.function(_module_nbr, method=True, string='# of Modules', type='integer') 'module_nr': fields.function(_module_nbr, method=True, string='Number of Modules', type='integer')
} }
_order = 'name' _order = 'name'
module_category() module_category()
@ -140,7 +140,7 @@ class module(osv.osv):
_columns = { _columns = {
'name': fields.char("Name", size=128, readonly=True, required=True), 'name': fields.char("Name", size=128, readonly=True, required=True),
'category_id': fields.many2one('ir.module.category', 'Category', readonly=True), 'category_id': fields.many2one('ir.module.category', 'Category', readonly=True),
'shortdesc': fields.char('Short description', size=256, readonly=True, translate=True), 'shortdesc': fields.char('Short Description', size=256, readonly=True, translate=True),
'description': fields.text("Description", readonly=True, translate=True), 'description': fields.text("Description", readonly=True, translate=True),
'author': fields.char("Author", size=128, readonly=True), 'author': fields.char("Author", size=128, readonly=True),
'website': fields.char("Website", size=256, readonly=True), 'website': fields.char("Website", size=256, readonly=True),
@ -487,6 +487,17 @@ class module(osv.osv):
logger.notifyChannel('init', netsvc.LOG_CRITICAL, 'module %s: invalid quality certificate: %s' % (mod.name, mod.certificate)) logger.notifyChannel('init', netsvc.LOG_CRITICAL, 'module %s: invalid quality certificate: %s' % (mod.name, mod.certificate))
raise osv.except_osv(_('Error'), _('Module %s: Invalid Quality Certificate') % (mod.name,)) raise osv.except_osv(_('Error'), _('Module %s: Invalid Quality Certificate') % (mod.name,))
def create(self, cr, uid, data, context={}):
id = super(module, self).create(cr, uid, data, context)
if data.get('name'):
self.pool.get('ir.model.data').create(cr, uid, {
'name': 'module_name_translation',
'model': 'ir.module.module',
'res_id': id,
'module': data['name']
})
return id
module() module()
class module_dependency(osv.osv): class module_dependency(osv.osv):

View File

@ -22,7 +22,7 @@
</record> </record>
<menuitem action="wizard_lang_install" id="menu_wizard_lang_install" parent="menu_translation" type="wizard"/> <menuitem action="wizard_lang_install" id="menu_wizard_lang_install" parent="menu_translation" type="wizard"/>
<record id="wizard_lang_export" model="ir.ui.view"> <record id="wizard_lang_export" model="ir.ui.view">
<field name="name">Export a Translation File</field> <field name="name">Export a Translation File</field>
<field name="model">wizard.module.lang.export</field> <field name="model">wizard.module.lang.export</field>
<field name="type">form</field> <field name="type">form</field>
@ -60,6 +60,7 @@
</form> </form>
</field> </field>
</record> </record>
<record id="action_wizard_lang_export" model="ir.actions.act_window"> <record id="action_wizard_lang_export" model="ir.actions.act_window">
<field name="name">Export a Translation File</field> <field name="name">Export a Translation File</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>

View File

@ -184,6 +184,10 @@
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">[[ module.description ]]</para>
<para style="terp_default_Bold_8"> <para style="terp_default_Bold_8">
<font color="white"> </font> <font color="white"> </font>
</para> </para>
@ -215,10 +219,6 @@
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
<para style="terp_default_8">
<font color="white"> </font>
</para>
<para style="terp_default_8">[[ module.description ]]</para>
<section> <section>
<para style="terp_default_9"> <para style="terp_default_9">
<font color="white"> </font> <font color="white"> </font>

View File

@ -73,7 +73,7 @@ class wizard_export_lang(osv.osv_memory):
'format': fields.selection( ( ('csv','CSV File'), ('po','PO File'), ('tgz', 'TGZ Archive')), 'File Format', required=True), 'format': fields.selection( ( ('csv','CSV File'), ('po','PO File'), ('tgz', 'TGZ Archive')), 'File Format', required=True),
'modules': fields.many2many('ir.module.module', 'rel_modules_langexport', 'wiz_id', 'module_id', 'Modules', domain=[('state','=','installed')]), 'modules': fields.many2many('ir.module.module', 'rel_modules_langexport', 'wiz_id', 'module_id', 'Modules', domain=[('state','=','installed')]),
'data': fields.binary('File', readonly=True), 'data': fields.binary('File', readonly=True),
'advice': fields.text('', readonly=True), 'advice': fields.text('Advice', readonly=True),
'state': fields.selection( ( ('choose','choose'), # choose language 'state': fields.selection( ( ('choose','choose'), # choose language
('get','get'), # get the file ('get','get'), # get the file
) ), ) ),

View File

@ -30,7 +30,7 @@ view_form="""<?xml version="1.0"?>
<form string="Import language"> <form string="Import language">
<image name="gtk-dialog-info" colspan="2"/> <image name="gtk-dialog-info" colspan="2"/>
<group colspan="2" col="4"> <group colspan="2" col="4">
<separator string="Import new language" colspan="4"/> <separator string="Import New Language" colspan="4"/>
<field name="name" width="200"/> <field name="name" width="200"/>
<field name="code"/> <field name="code"/>
<field name="data" colspan="4"/> <field name="data" colspan="4"/>

View File

@ -39,7 +39,7 @@ finish_form ='''<?xml version="1.0"?>
ask_form ='''<?xml version="1.0"?> ask_form ='''<?xml version="1.0"?>
<form string="Module import"> <form string="Module import">
<separator string="Module import" colspan="4"/> <separator string="Module Import" colspan="4"/>
<label string="Please give your module .ZIP file to import." colspan="4"/> <label string="Please give your module .ZIP file to import." colspan="4"/>
<field name="module_file"/> <field name="module_file"/>
</form> </form>

View File

@ -28,7 +28,7 @@ view_form_end = """<?xml version="1.0"?>
<form string="Language file loaded."> <form string="Language file loaded.">
<image name="gtk-dialog-info" colspan="2"/> <image name="gtk-dialog-info" colspan="2"/>
<group colspan="2" col="4"> <group colspan="2" col="4">
<separator string="Installation done" colspan="4"/> <separator string="Installation Done" colspan="4"/>
<label align="0.0" string="The selected language has been successfully installed.\nYou must change the preferences of the user and open a new menu to view changes." colspan="4"/> <label align="0.0" string="The selected language has been successfully installed.\nYou must change the preferences of the user and open a new menu to view changes." colspan="4"/>
</group> </group>
</form>""" </form>"""

View File

@ -78,7 +78,8 @@ class CountryState(osv.osv):
'country_id': fields.many2one('res.country', 'Country', 'country_id': fields.many2one('res.country', 'Country',
required=True), required=True),
'name': fields.char('State Name', size=64, required=True), 'name': fields.char('State Name', size=64, required=True),
'code': fields.char('State Code', size=3, required=True), 'code': fields.char('State Code', size=3,
help='The state code in three chars.\n', required=True),
} }
def name_search(self, cr, user, name='', args=None, operator='ilike', def name_search(self, cr, user, name='', args=None, operator='ilike',
context=None, limit=80): context=None, limit=80):

View File

@ -31,7 +31,7 @@
</record> </record>
<record id="ir_property_form" model="ir.actions.act_window"> <record id="ir_property_form" model="ir.actions.act_window">
<field name="name">Default properties</field> <field name="name">Default Properties</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">ir.property</field> <field name="res_model">ir.property</field>
<field name="view_type">form</field> <field name="view_type">form</field>

View File

@ -31,10 +31,14 @@ class res_partner_function(osv.osv):
_name = 'res.partner.function' _name = 'res.partner.function'
_description = 'Function of the contact' _description = 'Function of the contact'
_columns = { _columns = {
'name': fields.char('Function name', size=64, required=True), 'name': fields.char('Function Name', size=64, required=True),
'code': fields.char('Code', size=8), 'code': fields.char('Code', size=8),
'ref':fields.char('Notes', size=32, required=True),
} }
_order = 'name' _order = 'name'
_sql_constraints = [
('ref_uniq', 'unique (ref)', 'The Notes of the Partner Function must be unique !')
]
res_partner_function() res_partner_function()
@ -42,15 +46,15 @@ class res_payterm(osv.osv):
_description = 'Payment term' _description = 'Payment term'
_name = 'res.payterm' _name = 'res.payterm'
_columns = { _columns = {
'name': fields.char('Payment term (short name)', size=64), 'name': fields.char('Payment Term (short name)', size=64),
} }
res_payterm() res_payterm()
class res_partner_category(osv.osv): class res_partner_category(osv.osv):
def name_get(self, cr, uid, ids, context={}): def name_get(self, cr, uid, ids, context=None):
if not len(ids): if not len(ids):
return [] return []
reads = self.read(cr, uid, ids, ['name','parent_id'], context) reads = self.read(cr, uid, ids, ['name','parent_id'], context=context)
res = [] res = []
for record in reads: for record in reads:
name = record['name'] name = record['name']
@ -59,9 +63,10 @@ class res_partner_category(osv.osv):
res.append((record['id'], name)) res.append((record['id'], name))
return res return res
def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, unknow_dict): def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
res = self.name_get(cr, uid, ids) res = self.name_get(cr, uid, ids, context=context)
return dict(res) return dict(res)
def _check_recursion(self, cr, uid, ids): def _check_recursion(self, cr, uid, ids):
level = 100 level = 100
while len(ids): while len(ids):
@ -77,9 +82,9 @@ class res_partner_category(osv.osv):
_columns = { _columns = {
'name': fields.char('Category Name', required=True, size=64, translate=True), 'name': fields.char('Category Name', required=True, size=64, translate=True),
'parent_id': fields.many2one('res.partner.category', 'Parent Category', select=True), 'parent_id': fields.many2one('res.partner.category', 'Parent Category', select=True),
'complete_name': fields.function(_name_get_fnc, method=True, type="char", string='Name'), 'complete_name': fields.function(_name_get_fnc, method=True, type="char", string='Full Name'),
'child_ids': fields.one2many('res.partner.category', 'parent_id', 'Childs Category'), 'child_ids': fields.one2many('res.partner.category', 'parent_id', 'Child Categories'),
'active' : fields.boolean('Active', help="The active field allows you to hide the category, without removing it."), 'active' : fields.boolean('Active', help="The active field allows you to hide the category without removing it."),
} }
_constraints = [ _constraints = [
(_check_recursion, 'Error ! You can not create recursive categories.', ['parent_id']) (_check_recursion, 'Error ! You can not create recursive categories.', ['parent_id'])
@ -348,8 +353,8 @@ class res_partner_bank_type_fields(osv.osv):
_description='Bank type fields' _description='Bank type fields'
_name = 'res.partner.bank.type.field' _name = 'res.partner.bank.type.field'
_columns = { _columns = {
'name': fields.char('Field name', size=64, required=True, translate=True), 'name': fields.char('Field Name', size=64, required=True, translate=True),
'bank_type_id': fields.many2one('res.partner.bank.type', 'Bank type', required=True, ondelete='cascade'), 'bank_type_id': fields.many2one('res.partner.bank.type', 'Bank Type', required=True, ondelete='cascade'),
'required': fields.boolean('Required'), 'required': fields.boolean('Required'),
'readonly': fields.boolean('Readonly'), 'readonly': fields.boolean('Readonly'),
'size': fields.integer('Max. Size'), 'size': fields.integer('Max. Size'),
@ -369,7 +374,7 @@ class res_partner_bank(osv.osv):
result = [] result = []
type_ids = bank_type_obj.search(cr, uid, []) type_ids = bank_type_obj.search(cr, uid, [])
bank_types = bank_type_obj.browse(cr, uid, type_ids) bank_types = bank_type_obj.browse(cr, uid, type_ids, context=context)
for bank_type in bank_types: for bank_type in bank_types:
result.append((bank_type.code, bank_type.name)) result.append((bank_type.code, bank_type.name))
return result return result
@ -390,9 +395,9 @@ class res_partner_bank(osv.osv):
_columns = { _columns = {
'name': fields.char('Description', size=128), 'name': fields.char('Description', size=128),
'acc_number': fields.char('Account number', size=64, required=False), 'acc_number': fields.char('Account Number', size=64, required=False),
'bank': fields.many2one('res.bank', 'Bank'), 'bank': fields.many2one('res.bank', 'Bank'),
'owner_name': fields.char('Account owner', size=64), 'owner_name': fields.char('Account Owner', size=64),
'street': fields.char('Street', size=128), 'street': fields.char('Street', size=128),
'zip': fields.char('Zip', change_default=True, size=24), 'zip': fields.char('Zip', change_default=True, size=24),
'city': fields.char('City', size=128), 'city': fields.char('City', size=128),
@ -402,7 +407,7 @@ class res_partner_bank(osv.osv):
change_default=True, domain="[('country_id','=',country_id)]"), change_default=True, domain="[('country_id','=',country_id)]"),
'partner_id': fields.many2one('res.partner', 'Partner', required=True, 'partner_id': fields.many2one('res.partner', 'Partner', required=True,
ondelete='cascade', select=True), ondelete='cascade', select=True),
'state': fields.selection(_bank_type_get, 'Bank type', required=True, 'state': fields.selection(_bank_type_get, 'Bank Type', required=True,
change_default=True), change_default=True),
'sequence': fields.integer('Sequence'), 'sequence': fields.integer('Sequence'),
} }

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data> <data noupdate="True">
<!-- <!--
Resource: res.partner.title Resource: res.partner.title
@ -35,14 +35,15 @@
<record id="function_director" model="res.partner.function"> <record id="function_director" model="res.partner.function">
<field name="name">Director</field> <field name="name">Director</field>
<field name="code">CEO</field> <field name="ref">CEO</field>
</record> </record>
<record id="function_it" model="res.partner.function"> <record id="function_it" model="res.partner.function">
<field name="name">Chief Technical Officer</field> <field name="name">Chief Technical Officer</field>
<field name="code">CTO</field> <field name="ref">CTO</field>
</record> </record>
<record id="function_sale" model="res.partner.function"> <record id="function_sale" model="res.partner.function">
<field name="name">Salesman</field> <field name="name">Salesman</field>
<field name="ref">SAL</field>
</record> </record>
<!-- Default bank account description --> <!-- Default bank account description -->

View File

@ -61,7 +61,7 @@
</field> </field>
</record> </record>
<record id="action_partner_addess_tree" model="ir.actions.act_window"> <record id="action_partner_addess_tree" model="ir.actions.act_window">
<field name="name">Partner contacts</field> <field name="name">Partner Contacts</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner.address</field> <field name="res_model">res.partner.address</field>
<field name="view_type">tree</field> <field name="view_type">tree</field>
@ -161,7 +161,7 @@
<field name="model">res.partner.title</field> <field name="model">res.partner.title</field>
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Partners Titles"> <form string="Partner Titles">
<field name="name" select="1"/> <field name="name" select="1"/>
<field name="shortcut" select="1"/> <field name="shortcut" select="1"/>
<field name="domain"/> <field name="domain"/>
@ -177,7 +177,7 @@
<menuitem action="action_partner_title" id="menu_partner_title" parent="base.menu_base_config"/> <menuitem action="action_partner_title" id="menu_partner_title" parent="base.menu_base_config"/>
<record id="action_partner_title_partner" model="ir.actions.act_window"> <record id="action_partner_title_partner" model="ir.actions.act_window">
<field name="name">Partners Titles</field> <field name="name">Partner Titles</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner.title</field> <field name="res_model">res.partner.title</field>
<field name="view_type">form</field> <field name="view_type">form</field>
@ -186,7 +186,7 @@
<menuitem action="action_partner_title_partner" id="menu_partner_title_partner" parent="menu_partner_title"/> <menuitem action="action_partner_title_partner" id="menu_partner_title_partner" parent="menu_partner_title"/>
<record id="action_partner_title_contact" model="ir.actions.act_window"> <record id="action_partner_title_contact" model="ir.actions.act_window">
<field name="name">Contacts Titles</field> <field name="name">Contact Titles</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner.title</field> <field name="res_model">res.partner.title</field>
<field name="view_type">form</field> <field name="view_type">form</field>
@ -232,7 +232,7 @@
<notebook colspan="4"> <notebook colspan="4">
<page string="General"> <page string="General">
<field colspan="4" mode="form,tree" name="address" nolabel="1" select="1"> <field colspan="4" mode="form,tree" name="address" nolabel="1" select="1">
<form string="Partner contacts"> <form string="Partner Contacts">
<field name="name" select="2"/> <field name="name" select="2"/>
<field domain="[('domain', '=', 'contact')]" name="title" string="Type"/> <field domain="[('domain', '=', 'contact')]" name="title" string="Type"/>
<field name="function"/> <field name="function"/>
@ -252,7 +252,7 @@
<field name="mobile"/> <field name="mobile"/>
<field name="email" select="2" widget="email"/> <field name="email" select="2" widget="email"/>
</form> </form>
<tree string="Partner contacts"> <tree string="Partner Contacts">
<field name="name"/> <field name="name"/>
<field name="zip"/> <field name="zip"/>
<field name="city"/> <field name="city"/>
@ -347,7 +347,7 @@
<field name="model">res.payterm</field> <field name="model">res.payterm</field>
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Payment term"> <form string="Payment Term">
<field colspan="4" name="name"/> <field colspan="4" name="name"/>
</form> </form>
</field> </field>
@ -400,7 +400,7 @@
<newline/> <newline/>
<field name="sequence"/> <field name="sequence"/>
<field colspan="4" name="name"/> <field colspan="4" name="name"/>
<separator colspan="4" string="Bank account owner"/> <separator colspan="4" string="Bank Account Owner"/>
<field colspan="4" name="owner_name" select="2"/> <field colspan="4" name="owner_name" select="2"/>
<field colspan="4" name="street"/> <field colspan="4" name="street"/>
<field name="city"/> <field name="city"/>
@ -415,7 +415,7 @@
<field name="model">res.partner.bank</field> <field name="model">res.partner.bank</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Bank accounts"> <tree string="Bank Accounts">
<field name="state"/> <field name="state"/>
<field name="acc_number"/> <field name="acc_number"/>
<field name="partner_id"/> <field name="partner_id"/>
@ -468,7 +468,7 @@
<field name="model">res.partner.category</field> <field name="model">res.partner.category</field>
<field name="type">form</field> <field name="type">form</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Partner category"> <form string="Partner Category">
<field name="name" select="1"/> <field name="name" select="1"/>
<field name="active" select="1"/> <field name="active" select="1"/>
<field name="parent_id"/> <field name="parent_id"/>

View File

@ -29,7 +29,7 @@ class res_company(osv.osv):
_columns = { _columns = {
'name': fields.char('Company Name', size=64, required=True), 'name': fields.char('Company Name', size=64, required=True),
'parent_id': fields.many2one('res.company', 'Parent Company', select=True), 'parent_id': fields.many2one('res.company', 'Parent Company', select=True),
'child_ids': fields.one2many('res.company', 'parent_id', 'Childs Company'), 'child_ids': fields.one2many('res.company', 'parent_id', 'Child Companies'),
'partner_id': fields.many2one('res.partner', 'Partner', required=True), 'partner_id': fields.many2one('res.partner', 'Partner', required=True),
'rml_header1': fields.char('Report Header', size=200), 'rml_header1': fields.char('Report Header', size=200),
'rml_footer1': fields.char('Report Footer 1', size=200), 'rml_footer1': fields.char('Report Footer 1', size=200),

View File

@ -51,7 +51,7 @@ class res_currency(osv.osv):
_columns = { _columns = {
'name': fields.char('Currency', size=32, required=True), 'name': fields.char('Currency', size=32, required=True),
'code': fields.char('Code', size=3), 'code': fields.char('Code', size=3),
'rate': fields.function(_current_rate, method=True, string='Current rate', digits=(12,6), 'rate': fields.function(_current_rate, method=True, string='Current Rate', digits=(12,6),
help='The rate of the currency to the currency of rate 1'), help='The rate of the currency to the currency of rate 1'),
'rate_ids': fields.one2many('res.currency.rate', 'currency_id', 'Rates'), 'rate_ids': fields.one2many('res.currency.rate', 'currency_id', 'Rates'),
'accuracy': fields.integer('Computational Accuracy'), 'accuracy': fields.integer('Computational Accuracy'),

View File

@ -62,7 +62,7 @@ class res_request(osv.osv):
return (ids, ids2) return (ids, ids2)
_columns = { _columns = {
'create_date': fields.datetime('Created date', readonly=True), 'create_date': fields.datetime('Created Date', readonly=True),
'name': fields.char('Subject', states={'waiting':[('readonly',True)],'active':[('readonly',True)],'closed':[('readonly',True)]}, required=True, size=128), 'name': fields.char('Subject', states={'waiting':[('readonly',True)],'active':[('readonly',True)],'closed':[('readonly',True)]}, required=True, size=128),
'active': fields.boolean('Active'), 'active': fields.boolean('Active'),
'priority': fields.selection([('0','Low'),('1','Normal'),('2','High')], 'Priority', states={'waiting':[('readonly',True)],'closed':[('readonly',True)]}, required=True), 'priority': fields.selection([('0','Low'),('1','Normal'),('2','High')], 'Priority', states={'waiting':[('readonly',True)],'closed':[('readonly',True)]}, required=True),

View File

@ -48,7 +48,7 @@ class groups(osv.osv):
res = super(groups, self).write(cr, uid, ids, vals, context=context) res = super(groups, self).write(cr, uid, ids, vals, context=context)
# Restart the cache on the company_get method # Restart the cache on the company_get method
self.pool.get('ir.rule').domain_get.clear_cache(cr.dbname) self.pool.get('ir.rule').domain_get.clear_cache(cr.dbname)
self.pool.get('ir.model.access').check.clear_cache(cr.dbname) self.pool.get('ir.model.access').call_cache_clearing_methods(cr)
return res return res
def create(self, cr, uid, vals, context=None): def create(self, cr, uid, vals, context=None):
@ -66,7 +66,7 @@ class roles(osv.osv):
_columns = { _columns = {
'name': fields.char('Role Name', size=64, required=True), 'name': fields.char('Role Name', size=64, required=True),
'parent_id': fields.many2one('res.roles', 'Parent', select=True), 'parent_id': fields.many2one('res.roles', 'Parent', select=True),
'child_id': fields.one2many('res.roles', 'parent_id', 'Childs'), 'child_id': fields.one2many('res.roles', 'parent_id', 'Children'),
'users': fields.many2many('res.users', 'res_roles_users_rel', 'rid', 'uid', 'Users'), 'users': fields.many2many('res.users', 'res_roles_users_rel', 'rid', 'uid', 'Users'),
} }
_defaults = { _defaults = {
@ -111,7 +111,7 @@ class users(osv.osv):
} }
def read(self,cr, uid, ids, fields=None, context=None, load='_classic_read'): def read(self,cr, uid, ids, fields=None, context=None, load='_classic_read'):
def override_password(o): def override_password(o):
if 'password' in o: if 'password' in o and ( 'id' not in o or o['id'] != uid ):
o['password'] = '********' o['password'] = '********'
return o return o
@ -168,6 +168,7 @@ class users(osv.osv):
self.company_get.clear_cache(cr.dbname) self.company_get.clear_cache(cr.dbname)
# Restart the cache on the company_get method # Restart the cache on the company_get method
self.pool.get('ir.rule').domain_get.clear_cache(cr.dbname) self.pool.get('ir.rule').domain_get.clear_cache(cr.dbname)
self.pool.get('ir.model.access').call_cache_clearing_methods(cr)
return res return res
def unlink(self, cr, uid, ids, context=None): def unlink(self, cr, uid, ids, context=None):

View File

@ -255,9 +255,9 @@ class expression(object):
else: else:
params = [] params = []
if (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='): if (((right == False) and (type(right)==bool)) or (right is None)) and (operator == '='):
query = '%s IS NULL' % left query = '%s.%s IS NULL' % (table._table, left)
elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']): elif (((right == False) and (type(right)==bool)) or right is None) and (operator in ['<>', '!=']):
query = '%s IS NOT NULL' % left query = '%s.%s IS NOT NULL' % (table._table, left)
else: else:
if left == 'id': if left == 'id':
query = '%s.id %s %%s' % (table._table, operator) query = '%s.id %s %%s' % (table._table, operator)

View File

@ -115,7 +115,7 @@ class browse_record(object):
def __init__(self, cr, uid, id, table, cache, context=None, list_class = None, fields_process={}): def __init__(self, cr, uid, id, table, cache, context=None, list_class = None, fields_process={}):
''' '''
table : the object (inherited from orm) table : the object (inherited from orm)
context : a dictionnary with an optionnal context context : a dictionary with an optional context
''' '''
if not context: if not context:
context = {} context = {}
@ -178,7 +178,8 @@ class browse_record(object):
if f._type in self._fields_process: if f._type in self._fields_process:
for d in datas: for d in datas:
d[n] = self._fields_process[f._type](d[n]) d[n] = self._fields_process[f._type](d[n])
d[n].set_value(d[n], self, f) if d[n]:
d[n].set_value(self._cr, self._uid, d[n], self, f)
if not datas: if not datas:
@ -686,7 +687,7 @@ class orm_template(object):
if not fun(self, cr, uid, ids): if not fun(self, cr, uid, ids):
translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, source=msg) or msg
error_msgs.append( error_msgs.append(
_("Error occured while validating the field(s) %s: %s") % (','.join(fields), translated_msg) _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)
) )
self._invalids.update(fields) self._invalids.update(fields)
if error_msgs: if error_msgs:
@ -899,7 +900,7 @@ class orm_template(object):
model = res[0][1] model = res[0][1]
res.insert(0, ("Can't find field '%s' in the following view parts composing the view of object model '%s':" % (field, model), None)) res.insert(0, ("Can't find field '%s' in the following view parts composing the view of object model '%s':" % (field, model), None))
msg = "\n * ".join([r[0] for r in res]) msg = "\n * ".join([r[0] for r in res])
msg += "\n\nEither you wrongly customized this view, or some modules bringing those views are not compatible with your current data model" msg += "\n\nEither you wrongly customised this view, or some modules bringing those views are not compatible with your current data model"
netsvc.Logger().notifyChannel('orm', netsvc.LOG_ERROR, msg) netsvc.Logger().notifyChannel('orm', netsvc.LOG_ERROR, msg)
raise except_orm('View error', msg) raise except_orm('View error', msg)
@ -1385,7 +1386,7 @@ class orm(orm_template):
def _parent_store_compute(self, cr): def _parent_store_compute(self, cr):
logger = netsvc.Logger() logger = netsvc.Logger()
logger.notifyChannel('init', netsvc.LOG_INFO, 'Computing parent left and right for table %s...' % (self._table, )) logger.notifyChannel('orm', netsvc.LOG_INFO, 'Computing parent left and right for table %s...' % (self._table, ))
def browse_rec(root, pos=0): def browse_rec(root, pos=0):
# TODO: set order # TODO: set order
where = self._parent_name+'='+str(root) where = self._parent_name+'='+str(root)
@ -1400,12 +1401,18 @@ class orm(orm_template):
pos2 = browse_rec(id[0], pos2) pos2 = browse_rec(id[0], pos2)
cr.execute('update '+self._table+' set parent_left=%s, parent_right=%s where id=%s', (pos,pos2,root)) cr.execute('update '+self._table+' set parent_left=%s, parent_right=%s where id=%s', (pos,pos2,root))
return pos2+1 return pos2+1
browse_rec(None) query = 'SELECT id FROM '+self._table+' WHERE '+self._parent_name+' IS NULL'
if self._parent_order:
query += ' order by '+self._parent_order
pos = 0
cr.execute(query)
for (root,) in cr.fetchall():
pos = browse_rec(root, pos)
return True return True
def _update_store(self, cr, f, k): def _update_store(self, cr, f, k):
logger = netsvc.Logger() logger = netsvc.Logger()
logger.notifyChannel('init', netsvc.LOG_INFO, "storing computed values of fields.function '%s'" % (k,)) logger.notifyChannel('orm', netsvc.LOG_INFO, "storing computed values of fields.function '%s'" % (k,))
ss = self._columns[k]._symbol_set ss = self._columns[k]._symbol_set
update_query = 'UPDATE "%s" SET "%s"=%s WHERE id=%%s' % (self._table, k, ss[0]) update_query = 'UPDATE "%s" SET "%s"=%s WHERE id=%%s' % (self._table, k, ss[0])
cr.execute('select id from '+self._table) cr.execute('select id from '+self._table)
@ -1442,11 +1449,11 @@ class orm(orm_template):
""", (self._table, 'parent_left')) """, (self._table, 'parent_left'))
if not cr.rowcount: if not cr.rowcount:
if 'parent_left' not in self._columns: if 'parent_left' not in self._columns:
logger.notifyChannel('init', netsvc.LOG_ERROR, 'create a column parent_left on object %s: fields.integer(\'Left Parent\', select=1)' % (self._table, )) logger.notifyChannel('orm', netsvc.LOG_ERROR, 'create a column parent_left on object %s: fields.integer(\'Left Parent\', select=1)' % (self._table, ))
if 'parent_right' not in self._columns: if 'parent_right' not in self._columns:
logger.notifyChannel('init', netsvc.LOG_ERROR, 'create a column parent_right on object %s: fields.integer(\'Right Parent\', select=1)' % (self._table, )) logger.notifyChannel('orm', netsvc.LOG_ERROR, 'create a column parent_right on object %s: fields.integer(\'Right Parent\', select=1)' % (self._table, ))
if self._columns[self._parent_name].ondelete<>'cascade': if self._columns[self._parent_name].ondelete<>'cascade':
logger.notifyChannel('init', netsvc.LOG_ERROR, "the columns %s on object must be set as ondelete='cascasde'" % (self._name, self._parent_name)) logger.notifyChannel('orm', netsvc.LOG_ERROR, "the columns %s on object must be set as ondelete='cascasde'" % (self._name, self._parent_name))
cr.execute('ALTER TABLE "%s" ADD COLUMN "parent_left" INTEGER' % (self._table,)) cr.execute('ALTER TABLE "%s" ADD COLUMN "parent_left" INTEGER' % (self._table,))
cr.execute('ALTER TABLE "%s" ADD COLUMN "parent_right" INTEGER' % (self._table,)) cr.execute('ALTER TABLE "%s" ADD COLUMN "parent_right" INTEGER' % (self._table,))
cr.commit() cr.commit()
@ -1471,15 +1478,21 @@ class orm(orm_template):
# iterate on the database columns to drop the NOT NULL constraints # iterate on the database columns to drop the NOT NULL constraints
# of fields which were required but have been removed # of fields which were required but have been removed
cr.execute( columns = [c for c in self._columns if not (isinstance(self._columns[c], fields.function) and not self._columns[c].store)]
"SELECT a.attname, a.attnotnull "\ columns += ('id', 'write_uid', 'write_date', 'create_uid', 'create_date') # openerp access columns
"FROM pg_class c, pg_attribute a "\ cr.execute("SELECT a.attname, a.attnotnull"
"WHERE c.oid=a.attrelid AND c.relname=%s", (self._table,)) " FROM pg_class c, pg_attribute a"
db_columns = cr.dictfetchall() " WHERE c.relname=%%s"
for column in db_columns: " AND c.oid=a.attrelid"
if column['attname'] not in ('id', 'oid', 'tableoid', 'ctid', 'xmin', 'xmax', 'cmin', 'cmax'): " AND a.attisdropped=%%s"
if column['attnotnull'] and column['attname'] not in self._columns: " AND pg_catalog.format_type(a.atttypid, a.atttypmod) NOT IN ('cid', 'tid', 'oid', 'xid')"
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" DROP NOT NULL' % (self._table, column['attname'])) " AND a.attname NOT IN (%s)" % ",".join(['%s']*len(columns)),
[self._table, False] + columns)
for column in cr.dictfetchall():
# TODO display this information only when all modules are loaded
logger.notifyChannel("orm", netsvc.LOG_DEBUG, "column %s is in the table %s but not in the corresponding object %s" % (column['attname'], self._table, self._name))
if column['attnotnull']:
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" DROP NOT NULL' % (self._table, column['attname']))
# iterate on the "object columns" # iterate on the "object columns"
todo_update_store = [] todo_update_store = []
@ -1529,9 +1542,9 @@ class orm(orm_template):
query = 'UPDATE "%s" SET "%s"=%s' % (self._table, k, ss[0]) query = 'UPDATE "%s" SET "%s"=%s' % (self._table, k, ss[0])
cr.execute(query, (ss[1](default),)) cr.execute(query, (ss[1](default),))
cr.commit() cr.commit()
logger.notifyChannel('init', netsvc.LOG_DEBUG, 'setting default value of new column %s of table %s'% (k, self._table)) logger.notifyChannel('orm', netsvc.LOG_DEBUG, 'setting default value of new column %s of table %s'% (k, self._table))
elif not create: elif not create:
logger.notifyChannel('init', netsvc.LOG_DEBUG, 'creating new column %s of table %s'% (k, self._table)) logger.notifyChannel('orm', netsvc.LOG_DEBUG, 'creating new column %s of table %s'% (k, self._table))
if isinstance(f, fields.function): if isinstance(f, fields.function):
order = 10 order = 10
@ -1556,7 +1569,7 @@ class orm(orm_template):
cr.commit() cr.commit()
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" SET NOT NULL' % (self._table, k)) cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" SET NOT NULL' % (self._table, k))
except Exception, e: except Exception, e:
logger.notifyChannel('init', netsvc.LOG_WARNING, 'WARNING: unable to set column %s of table %s not null !\nTry to re-run: openerp-server.py --update=module\nIf it doesn\'t work, update records and execute manually:\nALTER TABLE %s ALTER COLUMN %s SET NOT NULL' % (k, self._table, self._table, k)) logger.notifyChannel('orm', netsvc.LOG_WARNING, 'WARNING: unable to set column %s of table %s not null !\nTry to re-run: openerp-server.py --update=module\nIf it doesn\'t work, update records and execute manually:\nALTER TABLE %s ALTER COLUMN %s SET NOT NULL' % (k, self._table, self._table, k))
cr.commit() cr.commit()
elif len(res)==1: elif len(res)==1:
f_pg_def = res[0] f_pg_def = res[0]
@ -1564,7 +1577,7 @@ class orm(orm_template):
f_pg_size = f_pg_def['size'] f_pg_size = f_pg_def['size']
f_pg_notnull = f_pg_def['attnotnull'] f_pg_notnull = f_pg_def['attnotnull']
if isinstance(f, fields.function) and not f.store: if isinstance(f, fields.function) and not f.store:
logger.notifyChannel('init', netsvc.LOG_INFO, 'column %s (%s) in table %s removed: converted to a function !\n' % (k, f.string, self._table)) logger.notifyChannel('orm', netsvc.LOG_INFO, 'column %s (%s) in table %s removed: converted to a function !\n' % (k, f.string, self._table))
cr.execute('ALTER TABLE %s DROP COLUMN %s'% (self._table, k)) cr.execute('ALTER TABLE %s DROP COLUMN %s'% (self._table, k))
cr.commit() cr.commit()
f_obj_type = None f_obj_type = None
@ -1580,7 +1593,7 @@ class orm(orm_template):
('date', 'datetime', 'TIMESTAMP', '::TIMESTAMP'), ('date', 'datetime', 'TIMESTAMP', '::TIMESTAMP'),
] ]
if f_pg_type == 'varchar' and f._type == 'char' and f_pg_size != f.size: if f_pg_type == 'varchar' and f._type == 'char' and f_pg_size != f.size:
logger.notifyChannel('init', netsvc.LOG_INFO, "column '%s' in table '%s' changed size" % (k, self._table)) logger.notifyChannel('orm', netsvc.LOG_INFO, "column '%s' in table '%s' changed size" % (k, self._table))
cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO temp_change_size' % (self._table, k)) cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO temp_change_size' % (self._table, k))
cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" VARCHAR(%d)' % (self._table, k, f.size)) cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" VARCHAR(%d)' % (self._table, k, f.size))
cr.execute('UPDATE "%s" SET "%s"=temp_change_size::VARCHAR(%d)' % (self._table, k, f.size)) cr.execute('UPDATE "%s" SET "%s"=temp_change_size::VARCHAR(%d)' % (self._table, k, f.size))
@ -1588,7 +1601,7 @@ class orm(orm_template):
cr.commit() cr.commit()
for c in casts: for c in casts:
if (f_pg_type==c[0]) and (f._type==c[1]): if (f_pg_type==c[0]) and (f._type==c[1]):
logger.notifyChannel('init', netsvc.LOG_INFO, "column '%s' in table '%s' changed type to %s." % (k, self._table, c[1])) logger.notifyChannel('orm', netsvc.LOG_INFO, "column '%s' in table '%s' changed type to %s." % (k, self._table, c[1]))
ok = True ok = True
cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO temp_change_size' % (self._table, k)) cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO temp_change_size' % (self._table, k))
cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" %s' % (self._table, k, c[2])) cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" %s' % (self._table, k, c[2]))
@ -1598,7 +1611,7 @@ class orm(orm_template):
if f_pg_type != f_obj_type: if f_pg_type != f_obj_type:
if not ok: if not ok:
logger.notifyChannel('init', netsvc.LOG_WARNING, "column '%s' in table '%s' has changed type (DB = %s, def = %s) but unable to migrate this change !" % (k, self._table, f_pg_type, f._type)) logger.notifyChannel('orm', netsvc.LOG_WARNING, "column '%s' in table '%s' has changed type (DB = %s, def = %s) but unable to migrate this change !" % (k, self._table, f_pg_type, f._type))
# if the field is required and hasn't got a NOT NULL constraint # if the field is required and hasn't got a NOT NULL constraint
if f.required and f_pg_notnull == 0: if f.required and f_pg_notnull == 0:
@ -1615,7 +1628,7 @@ class orm(orm_template):
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" SET NOT NULL' % (self._table, k)) cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" SET NOT NULL' % (self._table, k))
cr.commit() cr.commit()
except Exception, e: except Exception, e:
logger.notifyChannel('init', netsvc.LOG_WARNING, 'unable to set a NOT NULL constraint on column %s of the %s table !\nIf you want to have it, you should update the records and execute manually:\nALTER TABLE %s ALTER COLUMN %s SET NOT NULL' % (k, self._table, self._table, k)) logger.notifyChannel('orm', netsvc.LOG_WARNING, 'unable to set a NOT NULL constraint on column %s of the %s table !\nIf you want to have it, you should update the records and execute manually:\nALTER TABLE %s ALTER COLUMN %s SET NOT NULL' % (k, self._table, self._table, k))
cr.commit() cr.commit()
elif not f.required and f_pg_notnull == 1: elif not f.required and f_pg_notnull == 1:
cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" DROP NOT NULL' % (self._table, k)) cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" DROP NOT NULL' % (self._table, k))
@ -1661,7 +1674,6 @@ class orm(orm_template):
cr.execute('ALTER TABLE "' + self._table + '" ADD FOREIGN KEY ("' + k + '") REFERENCES "' + ref + '" ON DELETE ' + f.ondelete) cr.execute('ALTER TABLE "' + self._table + '" ADD FOREIGN KEY ("' + k + '") REFERENCES "' + ref + '" ON DELETE ' + f.ondelete)
cr.commit() cr.commit()
else: else:
logger = netsvc.Logger()
logger.notifyChannel('orm', netsvc.LOG_ERROR, "Programming error !") logger.notifyChannel('orm', netsvc.LOG_ERROR, "Programming error !")
for order,f,k in todo_update_store: for order,f,k in todo_update_store:
todo_end.append((order, self._update_store, (f, k))) todo_end.append((order, self._update_store, (f, k)))
@ -1678,7 +1690,7 @@ class orm(orm_template):
cr.execute('alter table "%s" add constraint "%s_%s" %s' % (self._table, self._table, key, con,)) cr.execute('alter table "%s" add constraint "%s_%s" %s' % (self._table, self._table, key, con,))
cr.commit() cr.commit()
except: except:
logger.notifyChannel('init', netsvc.LOG_WARNING, 'unable to add \'%s\' constraint on table %s !\n If you want to have it, you should update the records and execute manually:\nALTER table %s ADD CONSTRAINT %s_%s %s' % (con, self._table, self._table, self._table, key, con,)) logger.notifyChannel('orm', netsvc.LOG_WARNING, 'unable to add \'%s\' constraint on table %s !\n If you want to have it, you should update the records and execute manually:\nALTER table %s ADD CONSTRAINT %s_%s %s' % (con, self._table, self._table, self._table, key, con,))
if create: if create:
if hasattr(self, "_sql"): if hasattr(self, "_sql"):

View File

@ -22,7 +22,8 @@
############################################################################## ##############################################################################
name = 'openerp-server' name = 'openerp-server'
version = '5.0.0_rc3' version = '5.0.0'
release = '0_rc3'
major_version = '5.0' major_version = '5.0'
description = 'OpenERP Server' description = 'OpenERP Server'
long_desc = '''\ long_desc = '''\

View File

@ -641,8 +641,10 @@ class _rml_flowable(object):
else: else:
import base64 import base64
image_data = base64.decodestring(node.firstChild.nodeValue) image_data = base64.decodestring(node.firstChild.nodeValue)
image = StringIO() image = StringIO()
image.write(image_data) image.write(image_data)
image.seek(0)
return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) return platypus.Image(image, mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height'])))
else: else:
return platypus.Image(node.getAttribute('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height']))) return platypus.Image(node.getAttribute('file'), mask=(250,255,250,255,250,255), **(utils.attr_get(node, ['width','height'])))

View File

@ -138,64 +138,85 @@ _LOCALE2WIN32 = {
} }
class _format(object): class _format(object):
def set_value(self, name, object, field): def set_value(self, cr, uid, name, object, field):
#super(_date_format, self).__init__(self) #super(_date_format, self).__init__(self)
pool_lang = pooler.get_pool(cr.dbname).get('res.lang')
self.object = object self.object = object
self._field = field self._field = field
self.name=name self.name = name
lc, encoding = locale.getdefaultlocale() # lc, encoding = locale.getdefaultlocale()
if not encoding: # if not encoding:
encoding = 'UTF-8' # encoding = 'UTF-8'
if encoding == 'utf': # if encoding == 'utf':
encoding = 'UTF-8' # encoding = 'UTF-8'
if encoding == 'cp1252': # if encoding == 'cp1252':
encoding= '1252' # encoding= '1252'
lang = self.object._context.get('lang', 'en_US') or 'en_US' lang = self.object._context.get('lang', 'en_US') or 'en_US'
try: self.lang_obj = pool_lang.browse(cr, uid,pool_lang.search(cr, uid,[('code','=',lang)])[0])
if os.name == 'nt':
locale.setlocale(locale.LC_ALL, _LOCALE2WIN32.get(lang, lang) + '.' + encoding) # try:
else: # if os.name == 'nt':
locale.setlocale(locale.LC_ALL,str( lang + '.' + encoding)) # locale.setlocale(locale.LC_ALL, _LOCALE2WIN32.get(lang, lang) + '.' + encoding)
except Exception: # else:
netsvc.Logger().notifyChannel('report', netsvc.LOG_WARNING, # locale.setlocale(locale.LC_ALL,str( lang + '.' + encoding))
'report %s: unable to set locale "%s"' % (self.name, # except Exception:
self.object._context.get('lang', 'en_US') or 'en_US')) # netsvc.Logger().notifyChannel('report', netsvc.LOG_WARNING,
# 'report %s: unable to set locale "%s"' % (self.name,
# self.object._context.get('lang', 'en_US') or 'en_US'))
class _float_format(float, _format): class _float_format(float, _format):
def __str__(self): def __str__(self):
if not self.object._context: digits = 2
return locale.format('%f', self.name, True) if self._field and hasattr(self._field, 'digits') and self._field.digits:
digit = 2 digits = self._field.digits[1]
if hasattr(self._field, 'digits') and self._field.digits: return self.lang_obj.format('%.' + str(digits) + 'f', self.name, True)
digit = self._field.digits[1]
return locale.format('%.' + str(digit) + 'f', self.name, True) # if not self.object._context:
# return locale.format('%f', self.name, True)
# digit = 2
# if hasattr(self._field, 'digits') and self._field.digits:
# digit = self._field.digits[1]
# return locale.format('%.' + str(digit) + 'f', self.name, True)
class _int_format(int, _format): class _int_format(int, _format):
def __str__(self): def __str__(self):
return locale.format('%d', self.name, True) return self.lang_obj.format('%.d', self.name, True)
# return locale.format('%d', self.name, True)
class _date_format(str, _format): class _date_format(str, _format):
def __str__(self): def __str__(self):
if not self.object._context:
return self.name
if self.name: if self.name:
try : date = mx.DateTime.strptime(self.name,DT_FORMAT)
datedata = time.strptime(self.name, DT_FORMAT) return date.strftime(self.lang_obj.date_format)
return time.strftime(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'), return ''
datedata) # if not self.object._context:
except : # return self.name
pass #
return '' # if self.name:
# try :
# datedata = time.strptime(self.name, DT_FORMAT)
# return time.strftime(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'),
# datedata)
# except :
# pass
# return ''
class _dttime_format(str, _format):
def __str__(self):
if self.name:
datetime = mx.DateTime.strptime(self.name,DHM_FORMAT)
return datetime.strftime(self.lang_obj.date_format+ " " + self.lang_obj.time_format)
return ''
_fields_process = { _fields_process = {
'float': _float_format, 'float': _float_format,
'date': _date_format, 'date': _date_format,
'integer': _int_format 'integer': _int_format,
'datetime' : _dttime_format
} }
# #
@ -337,53 +358,36 @@ class rml_parse(object):
def formatLang(self, value, digits=2, date=False,date_time=False, grouping=True, monetary=False, currency=None): def formatLang(self, value, digits=2, date=False,date_time=False, grouping=True, monetary=False, currency=None):
if isinstance(value, (str, unicode)) and not value: if isinstance(value, (str, unicode)) and not value:
return '' return ''
pool_lang=self.pool.get('res.lang') pool_lang = self.pool.get('res.lang')
lang = self.localcontext.get('lang', 'en_US') or 'en_US' lang = self.localcontext.get('lang', 'en_US') or 'en_US'
lang_obj = pool_lang.browse(self.cr,self.uid,pool_lang.search(self.cr,self.uid,[('code','=',lang)])[0]) lang_obj = pool_lang.browse(self.cr,self.uid,pool_lang.search(self.cr,self.uid,[('code','=',lang)])[0])
if date or date_time: if date or date_time:
date_format = lang_obj.date_format date_format = lang_obj.date_format
if date_time: if date_time:
date_format = lang_obj.date_format + " " + lang_obj.time_format date_format = lang_obj.date_format + " " + lang_obj.time_format
parse_format = date_format
# filtering time.strftime('%Y-%m-%d')
if type(value) == type(''):
parse_format = DHM_FORMAT
if (not date_time):
return value
if not isinstance(value, time.struct_time): if not isinstance(value, time.struct_time):
# assume string, parse it # assume string, parse it
if len(str(value)) == 10: # if len(str(value)) == 10:
# length of date like 2001-01-01 is ten # # length of date like 2001-01-01 is ten
# assume format '%Y-%m-%d' # # assume format '%Y-%m-%d'
date = mx.DateTime.strptime(value,DT_FORMAT) # date = mx.DateTime.strptime(value,DT_FORMAT)
else: # else:
# assume format '%Y-%m-%d %H:%M:%S' # # assume format '%Y-%m-%d %H:%M:%S'
value = str(value)[:19] # value = str(value)[:19]
date = mx.DateTime.strptime(str(value),DHM_FORMAT) # date = mx.DateTime.strptime(str(value),DHM_FORMAT)
date = mx.DateTime.strptime(str(value),parse_format)
else: else:
date = mx.DateTime.DateTime(*(value.timetuple()[:6])) date = mx.DateTime.DateTime(*(value.timetuple()[:6]))
return date.strftime(date_format) return date.strftime(date_format)
return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary)
# def formatLang(self, value, digit=2, date=False):
# if not value:
# return ''
# lc, encoding = locale.getdefaultlocale()
# if not encoding:
# encoding = 'UTF-8'
# if encoding == 'utf':
# encoding = 'UTF-8'
# if encoding == 'cp1252':
# encoding= '1252'
# lang = self.localcontext.get('lang', 'en_US') or 'en_US'
# try:
# if os.name == 'nt':
# locale.setlocale(locale.LC_ALL, _LOCALE2WIN32.get(lang, lang) + '.' + encoding)
# else:
# locale.setlocale(locale.LC_ALL, lang + '.' + encoding)
# except Exception:
# netsvc.Logger().notifyChannel('report', netsvc.LOG_WARNING,
# 'report %s: unable to set locale "%s"' % (self.name,
# self.localcontext.get('lang', 'en_US') or 'en_US'))
# if date:
# date = time.strptime(value, DT_FORMAT)
# return time.strftime(locale.nl_langinfo(locale.D_FMT).replace('%y', '%Y'),
# date)
# return locale.format('%.' + str(digit) + 'f', value, True)
def repeatIn(self, lst, name, nodes_parent=False): def repeatIn(self, lst, name, nodes_parent=False):
self._node.data = '' self._node.data = ''

View File

@ -99,6 +99,9 @@ def init_db(cr):
id, info.get('author', ''), id, info.get('author', ''),
info.get('website', ''), i, info.get('name', False), info.get('website', ''), i, info.get('name', False),
info.get('description', ''), p_id, state)) info.get('description', ''), p_id, state))
cr.execute('insert into ir_model_data \
(name,model,module, res_id) values (%s,%s,%s,%s)', (
'module_meta_information', 'ir.module.module', i, id))
dependencies = info.get('depends', []) dependencies = info.get('depends', [])
for d in dependencies: for d in dependencies:
cr.execute('insert into ir_module_module_dependency \ cr.execute('insert into ir_module_module_dependency \
@ -828,6 +831,28 @@ def logged(f):
return wrapper return wrapper
class profile(object):
def __init__(self, fname=None):
self.fname = fname
def __call__(self, f):
from tools.func import wraps
@wraps(f)
def wrapper(*args, **kwargs):
class profile_wrapper(object):
def __init__(self):
self.result = None
def __call__(self):
self.result = f(*args, **kwargs)
pw = profile_wrapper()
import cProfile
fname = self.fname or ("%s.cprof" % (f.func_name,))
cProfile.runctx('pw()', globals(), locals(), filename=fname)
return pw.result
return wrapper
def debug(what): def debug(what):
""" """
This method allow you to debug your code without print This method allow you to debug your code without print

View File

@ -605,7 +605,10 @@ def trans_load_data(db_name, fileobj, fileformat, lang, strict=False, lang_name=
'thousands_sep' : str(locale.nl_langinfo(locale.THOUSEP)) 'thousands_sep' : str(locale.nl_langinfo(locale.THOUSEP))
}) })
# Here we try to reset the locale regardless. # Here we try to reset the locale regardless.
locale.setlocale(locale.LC_ALL, str(lc + '.' + encoding)) try:
locale.setlocale(locale.LC_ALL, str(lc + '.' + encoding))
except:
pass
lang_ids = lang_obj.search(cr, uid, []) lang_ids = lang_obj.search(cr, uid, [])
langs = lang_obj.read(cr, uid, lang_ids) langs = lang_obj.read(cr, uid, lang_ids)
ls = map(lambda x: (x['code'],x['name']), langs) ls = map(lambda x: (x['code'],x['name']), langs)

View File

@ -64,6 +64,7 @@ class interface(netsvc.Service):
res = {} res = {}
try: try:
state_def = self.states[state] state_def = self.states[state]
result_def = state_def.get('result', {}) result_def = state_def.get('result', {})
actions_res = {} actions_res = {}
@ -81,7 +82,7 @@ class interface(netsvc.Service):
if result_def['type'] == 'action': if result_def['type'] == 'action':
res['action'] = result_def['action'](self, cr, uid, data, context) res['action'] = result_def['action'](self, cr, uid, data, context)
elif result_def['type'] == 'form': elif result_def['type'] == 'form':
fields = copy.copy(result_def['fields']) fields = copy.deepcopy(result_def['fields'])
arch = copy.copy(result_def['arch']) arch = copy.copy(result_def['arch'])
button_list = copy.copy(result_def['state']) button_list = copy.copy(result_def['state'])

View File

@ -7,8 +7,7 @@
# Need to overwrite the install-part of the RPM to append the # Need to overwrite the install-part of the RPM to append the
# compression-suffix onto the filenames for the man-pages. # compression-suffix onto the filenames for the man-pages.
# #
python setup.py install --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES python setup.py install --optimize 1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES
SUFFIX=gz SUFFIX=gz
mv INSTALLED_FILES INSTALLED_FILES.orig sed "s!\(/share/man/.*\)!\1.$SUFFIX!" -i INSTALLED_FILES
sed "s!\(/share/man/.*\)!\1.$SUFFIX!" INSTALLED_FILES.orig > INSTALLED_FILES

View File

@ -5,7 +5,8 @@ formats=gztar
formats=rpm formats=rpm
[bdist_rpm] [bdist_rpm]
release=1 # release must exactly match 'release' as set in bin/release.py
release=0_rc3
requires=python >= 2.3 requires=python >= 2.3
#build-requires=python-devel >= 2.3 #build-requires=python-devel >= 2.3

View File

@ -44,6 +44,9 @@ opj = os.path.join
execfile(opj('bin', 'release.py')) execfile(opj('bin', 'release.py'))
if sys.argv[1] != 'bdist_rpm':
version = version + '-' + release
# get python short version # get python short version
py_short_version = '%s.%s' % sys.version_info[:2] py_short_version = '%s.%s' % sys.version_info[:2]