[IMP] better view, no NULL value for int and float

bzr revid: fp@tinyerp.com-20100418200732-l2vzf71xf8tpj34r
This commit is contained in:
Fabien Pinckaers 2010-04-18 22:07:32 +02:00
parent b166ef278f
commit e67890b3b0
10 changed files with 140 additions and 106 deletions

View File

@ -30,8 +30,8 @@
'depends': [],
'init_xml': [
'base_data.xml',
'base_menu.xml',
'security/base_security.xml',
'base_menu.xml',
'res/res_security.xml',
'res/res_config.xml',
'maintenance/maintenance_security.xml',

View File

@ -2,17 +2,25 @@
<openerp>
<data>
<menuitem icon="terp-administration" id="menu_administration" name="Administration" sequence="20"/>
<menuitem id="custom_shortcuts" name="Custom Shortcuts" parent="base.menu_administration" sequence="20"/>
<menuitem id="next_id_4" name="Low Level Objects" parent="base.menu_administration" sequence="3"/>
<menuitem id="next_id_4" name="Low Level Objects"
parent="base.menu_administration" sequence="3"
groups="base.group_extended"/>
<menuitem id="menu_low_workflow" name="Workflow Items" parent="base.next_id_4"/>
<menuitem id="menu_custom" name="Customization" parent="base.menu_administration" sequence="2"/>
<menuitem id="menu_custom" name="Customization"
parent="base.menu_administration" sequence="2"
groups="base.group_extended"/>
<menuitem id="menu_custom_action" name="Actions" parent="base.menu_custom" sequence="20"/>
<menuitem id="menu_config" name="Configuration" parent="base.menu_administration" sequence="1"/>
<menuitem id="menu_translation" name="Translations" parent="base.menu_administration" sequence="4"/>
<menuitem id="menu_translation_app" name="Application Terms" parent="base.menu_translation" sequence="4"/>
<menuitem id="menu_translation_export" name="Import / Export" parent="base.menu_translation" sequence="4"/>
<menuitem id="menu_translation_export" name="Import / Export"
groups="base.group_extended"
parent="base.menu_translation" sequence="4"/>
<menuitem id="menu_users" name="Users" parent="base.menu_administration" sequence="6"/>
<menuitem id="menu_security" name="Security" parent="base.menu_administration" sequence="8"/>
<menuitem id="menu_management" name="Modules Management" parent="base.menu_administration" sequence="10"/>
<menuitem id="menu_security" name="Security" parent="base.menu_administration" sequence="8"
groups="base.group_extended"/>
<menuitem id="menu_management" name="Modules Management" parent="base.menu_administration" sequence="10"
groups="base.group_extended"/>
</data>
</openerp>

View File

@ -76,20 +76,20 @@
<field eval="18" name="priority"/>
<field name="arch" type="xml">
<form string="Users">
<notebook colspan="4">
<page string="Current Activity">
<field name="company_id" widget="selection" readonly="0" context="{'user_prefence':True}"/>
<newline/>
<separator colspan="4" string="Preferences"/>
</page>
<page string="Preferences">
<field name="password" password="True" readonly="0"/>
<label colspan="4" string="Please note that you will have to logout and relog if you change your password."/>
<field name="context_lang" completion="1" readonly="0"/>
<field name="context_tz" completion="1" readonly="0" colspan="4"/>
<newline/>
<field colspan="4" name="signature" readonly="0"/>
</page>
<notebook colspan="4">
<page string="Current Activity">
<field name="company_id" widget="selection" readonly="0" context="{'user_prefence':True}"/>
<newline/>
<separator colspan="4" string="Preferences"/>
</page>
<page string="Preferences">
<field name="password" password="True" readonly="0"/>
<label colspan="4" string="Please note that you will have to logout and relog if you change your password."/>
<field name="context_lang" completion="1" readonly="0"/>
<field name="context_tz" completion="1" readonly="0" colspan="4"/>
<newline/>
<field colspan="4" name="signature" readonly="0"/>
</page>
</notebook>
</form>
</field>
@ -113,10 +113,14 @@
<field domain="[('usage','=','menu')]" name="menu_id" required="True"/>
<field name="context_lang"/>
<field name="context_tz"/>
<field colspan="4" name="signature"/>
</page>
<page string="Groups">
<field colspan="4" nolabel="1" name="groups_id"/>
<group colspan="2" col="2">
<separator string="Signature" colspan="2"/>
<field colspan="2" name="signature" nolabel="1"/>
</group>
<group colspan="2" col="2">
<separator string="Access Rights (groups)" colspan="2"/>
<field colspan="2" nolabel="1" name="groups_id"/>
</group>
</page>
<page string="Roles">
<field colspan="4" nolabel="1" name="roles_id"/>
@ -165,9 +169,11 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Company">
<field colspan="4" name="name" select="1"/>
<field name="partner_id" select="1"/>
<field name="parent_id" select="1"/>
<group colspan="4" col="6">
<field colspan="4" name="name" select="1"/>
<field name="partner_id" select="1"/>
<field name="parent_id" select="1" groups="base.group_multi_company"/>
</group>
<notebook colspan="4">
<page string="General Information">
<field name="rml_header1" colspan="4"/>
@ -177,13 +183,10 @@
<separator colspan="4" string="Your Logo - Use a size of about 450x150 pixels."/>
<field colspan="4" name="logo" widget="image"/>
</page>
<page string="Currency">
<field name="currency_ids" colspan="4" nolabel="1"/>
</page>
<page string="Header/Footer">
<page string="Header/Footer" groups="base.group_extended">
<field colspan="4" name="rml_header" nolabel="1"/>
</page>
<page string="Internal Header/Footer">
<page string="Internal Header/Footer" groups="base.group_extended">
<field colspan="4" name="rml_header2" nolabel="1"/>
</page>
<page string="Configuration">
@ -307,17 +310,12 @@
<field name="target">new</field>
</record>
<!-- register on configuratuion -->
</data>
<data noupdate="1">
<record id="config_wizard_step_user" model="ir.actions.todo">
<field name="action_id" ref="action_config_user_form"/>
<field name="sequence">10</field>
<field name="restart">never</field>
<field name="state">done</field>
</record>
<record id="config_wizard_simple_view" model="ir.actions.todo">
<field name="action_id" ref="action_config_simple_view_form"/>
<field name="sequence">1</field>

View File

@ -106,9 +106,9 @@
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="company_id"/>
<field name="active" select="2"/>
<field name="active" groups="base.group_extended"/>
</group>
<notebook>
<notebook colspan="4">
<page string="Sequence">
<field name="prefix"/>
<field name="suffix"/>
@ -191,7 +191,9 @@
<field name="view_mode">tree,form</field>
<field eval="False" name="view_id"/>
</record>
<menuitem action="ir_sequence_type" id="menu_ir_sequence_type" parent="base.next_id_5"/>
<menuitem action="ir_sequence_type" id="menu_ir_sequence_type"
groups="base.group_extended"
parent="base.next_id_5"/>
<!-- Actions -->
@ -434,6 +436,7 @@
<menuitem id="menu_res_company_global"
parent="base.menu_administration"
name="Companies"
groups="base.group_multi_company"
sequence="5"/>
<record id="action_res_company_tree" model="ir.actions.act_window">
@ -443,8 +446,10 @@
<field name="domain">[('parent_id','=',False)]</field>
<field name="view_type">tree</field>
</record>
<menuitem action="action_res_company_tree" id="menu_action_res_company_tree" parent="base.menu_res_company_global" sequence="16"/>
<menuitem action="action_res_company_tree"
groups="base.group_multi_company"
id="menu_action_res_company_tree" parent="base.menu_res_company_global"
sequence="16"/>
<record id="action_res_company_form" model="ir.actions.act_window">
<field name="name">Companies</field>
<field name="type">ir.actions.act_window</field>
@ -534,7 +539,9 @@
<field name="view_type">tree</field>
<field eval="[('parent_id','=',False)]" name="domain"/>
</record>
<menuitem action="action_res_roles" id="menu_action_res_roles" parent="base.menu_users"/>
<menuitem action="action_res_roles"
groups="base.group_extended"
id="menu_action_res_roles" parent="base.menu_users"/>
<record id="action_res_roles_form" model="ir.actions.act_window">
<field name="name">Roles</field>
@ -914,18 +921,35 @@
<!-- Translations -->
<record id="view_translation_search" model="ir.ui.view">
<field name="name">Translations</field>
<field name="model">ir.translation</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Translations">
<filter icon="terp-project"
string="Untranslated"
domain="['|',('value', '=', False),('value','=','')]"/>
<separator orientation="vertical"/>
<field name="lang" select="1"/>
<field name="src" select="1"/>
<field name="value" select="1"/>
</search>
</field>
</record>
<record id="view_translation_form" model="ir.ui.view">
<field name="name">Translations</field>
<field name="model">ir.translation</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Translations">
<field name="name" select="2"/>
<field name="res_id" select="2"/>
<field name="type" select="2"/>
<field name="lang" select="1"/>
<field name="src" select="1"/>
<field name="value" select="1"/>
<field name="name"/>
<field name="res_id"/>
<field name="type"/>
<field name="lang"/>
<field name="src"/>
<field name="value"/>
</form>
</field>
</record>
@ -945,20 +969,12 @@
</record>
<record id="action_translation" model="ir.actions.act_window">
<field name="name">All terms</field>
<field name="name">Translation Terms</field>
<field name="res_model">ir.translation</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_translation_tree"/>
</record>
<menuitem action="action_translation" id="menu_action_translation" parent="base.menu_translation_app"/>
<record id="action_translation_untrans" model="ir.actions.act_window">
<field name="name">Untranslated terms</field>
<field name="res_model">ir.translation</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_translation_tree"/>
<field name="domain">['|',('value', '=', False),('value','=','')]</field>
</record>
<menuitem action="action_translation_untrans" id="menu_action_translation_untrans" parent="menu_action_translation"/>
<!--
=============================================================
@ -1354,7 +1370,6 @@
<field name="sequence"/>
<field name="action_id" select="1"/>
<field name="state"/>
<field name="active" select="2" invisible="True"/>
</tree>
</field>
</record>
@ -1366,28 +1381,31 @@
<form editable="bottom" string="Config Wizard Steps">
<field name="sequence"/>
<field name="action_id" select="1"/>
<field name="restart"/>
<field name="state"/>
<field name="active" select="2"/>
</form>
</field>
</record>
<record id="act_ir_actions_todo_form" model="ir.actions.act_window">
<field name="name">Config Wizard Steps</field>
<field name="name">List of Configuration Wizards</field>
<field name="res_model">ir.actions.todo</field>
<field name="view_id" ref="ir_actions_todo_tree"/>
<field name="view_type">form</field>
</record>
<menuitem id="next_id_11" name="Configuration Wizards" parent="base.menu_config" sequence="1"/>
<menuitem action="act_ir_actions_todo_form" id="menu_ir_actions_todo_form" parent="next_id_11"/>
<menuitem action="act_ir_actions_todo_form" id="menu_ir_actions_todo_form" parent="next_id_11"
groups="base.group_extended"/>
<record id="action_start_configurator" model="ir.actions.server">
<field name="name">Start Configuration</field>
<field name="name">Launch Configuration Wizards</field>
<field name="model_id" ref="model_res_config"/>
<field name="state">code</field>
<field name="code">action = self.next(cr, uid, [])</field>
<field name="code">action = self.start(cr, uid, [])</field>
</record>
<menuitem action="action_start_configurator" name="Start Configuration"
id="menu_configurator_module" parent="next_id_11"
type="server"/>
<menuitem
action="action_start_configurator" name="Start Configuration"
id="menu_configurator_module" parent="next_id_11"
type="server"/>
</data>
</openerp>

View File

@ -721,10 +721,11 @@ class act_window_close(osv.osv):
act_window_close()
# This model use to register action services.
TODO_STATES = [('open', 'Not Started'),
TODO_STATES = [('open', 'To Do'),
('done', 'Done'),
('skip','Skipped'),
('cancel','Cancel')]
class ir_actions_todo(osv.osv):
_name = 'ir.actions.todo'
_columns={
@ -732,17 +733,17 @@ class ir_actions_todo(osv.osv):
'ir.actions.act_window', 'Action', select=True, required=True,
ondelete='cascade'),
'sequence': fields.integer('Sequence'),
'active': fields.boolean('Active'),
'state': fields.selection(TODO_STATES, string='State', required=True),
'name':fields.char('Name', size=64),
'restart': fields.selection([('onskip','On Skip'),('always','Always'),('never','Never')],'Restart',required=True),
'note':fields.text('Text', translate=True),
}
_defaults={
'state': lambda *a: 'open',
'sequence': lambda *a: 10,
'active': lambda *a: True,
'restart': lambda *a: 'always',
}
_order="sequence"
_order="sequence,id"
ir_actions_todo()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -46,7 +46,7 @@ class ir_sequence(osv.osv):
'suffix': fields.char('Suffix',size=64),
'number_next': fields.integer('Next Number', required=True),
'number_increment': fields.integer('Increment Number', required=True),
'padding' : fields.integer('Number padding', required=True),
'padding' : fields.integer('Number padding', required=True, help="OpenERP will automatically adds some '0' on the left of the 'Next Number' to get the required padding size."),
'company_id': fields.many2one('res.company', 'Company'),
}
_defaults = {

View File

@ -2,18 +2,35 @@
<openerp>
<data>
<!-- Properties -->
<record id="ir_property_view_search" model="ir.ui.view">
<field name="name">ir.property.search</field>
<field name="model">ir.property</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Parameters">
<filter icon="terp-project"
string="Generic"
help="Parameters that are used by all resources."
default="1"
domain="[('res_id','=',False)]"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="company_id" groups="base.group_multi_company"/>
</search>
</field>
</record>
<record id="ir_property_view" model="ir.ui.view">
<field name="name">ir.property.form</field>
<field name="model">ir.property</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Properties">
<form string="Parameters">
<separator colspan="4" string="Property"/>
<field name="name" select="1"/>
<field name="company_id" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company"/>
<field colspan="4" name="fields_id" select="1"/>
<field colspan="4" name="value"/>
<field colspan="4" name="res_id"/>
<field colspan="4" name="res_id" groups="base.group_extended"/>
</form>
</field>
</record>
@ -22,33 +39,21 @@
<field name="model">ir.property</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Properties">
<tree string="Parameters">
<field name="name"/>
<field name="company_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<field name="fields_id"/>
</tree>
</field>
</record>
<record id="ir_property_form" model="ir.actions.act_window">
<field name="name">Default Properties</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.property</field>
<field name="view_type">form</field>
<field name="domain">[('res_id','=',False)]</field>
<field name="view_id" ref="ir_property_view_tree"/>
</record>
<menuitem id="next_id_15" name="Properties" parent="base.menu_config"/>
<menuitem action="ir_property_form" id="menu_ir_property_form" parent="next_id_15"/>
<record id="ir_property_form_all" model="ir.actions.act_window">
<field name="name">All Properties</field>
<field name="name">Configuration Parameters</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.property</field>
<field name="view_type">form</field>
<field name="view_id" ref="ir_property_view_tree"/>
</record>
<menuitem action="ir_property_form_all" id="menu_ir_property_form_all" parent="base.next_id_15"/>
<menuitem id="next_id_15" name="Parameters" parent="base.menu_config"/>
<menuitem action="ir_property_form" id="menu_ir_property_form_all" parent="base.next_id_15"/>
</data>
</openerp>

View File

@ -320,7 +320,7 @@
<page string="Sales &amp; Purchases">
<separator string="General Information" colspan="4"/>
<field name="user_id"/>
<field name="active"/>
<field name="active" groups="base.group_extended"/>
<field name="website" widget="url"/>
<field name="date"/>
<field name="parent_id" groups="base.group_extended"/>
@ -552,7 +552,7 @@
<field name="arch" type="xml">
<form string="Partner Category">
<field name="name" select="1"/>
<field name="active" select="1"/>
<field name="active" groups="base.group_extended"/>
<field name="parent_id"/>
<separator colspan="4" string="Partners"/>
<field colspan="4" name="partner_ids" nolabel="1"/>
@ -567,7 +567,6 @@
<field name="arch" type="xml">
<tree string="Partner Categories">
<field name="complete_name"/>
<field name="active" />
</tree>
</field>
</record>

View File

@ -40,9 +40,7 @@ class res_config_configurable(osv.osv_memory):
total = self.pool.get('ir.actions.todo')\
.search_count(cr, uid, [], context)
open = self.pool.get('ir.actions.todo')\
.search_count(cr, uid, [('active','=',True),
('state','<>','open')],
context)
.search_count(cr, uid, [('state','<>','open')], context)
if total:
return round(open*100./total)
return 100.
@ -58,8 +56,7 @@ class res_config_configurable(osv.osv_memory):
todos = self.pool.get('ir.actions.todo')
self.logger.notifyChannel('actions', netsvc.LOG_INFO,
'getting next %s' % todos)
active_todos = todos.search(cr, uid, [('state','=','open'),
('active','=',True)],
active_todos = todos.search(cr, uid, [('state','=','open')],
limit=1)
if active_todos:
return todos.browse(cr, uid, active_todos[0], context=None)
@ -111,6 +108,13 @@ class res_config_configurable(osv.osv_memory):
return self.pool.get(current_user_menu.type)\
.read(cr, uid, current_user_menu.id)
def start(self, cr, uid, ids, context=None):
ids2 = self.pool.get('ir.actions.todo').search(cr, uid, [], context=context)
for todo in self.pool.get('ir.actions.todo').browse(cr, uid, ids2, context=context):
if (todo.restart=='always') or (todo.restart=='onskip' and (todo.state in ('skip','cancel'))):
todo.write({'state':'open'})
return self.next(cr, uid, ids, context)
def next(self, cr, uid, ids, context=None):
""" Returns the next todo action to execute (using the default
sort order)
@ -183,6 +187,7 @@ class res_config_configurable(osv.osv_memory):
next = self.cancel(cr, uid, ids, context=None)
if next: return next
return self.next(cr, uid, ids, context=context)
res_config_configurable()
class res_config_installer(osv.osv_memory):

View File

@ -119,23 +119,23 @@ class boolean(_column):
_symbol_f = lambda x: x and 'True' or 'False'
_symbol_set = (_symbol_c, _symbol_f)
class integer_big(_column):
_type = 'integer_big'
_symbol_c = '%s'
_symbol_f = lambda x: int(x or 0)
_symbol_set = (_symbol_c, _symbol_f)
_symbol_get = lambda self,x: x or 0
class integer(_column):
_type = 'integer'
_symbol_c = '%s'
_symbol_f = lambda x: int(x or 0)
_symbol_set = (_symbol_c, _symbol_f)
_symbol_get = lambda self,x: x or 0
class reference(_column):
_type = 'reference'
def __init__(self, string, selection, size, **args):
_column.__init__(self, string=string, size=size, selection=selection, **args)
@ -173,6 +173,7 @@ class float(_column):
_symbol_c = '%s'
_symbol_f = lambda x: __builtin__.float(x or 0.0)
_symbol_set = (_symbol_c, _symbol_f)
_symbol_get = lambda self,x: x or 0.0
def __init__(self, string='unknown', digits=None, digits_compute=None, **args):
_column.__init__(self, string=string, **args)
@ -197,7 +198,6 @@ class datetime(_column):
class time(_column):
_type = 'time'
class binary(_column):
_type = 'binary'
_symbol_c = '%s'