[MRG] merge with main addons.

bzr revid: tpa@tinyerp.com-20120417101436-rdykpvm14i70nu50
bzr revid: tpa@tinyerp.com-20120418064124-1tw84eusgsn9imff
This commit is contained in:
Turkesh Patel (Open ERP) 2012-04-18 12:11:24 +05:30
commit 6ec0aeeae0
20 changed files with 1617 additions and 845 deletions

View File

@ -94,7 +94,7 @@
</group>
<group col="2" colspan="1">
<separator string="Avatar" colspan="2"/>
<field name="avatar" widget='image' nolabel="1" colspan="2" on_change="onchange_avatar(avatar)"/>
<field name="avatar" widget='image' nolabel="1" colspan="2" on_change="onchange_avatar(avatar)" readonly="0"/>
</group>
</group>
<group name="default_filters" colspan="2" col="2">

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,14 +7,14 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2012-02-08 00:44+0000\n"
"PO-Revision-Date: 2012-01-31 16:45+0000\n"
"Last-Translator: Antony Lesuisse (OpenERP) <al@openerp.com>\n"
"PO-Revision-Date: 2012-04-03 15:31+0000\n"
"Last-Translator: tamnil <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2012-03-10 04:50+0000\n"
"X-Generator: Launchpad (build 14914)\n"
"X-Launchpad-Export-Date: 2012-04-04 04:40+0000\n"
"X-Generator: Launchpad (build 15055)\n"
#. module: base
#: model:res.country,name:base.sh
@ -171,12 +171,12 @@ msgstr "Janela alvo"
#. module: base
#: model:ir.module.module,shortdesc:base.module_sale_analytic_plans
msgid "Sales Analytic Distribution"
msgstr ""
msgstr "Distribuição analítica de Vendas"
#. module: base
#: model:ir.module.module,shortdesc:base.module_web_process
msgid "Process"
msgstr ""
msgstr "Processo"
#. module: base
#: model:ir.module.module,shortdesc:base.module_analytic_journal_billing_rate
@ -236,7 +236,7 @@ msgstr ""
#. module: base
#: model:ir.module.module,shortdesc:base.module_mrp_subproduct
msgid "MRP Subproducts"
msgstr ""
msgstr "Subprodutos MRP"
#. module: base
#: code:addons/base/module/module.py:390
@ -269,7 +269,7 @@ msgstr ""
#: model:ir.module.category,name:base.module_category_sales_management
#: model:ir.module.module,shortdesc:base.module_sale
msgid "Sales Management"
msgstr ""
msgstr "Gestão de Vendas"
#. module: base
#: view:res.partner:0
@ -375,7 +375,7 @@ msgstr ""
#. module: base
#: view:ir.module.module:0
msgid "Extra"
msgstr ""
msgstr "Extra"
#. module: base
#: code:addons/orm.py:2526
@ -576,7 +576,7 @@ msgstr "Spanish (VE) / Español (VE)"
#. module: base
#: model:ir.module.module,shortdesc:base.module_hr_timesheet_invoice
msgid "Invoice on Timesheets"
msgstr ""
msgstr "Factura de Horários"
#. module: base
#: view:base.module.upgrade:0
@ -887,7 +887,7 @@ msgstr ""
#. module: base
#: view:res.users:0
msgid "Email Preferences"
msgstr ""
msgstr "Preferências de Email"
#. module: base
#: model:ir.module.module,description:base.module_audittrail
@ -1070,7 +1070,7 @@ msgstr "Tipo"
#. module: base
#: field:ir.mail_server,smtp_user:0
msgid "Username"
msgstr ""
msgstr "Nome de utilizador"
#. module: base
#: code:addons/orm.py:398
@ -1243,7 +1243,7 @@ msgstr ""
#. module: base
#: model:ir.module.module,shortdesc:base.module_web_tests
msgid "Tests"
msgstr ""
msgstr "Testes"
#. module: base
#: field:ir.ui.view_sc,res_id:0
@ -1916,7 +1916,7 @@ msgstr ""
#: code:addons/base/res/res_users.py:420
#, python-format
msgid "%s (copy)"
msgstr ""
msgstr "%s (cópia)"
#. module: base
#: model:ir.module.module,shortdesc:base.module_account_chart
@ -2494,7 +2494,7 @@ msgstr "Nome do atalho"
#. module: base
#: help:ir.actions.act_window,limit:0
msgid "Default limit for the list view"
msgstr "Limite por defeito para a vista de lista"
msgstr "Limite por omissão para a vista de lista"
#. module: base
#: model:res.country,name:base.pg
@ -10604,7 +10604,7 @@ msgstr "Exemplos"
#: field:ir.default,value:0
#: view:ir.values:0
msgid "Default Value"
msgstr "Valor por defeito"
msgstr "Valor por Omissão"
#. module: base
#: model:ir.model,name:base.model_res_country_state
@ -11448,7 +11448,7 @@ msgstr ""
#: selection:ir.values,key:0
#: selection:res.partner.address,type:0
msgid "Default"
msgstr "Por defeito"
msgstr "Por omissão"
#. module: base
#: view:partner.wizard.ean.check:0

View File

@ -219,7 +219,7 @@
<field name="view_id" ref="sequence_view_tree"/>
<field name="context">{'active_test': False}</field>
</record>
<menuitem id="next_id_5" name="Sequences &amp; Identifiers" parent="base.menu_config"/>
<menuitem id="next_id_5" name="Sequences &amp; Identifiers" parent="base.menu_config" sequence="21" groups="base.group_no_one"/>
<menuitem action="ir_sequence_form" id="menu_ir_sequence_form" parent="next_id_5"/>
<!-- Sequences Types -->
@ -683,7 +683,7 @@
<field name="view_mode">tree,form</field>
</record>
<menuitem id="menu_needaction_users" name="Need actions" parent="base.menu_users" sequence="20" action="action_view_needaction_users" groups="base.group_extended"/>
<menuitem id="menu_needaction_users" name="Need actions" parent="base.menu_users" sequence="20" action="action_view_needaction_users" groups="base.group_no_one"/>
<!-- Companies -->
<menuitem id="menu_res_company_global"
@ -1574,7 +1574,7 @@
<field name="view_id" ref="ir_cron_view_tree"/>
</record>
<menuitem id="next_id_10" name="Scheduler" parent="base.menu_config" groups="base.group_extended" sequence="11"/>
<menuitem id="next_id_10" name="Scheduler" parent="base.menu_config" groups="base.group_extended" sequence="23"/>
<menuitem action="ir_cron_act" id="menu_ir_cron_act" parent="next_id_10"/>
@ -1950,7 +1950,7 @@
<field name="view_type">form</field>
<field name="help">The configuration wizards are used to help you configure a new instance of OpenERP. They are launched during the installation of new modules, but you can choose to restart some wizards manually from this menu.</field>
</record>
<menuitem id="next_id_11" name="Configuration Wizards" parent="base.menu_config" sequence="2"
<menuitem id="next_id_11" name="Configuration Wizards" parent="base.menu_config" sequence="20"
groups="base.group_extended"/>
<menuitem action="act_ir_actions_todo_form" id="menu_ir_actions_todo_form"
@ -2071,8 +2071,8 @@
<field name="search_view_id" ref="view_ir_mail_server_search"/>
</record>
<menuitem id="menu_email" name="Email" parent="base.menu_config" groups="base.group_extended"/>
<menuitem id="menu_mail_servers" parent="menu_email" action="action_ir_mail_server_list" sequence="15"/>
<menuitem id="menu_email" name="Email" parent="base.menu_config" sequence="22"/>
<menuitem id="menu_mail_servers" parent="menu_email" action="action_ir_mail_server_list" sequence="15" groups="base.group_no_one"/>
</data>
</openerp>

View File

@ -717,7 +717,7 @@ class ir_model_data(osv.osv):
model_obj = self.pool.get(model)
if not context:
context = {}
# TODO: records created during module install should not display the messages of OpenChatter
# records created during module install should not display the messages of OpenChatter
context = dict(context, install_mode=True)
if xml_id and ('.' in xml_id):
assert len(xml_id.split('.'))==2, _("'%s' contains too many dots. XML ids should not contain dots ! These are used to refer to other modules data, as in module.reference_id") % (xml_id)

View File

@ -263,11 +263,14 @@ class ir_ui_menu(osv.osv):
res[menu.id] = {}
if menu.action and menu.action.type == 'ir.actions.act_window' and menu.action.res_model:
menu_needaction_res = self.pool.get(menu.action.res_model).get_needaction_info(cr, uid, uid, domain=menu.action.domain, context=context)
# TODO: find the addon that causes a bug on runbot, not on local
if not isinstance(menu_needaction_res[1], (int, long)): menu_needaction_res[1] = 0
else:
menu_needaction_res = [False, 0, ()]
res[menu.id]['needaction_enabled'] = menu_needaction_res[0]
res[menu.id]['needaction_counter'] = menu_needaction_res[1]
res[menu.id]['needaction_record_ids'] = menu_needaction_res[2]
# not used currently, therefore set to a void list
res[menu.id]['needaction_record_ids'] = []
return res
_columns = {

View File

@ -76,6 +76,8 @@ class view(osv.osv):
def _check_xml(self, cr, uid, ids, context=None):
for view in self.browse(cr, uid, ids, context):
eview = etree.fromstring(view.arch.encode('utf8'))
if eview.get('layout') or eview.get('validate'):
continue
frng = tools.file_open(os.path.join('base','rng','view.rng'))
try:
relaxng_doc = etree.parse(frng)

View File

@ -251,6 +251,21 @@ class ir_values(osv.osv):
'company_id': company_id,
})
def get_default(self, cr, uid, model, field_name, for_all_users=True, company_id=False, condition=False):
""" Return the default value defined for model, field_name, users, company and condition.
Return ``None`` if no such default exists.
"""
search_criteria = [
('key', '=', 'default'),
('key2', '=', condition and condition[:200]),
('model', '=', model),
('name', '=', field_name),
('user_id', '=', False if for_all_users else uid),
('company_id','=', company_id)
]
defaults = self.browse(cr, uid, self.search(cr, uid, search_criteria))
return pickle.loads(defaults[0].value.encode('utf-8')) if defaults else None
def get_defaults(self, cr, uid, model, condition=False):
"""Returns any default values that are defined for the current model and user,
(and match ``condition``, if specified), previously registered via

View File

@ -69,6 +69,7 @@ class module_category(osv.osv):
'description' : fields.text("Description", translate=True),
'sequence' : fields.integer('Sequence'),
'visible' : fields.boolean('Visible'),
'xml_id': fields.function(osv.osv.get_external_id, type='char', size=128, string="External ID"),
}
_order = 'name'

View File

@ -187,22 +187,21 @@ class publisher_warranty_contract(osv.osv):
limit_date = (datetime.datetime.now() - _PREVIOUS_LOG_CHECK).strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT)
# TODO: must be updated with OpenChatter ?
#for message in result["messages"]:
#ids = self.pool.get("res.log").search(cr, uid, [("res_model", "=", "publisher_warranty.contract"),
#("create_date", ">=", limit_date),
#("name", "=", message)])
#if ids:
#continue
#self.pool.get('res.log').create(cr, uid,
#{
#'name': message,
#'res_model': "publisher_warranty.contract",
#"read": True,
#"user_id": False,
#},
#context=context
#)
# old behavior based on res.log; now on mail.message, that is not necessarily installed
mail_message_obj = self.pool.get('mail.message')
if mail_message_obj:
for message in result["messages"]:
ids = mail_message_obj.search(cr, uid, [("model", "=", "publisher_warranty.contract"),
("create_date", ">=", limit_date),
("body_text", "=", message)])
if ids:
continue
mail_message_obj.create(cr, uid, {
'name': message,
'model': "publisher_warranty.contract",
'user_id': False,
}, context=context)
except Exception:
if cron_mode:
return False # we don't want to see any stack trace in cron
@ -216,12 +215,13 @@ class publisher_warranty_contract(osv.osv):
@return: A list of html messages with ids, can be False or empty.
@rtype: list of tuples(int,string)
"""
ids = []
#ids = self.pool.get('res.log').search(cr, uid, [("res_model", "=", "publisher_warranty.contract")]
#, order="create_date desc", limit=limit)
if not self.pool.get('mail.message'):
return []
ids = self.pool.get('mail.message').search(cr, uid, [("model", "=", "publisher_warranty.contract")]
, order="create_date desc", limit=limit, context=context)
if not ids:
return []
messages = [(x.id, x.name) for x in self.pool.get('res.log').browse(cr, uid, ids, context=context)]
messages = [(x.id, x.name) for x in self.pool.get('mail.message').browse(cr, uid, ids, context=context)]
return messages
_columns = {

View File

@ -75,7 +75,7 @@
<field name="view_type">form</field>
<field name="view_id" ref="ir_property_view_tree"/>
</record>
<menuitem id="next_id_15" name="Parameters" parent="base.menu_config" groups="base.group_extended" sequence="12"/>
<menuitem id="next_id_15" name="Parameters" parent="base.menu_config" groups="base.group_extended" sequence="24"/>
<menuitem action="ir_property_form" id="menu_ir_property_form_all" parent="base.next_id_15"/>
</data>
</openerp>

View File

@ -396,4 +396,162 @@ class ir_actions_configuration_wizard(osv.osv_memory):
ir_actions_configuration_wizard()
class res_config_settings(osv.osv_memory):
""" Base configuration wizard for application settings. It provides support for setting
default values, assigning groups to employee users, and installing modules.
To make such a 'settings' wizard, define a model like::
class my_config_wizard(osv.osv_memory):
_name = 'my.settings'
_inherit = 'res.config.settings'
_columns = {
'default_foo': fields.type(..., default_model='my.model'),
'group_bar': fields.boolean(..., group='base.group_user', implied_group='my.group'),
'module_baz': fields.boolean(...),
'other_field': fields.type(...),
}
The method ``execute`` provides some support based on a naming convention:
* For a field like 'default_XXX', ``execute`` sets the (global) default value of
the field 'XXX' in the model named by ``default_model`` to the field's value.
* For a boolean field like 'group_XXX', ``execute`` adds/removes 'implied_group'
to/from the implied groups of 'group', depending on the field's value.
By default 'group' is the group Employee. Groups are given by their xml id.
* For a boolean field like 'module_XXX', ``execute`` triggers the immediate
installation of the module named 'XXX' if the field has value ``True``.
* For the other fields, the method ``execute`` invokes all methods with a name
that starts with 'set_'; such methods can be defined to implement the effect
of those fields.
The method ``default_get`` retrieves values that reflect the current status of the
fields like 'default_XXX', 'group_XXX' and 'module_XXX'. It also invokes all methods
with a name that starts with 'get_default_'; such methods can be defined to provide
current values for other fields.
"""
_name = 'res.config.settings'
def copy(self, cr, uid, id, values, context=None):
raise osv.except_osv(_("Cannot duplicate configuration!"), "")
def _get_classified_fields(self, cr, uid, context=None):
""" return a dictionary with the fields classified by category::
{ 'default': [('default_foo', 'model', 'foo'), ...],
'group': [('group_bar', browse_group, browse_implied_group), ...],
'module': [('module_baz', browse_module), ...],
'other': ['other_field', ...],
}
"""
ir_model_data = self.pool.get('ir.model.data')
ir_module = self.pool.get('ir.module.module')
def ref(xml_id):
mod, xml = xml_id.split('.', 1)
return ir_model_data.get_object(cr, uid, mod, xml, context)
defaults, groups, modules, others = [], [], [], []
for name, field in self._columns.items():
if name.startswith('default_') and hasattr(field, 'default_model'):
defaults.append((name, field.default_model, name[8:]))
elif name.startswith('group_') and isinstance(field, fields.boolean) and hasattr(field, 'implied_group'):
field_group = getattr(field, 'group', 'base.group_user')
groups.append((name, ref(field_group), ref(field.implied_group)))
elif name.startswith('module_') and isinstance(field, fields.boolean):
mod_ids = ir_module.search(cr, uid, [('name', '=', name[7:])])
modules.append((name, ir_module.browse(cr, uid, mod_ids[0], context)))
else:
others.append(name)
return {'default': defaults, 'group': groups, 'module': modules, 'other': others}
def default_get(self, cr, uid, fields, context=None):
ir_values = self.pool.get('ir.values')
classified = self._get_classified_fields(cr, uid, context)
res = super(res_config_settings, self).default_get(cr, uid, fields, context)
# defaults: take the corresponding default value they set
for name, model, field in classified['default']:
value = ir_values.get_default(cr, uid, model, field)
if value is not None:
res[name] = value
# groups: which groups are implied by the group Employee
for name, group, implied_group in classified['group']:
res[name] = implied_group in group.implied_ids
# modules: which modules are installed/to install
for name, module in classified['module']:
res[name] = module.state in ('installed', 'to install', 'to upgrade')
# other fields: call all methods that start with 'get_default_'
for method in dir(self):
if method.startswith('get_default_'):
res.update(getattr(self, method)(cr, uid, fields, context))
return res
def fields_get(self, cr, uid, allfields=None, context=None, write_access=True):
# overridden to make fields of installed modules readonly
res = super(res_config_settings, self).fields_get(cr, uid, allfields, context, write_access)
classified = self._get_classified_fields(cr, uid, context)
for name, module in classified['module']:
if name in res and module.state in ('installed', 'to install', 'to upgrade'):
res[name]['readonly'] = True
return res
def execute(self, cr, uid, ids, context=None):
ir_values = self.pool.get('ir.values')
ir_model_data = self.pool.get('ir.model.data')
ir_module = self.pool.get('ir.module.module')
res_groups = self.pool.get('res.groups')
classified = self._get_classified_fields(cr, uid, context)
config = self.browse(cr, uid, ids[0], context)
# default values fields
for name, model, field in classified['default']:
ir_values.set_default(cr, uid, model, field, config[name])
# group fields: modify group / implied groups
for name, group, implied_group in classified['group']:
if config[name]:
group.write({'implied_ids': [(4, implied_group.id)]})
else:
group.write({'implied_ids': [(3, implied_group.id)]})
implied_group.write({'users': [(3, u.id) for u in group.users]})
# other fields: execute all methods that start with 'set_'
for method in dir(self):
if method.startswith('set_'):
getattr(self, method)(cr, uid, ids, context)
# module fields: install immediately the selected modules
to_install_ids = []
for name, module in classified['module']:
if config[name] and module.state == 'uninstalled':
to_install_ids.append(module.id)
if to_install_ids:
ir_module.button_immediate_install(cr, uid, to_install_ids, context)
# open the menu for this wizard (or Settings), and force client-side refresh
act_ids = self.pool.get('ir.actions.act_window').search(cr, uid, [('res_model', '=', self._name)])
act_refs = ['ir.actions.act_window,%s' % id for id in act_ids]
val_ids = ir_values.search(cr, uid, [('model', '=', 'ir.ui.menu'), ('key', '=', 'action'),
('key2', '=', 'tree_but_open'), ('value', 'in', act_refs)])
if val_ids:
menu_id = ir_values.browse(cr, uid, val_ids[0]).res_id
else:
menu_id = ir_model_data.get_object(cr, uid, 'base', 'menu_administration', context).id
return {
'type': 'ir.ui.menu',
'menu_id': menu_id,
'reload': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -307,10 +307,15 @@ class res_partner(osv.osv):
if name and operator in ('=', 'ilike', '=ilike', 'like'):
# search on the name of the contacts and of its company
name2 = operator == '=' and name or '%' + name + '%'
limit_str = ''
query_args = [name2]
if limit:
limit_str = ' limit %s'
query_args += [limit]
cr.execute('''SELECT partner.id FROM res_partner partner
LEFT JOIN res_partner company ON partner.parent_id = company.id
WHERE partner.name || ' (' || COALESCE(company.name,'') || ')'
''' + operator + ''' %s ''', (name2,))
''' + operator + ''' %s ''' + limit_str, query_args)
ids = map(lambda x: x[0], cr.fetchall())
if args:
ids = self.search(cr, uid, [('id', 'in', ids)] + args, limit=limit, context=context)

View File

@ -331,27 +331,24 @@
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Partners">
<form string="Partners" validate="0">
<group col="8" colspan="4">
<group col="4" colspan="4">
<field name="name" required="1"/>
<field name="title" size="0" groups="base.group_extended" domain="[('domain', '=', 'contact')]"/>
<newline/>
<field name="function" attrs="{'invisible': [('is_company', '=', True)]}" colspan="4"/>
<field name="parent_id" string="Company" colspan="4" attrs="{'invisible': [('is_company','=', True)]}"
domain="[('is_company', '=', True)]" context="{'default_is_company': True}"
on_change="onchange_address(use_parent_address, parent_id)"/>
<group col="2">
<field name="photo" widget='image' nolabel="1"/>
</group>
<group colspan="4">
<h2><field name="name" required="1" nolabel="1" colspan="4"/></h2><newline/>
<field name="function" attrs="{'invisible': [('is_company', '=', True)]}"/>
<field name="title" size="0" groups="base.group_extended" domain="[('domain', '=', 'contact')]"/>
<field name="parent_id" string="Company" attrs="{'invisible': [('is_company','=', True)]}"
domain="[('is_company', '=', True)]" context="{'default_is_company': True}"
on_change="onchange_address(use_parent_address, parent_id)"/>
</group>
<group col="2">
<field name="is_company" on_change="onchange_type(is_company)"/>
</group>
<group col="2">
<field name="customer"/>
<field name="supplier"/>
</group>
<group col="2">
<field name="photo" widget='image' nolabel="1"/>
</group>
</group>
<notebook colspan="4">
<page string="General">
@ -372,7 +369,6 @@
</group>
<group colspan="2">
<separator string="Communication" colspan="4"/>
<field name="lang" colspan="4"/>
<field name="phone" colspan="4"/>
<field name="mobile" colspan="4"/>
<field name="fax" colspan="4"/>
@ -381,77 +377,61 @@
<field name="ref" groups="base.group_extended" colspan="4"/>
</group>
<group colspan="4" attrs="{'invisible': [('is_company','=', False)]}">
<field name="child_ids" context="{'default_parent_id': active_id}" nolabel="1">
<form string="Partners">
<group col="8" colspan="4">
<group col="4" colspan="4">
<field name="name" required="1"/>
<field name="title" size="0" groups="base.group_extended" domain="[('domain', '=', 'contact')]"/>
<newline/>
<field name="function" attrs="{'invisible': [('is_company', '=', True)]}" colspan="4"/>
<field name="parent_id" string="Company" colspan="4" attrs="{'invisible': [('is_company','=', True)]}"
domain="[('is_company', '=', True)]" context="{'default_is_company': True}"
on_change="onchange_address(use_parent_address, parent_id)" invisible="1"/>
</group>
<group col="2">
<field name="is_company" on_change="onchange_type(is_company)" invisible="1"/>
</group>
<group col="2">
<field name="customer"/>
<field name="supplier"/>
</group>
<group col="2">
<field name="photo" widget='image' nolabel="1"/>
</group>
</group>
<notebook colspan="4">
<page string="General">
<group colspan="2">
<separator string="Address" colspan="4"/>
<field name="type" string="Type" attrs="{'invisible': [('is_company','=', True)]}"/>
<group colspan="2">
<field name="use_parent_address" attrs="{'invisible': [('is_company','=', True)]}" on_change="onchange_address(use_parent_address, parent_id)"/>
</group>
<newline/>
<field name="street" colspan="4"/>
<field name="street2" colspan="4"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
<field name="state_id"/>
</group>
<group colspan="2">
<separator string="Communication" colspan="4"/>
<field name="lang" colspan="4"/>
<field name="phone" colspan="4"/>
<field name="mobile" colspan="4"/>
<field name="fax" colspan="4"/>
<field name="email" widget="email" colspan="4"/>
<field name="website" widget="url" colspan="4"/>
<field name="ref" groups="base.group_extended" colspan="4"/>
</group>
</page>
<page string="Sales &amp; Purchases" attrs="{'invisible': [('customer', '=', False), ('supplier', '=', False)]}">
<separator string="General Information" colspan="4"/>
<field name="user_id"/>
<field name="active" groups="base.group_extended"/>
<field name="date"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<newline/>
</page>
<page string="Categories" groups="base.group_extended">
<field name="category_id" colspan="4" nolabel="1"/>
</page>
<page string="Notes">
<field name="comment" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>
</field>
<field name="child_ids" context="{'default_parent_id': active_id}" nolabel="1" mode="kanban,list">
<kanban>
<field name="color"/>
<field name="name"/>
<field name="title"/>
<field name="email"/>
<field name="parent_id"/>
<field name="is_company"/>
<field name="function"/>
<field name="phone"/>
<field name="street"/>
<field name="street2"/>
<field name="photo"/>
<field name="zip"/>
<field name="city"/>
<field name="country_id"/>
<field name="mobile"/>
<field name="state_id"/>
<templates>
<t t-name="kanban-box">
<t t-set="color" t-value="kanban_color(record.color.raw_value)"/>
<div t-att-class="color + (record.title.raw_value == 1 ? ' oe_kanban_color_alert' : '')">
<div class="oe_module_vignette">
<a type="edit">
<img t-att-src="kanban_image('res.partner', 'photo', record.id.value)" class="oe_form_avatar oe_kanban_avatar_toto"/>
</a>
<div class="oe_module_desc">
<div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger oe_kanban_color_border">
<table class="oe_kanban_table">
<tr>
<td class="oe_kanban_title1" align="left" valign="middle">
<h4><a type="edit"><field name="name"/></a></h4>
<i><div t-if="record.function.raw_value">
<field name="function"/><br/></div></i>
</td>
<td valign="top" align="right">
<a t-if="record.email.raw_value" title="Mail" t-att-href="'mailto:'+record.email.value" style="text-decoration: none;" >
<img src="/web/static/src/img/icons/terp-mail-message-new.png" border="0" width="16" height="16"/>
</a>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</group>
</page>
<page string="Sales &amp; Purchases" attrs="{'invisible': [('customer', '=', False), ('supplier', '=', False)]}">
<separator string="General Information" colspan="4"/>
<field name="lang" colspan="4"/>
<field name="user_id"/>
<field name="active" groups="base.group_extended"/>
<field name="date"/>
@ -533,7 +513,7 @@
<img t-att-src="kanban_image('res.partner', 'photo', record.id.value)" width="64" height="64" class="oe_module_icon"/>
</a>
<div class="oe_module_desc">
<div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger oe_kanban_color_border">
<div class="oe_kanban_box_content oe_kanban_box_show_onclick_trigger oe_kanban_color_border">
<table class="oe_kanban_table">
<tr>
<td class="oe_kanban_title1" align="left" valign="middle">
@ -541,7 +521,7 @@
<div t-if="record.parent_id.raw_value"><field name="parent_id"/></div>
</h4>
<i><div t-if="record.contact_address.raw_value"><field name="contact_address"/><br/></div>
<div t-if="record.email.raw_value">
<div t-if="record.email.raw_value">
<field name="email"/><br/></div>
<div t-if="record.mobile.raw_value">
<field name="mobile"/><br/>

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="0">
<record model="res.groups" id="group_partner_manager" context="{'noadmin':True}">
<record model="res.groups" id="group_partner_manager">
<field name="name">Partner Manager</field>
</record>

View File

@ -96,22 +96,6 @@ class groups(osv.osv):
self.pool.get('ir.model.access').call_cache_clearing_methods(cr)
return res
def create(self, cr, uid, vals, context=None):
if 'name' in vals:
if vals['name'].startswith('-'):
raise osv.except_osv(_('Error'),
_('The name of the group can not start with "-"'))
gid = super(groups, self).create(cr, uid, vals, context=context)
if context and context.get('noadmin', False):
pass
else:
# assign this new group to user_root
user_obj = self.pool.get('res.users')
aid = user_obj.browse(cr, 1, user_obj._get_admin_id(cr))
if aid:
aid.write({'groups_id': [(4, gid)]})
return gid
def get_extended_interface_group(self, cr, uid, context=None):
data_obj = self.pool.get('ir.model.data')
extended_group_data_id = data_obj._get_id(cr, uid, 'base', 'group_extended')
@ -391,7 +375,7 @@ class users(osv.osv):
}
# User can write to a few of her own fields (but not her groups for example)
SELF_WRITEABLE_FIELDS = ['menu_tips','view', 'password', 'signature', 'action_id', 'company_id', 'user_email', 'name']
SELF_WRITEABLE_FIELDS = ['menu_tips','view', 'password', 'signature', 'action_id', 'company_id', 'user_email', 'name', 'avatar', 'avatar_big']
def write(self, cr, uid, ids, values, context=None):
if not hasattr(ids, '__iter__'):
@ -770,22 +754,23 @@ class groups_view(osv.osv):
# and introduces the reified group fields
view = self.get_user_groups_view(cr, uid, context)
if view:
xml1, xml2 = [], []
xml1.append(E.separator(string=_('Application'), colspan="4"))
for app, kind, gs in self.get_groups_by_application(cr, uid, context):
# hide groups in category 'Hidden' (except to group_no_one)
attrs = {'groups': 'base.group_no_one'} if app and app.xml_id == 'base.module_category_hidden' else {}
if kind == 'selection':
# application name with a selection field
field_name = name_selection_groups(map(int, gs))
xml1.append(E.field(name=field_name))
xml1.append(E.field(name=field_name, **attrs))
xml1.append(E.newline())
else:
# application separator with boolean fields
app_name = app and app.name or _('Other')
xml2.append(E.separator(string=app_name, colspan="4"))
xml2.append(E.separator(string=app_name, colspan="4", **attrs))
for g in gs:
field_name = name_boolean_group(g.id)
xml2.append(E.field(name=field_name))
xml2.append(E.field(name=field_name, **attrs))
xml = E.field(*(xml1 + xml2), name="groups_id", position="replace")
xml.addprevious(etree.Comment("GENERATED AUTOMATICALLY BY GROUPS"))

View File

@ -12,28 +12,30 @@
<record model="res.groups" id="group_system">
<field name="name">Configuration</field>
<field name="implied_ids" eval="[(4, ref('group_erp_manager'))]"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<record model="res.groups" id="group_user">
<field name="name">Employee</field>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>
<record model="res.groups" context="{'noadmin':True}" id="group_multi_company">
<record model="res.groups" id="group_multi_company">
<field name="name">Multi Companies</field>
</record>
<record model="res.groups" context="{'noadmin':True}" id="group_extended">
<record model="res.groups" id="group_extended">
<field name="name">Extended View</field>
</record>
<record model="res.groups" id="group_no_one" context="{'noadmin':True}">
<record model="res.groups" id="group_no_one">
<field name="name">Technical Features</field>
</record>
<record id="group_sale_salesman" context="{'noadmin':True}" model="res.groups">
<record id="group_sale_salesman" model="res.groups">
<field name="name">User</field>
</record>
<record id="group_sale_manager" context="{'noadmin':True}" model="res.groups">
<record id="group_sale_manager" model="res.groups">
<field name="name">Manager</field>
<field name="implied_ids" eval="[(4, ref('group_sale_salesman'))]"/>
</record>

View File

@ -122,3 +122,5 @@
"access_ir_actions_todo_category","ir_actions_todo_category","model_ir_actions_todo_category","group_system",1,1,1,1
"access_ir_actions_client","ir_actions_client all","model_ir_actions_client",,1,0,0,0
"access_ir_needaction_users","ir_needaction_users","model_ir_needaction_users",,1,1,1,1
"access_ir_needaction_mixin","ir_needaction_mixin","model_ir_needaction_mixin",,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
122 access_ir_actions_todo_category ir_actions_todo_category model_ir_actions_todo_category group_system 1 1 1 1
123 access_ir_actions_client ir_actions_client all model_ir_actions_client 1 0 0 0
124 access_ir_needaction_users ir_needaction_users model_ir_needaction_users 1 1 1 1
125 access_ir_needaction_mixin ir_needaction_mixin model_ir_needaction_mixin 1 1 1 1
126

View File

@ -1651,7 +1651,7 @@ class BaseModel(object):
children = False
views = {}
for f in node:
if f.tag in ('form', 'tree', 'graph'):
if f.tag in ('form', 'tree', 'graph', 'kanban'):
node.remove(f)
ctx = context.copy()
ctx['base_model_name'] = self._name
@ -4885,14 +4885,14 @@ class BaseModel(object):
if hasattr(self, 'needaction_get_record_ids'):
ids = self.needaction_get_record_ids(cr, uid, user_id, limit=8192, context=context)
if not ids:
return (True, 0, [])
return [True, 0, []]
if domain:
new_domain = eval(domain) + [('id', 'in', ids)]
new_domain = eval(domain, locals_dict={'uid': user_id}) + [('id', 'in', ids)]
else:
new_domain = [('id', 'in', ids)]
return (True, self.search(cr, uid, new_domain, limit=limit, order=order, count=True, context=context), ids)
return [True, self.search(cr, uid, new_domain, limit=limit, order=order, count=True, context=context), ids]
else:
return (False, 0, [])
return [False, 0, []]
# Transience
def is_transient(self):