merged with #1024 trunk

bzr revid: jean-baptiste.aubort@camptocamp.com-20080826084217-plshba1mxektp8cf
This commit is contained in:
Jean-Baptiste Aubort 2008-08-26 10:42:17 +02:00
commit 1837b36369
17 changed files with 373 additions and 172 deletions

View File

@ -2,10 +2,10 @@
<terp>
<data>
<!--
======================
Languages
======================
-->
======================
Languages
======================
-->
<record id="view_lang" model="ir.ui.view">
<field name="name">Languages</field>
<field name="model">res.lang</field>
@ -28,10 +28,10 @@
<menuitem id="next_id_2" name="Interface" parent="base.menu_custom"/><menuitem action="action_lang" id="menu_action_lang" parent="next_id_2"/>
<!--
======================
Groups
======================
-->
======================
Groups
======================
-->
<record id="view_groups_form" model="ir.ui.view">
<field name="name">res.groups.form</field>
<field name="model">res.groups</field>
@ -84,10 +84,10 @@
</record>
<!--
======================
Users
======================
-->
======================
Users
======================
-->
<record id="view_users_form_simple_modif" model="ir.ui.view">
<field name="name">res.users.form.modif</field>
<field name="model">res.users</field>
@ -151,10 +151,10 @@
</record>
<!--
======================
Company
======================
-->
======================
Company
======================
-->
<record id="view_company_form" model="ir.ui.view">
<field name="name">res.company.form</field>
<field name="model">res.company</field>
@ -196,35 +196,27 @@
</field>
</record>
<record id="view_users_configuration_form" model="ir.ui.view">
<field name="name">res.users.confirm.form</field>
<field name="model">res.users</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Configure User">
<notebook colspan="4">
<page string="User Definition">
<separator col="4" colspan="4" string="Define a New User"/>
<field name="name" select="1"/>
<newline/>
<field name="login" select="1"/>
<field name="password"/>
<field colspan="4" name="signature"/>
</page><page string="Access Rights">
<label string="Assign groups to set objects available for this user" colspan="4"/>
<field colspan="4" name="groups_id" nolabel="1"/>
</page>
</notebook>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<group col="3" colspan="3">
<button icon='gtk-cancel' special="cancel" name="action_next" type='object' string='Skip &amp; Continue'/>
<button name='action_new' icon='gtk-ok' type='object' string='Add Another User'/>
<button name='action_continue' icon='gtk-ok' type='object' string='Continue'/>
</group>
<separator col="4" colspan="4" string="Define a New User"/>
<field name="name" select="1"/>
<newline/>
<field name="login" select="1"/>
<field name="password" required="1"/>
<field colspan="4" name="signature"/>
<separator string="Assign Groups to Define Access Rights" colspan="4"/>
<field colspan="4" name="groups_id" nolabel="1"/>
<separator string="" colspan="4"/>
<label string="" colspan="1"/>
<group col="3" colspan="2">
<button icon='gtk-cancel' special="cancel" name="action_next" type='object' string='Skip &amp; Continue'/>
<button name='action_new' icon='gtk-ok' type='object' string='Add New User'/>
<button name='action_continue' icon='gtk-go-forward' type='object' string='Add &amp; Continue'/>
</group>
</form>
</field>
</record>
@ -239,18 +231,18 @@
<field name="target">new</field>
</record>
<record id="view_confirm_simple_view_form" model="ir.ui.view">
<field name="name">res.users.confirm.simple_view</field>
<field name="model">res.config.view</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Configure simple view">
<separator string="Choose the simple or extended views" colspan="4"/>
<field colspan="2" name="view"/>
<separator string="Choose Your Mode" colspan="4"/>
<field colspan="2" name="view"/>
<label string="Choose the simplified interface if you are testing OpenERP for the first time. Less used options or fields are automatically hidden. You will be able to change this, later, through the Administration menu." colspan="4" align="0.0"/>
<newline/>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<label string="" colspan="2"/>
<group colspan="2" col="1">
<button icon="gtk-ok" name="action_set" string="Set" type="object"/>
</group>
@ -273,18 +265,20 @@
<record id="config_wizard_step_user" model="ir.module.module.configuration.step">
<field name="name">Create User</field>
<field name="note">Create your different users.
<field name="note">Create your users.
You will be able to assign groups to users. Groups define the access rights of each users on the different objects of the system.
</field>
</field>
<field name="action_id" ref="action_config_user_form"/>
<field name="state">open</field>
<field name="sequence">10</field>
</record>
<record id="config_wizard_simple_view" model="ir.module.module.configuration.step">
<field name="name">Select between the simplified views or the extended views.</field>
<field name="note">Select between the simplified views or the extended views.
If you are testing or using OpenERP for the first time, we suggest you to use the simplified view, which has less features but is easier to understand. You will be able to switch to the extended view later.
<field name="name">Select Your Interface</field>
<field name="note">Choose between the "Simplified Interface" or the extended one.
If you are testing or using OpenERP for the first time, we suggest you to use
the simplified interface, which has less options and fields but is easier to
understand. You will be able to switch to the extended view later.
</field>
<field name="action_id" ref="action_config_simple_view_form"/>
<field name="state">open</field>

View File

@ -1185,12 +1185,29 @@ Cron Jobs
<field name="trigger_name" select="2"/>
</page>
<page string="Email" attrs="{'invisible':[('state','=','python'),('state','=','dummy'),('state','=','trigger'), ('state','=','object_create'), ('state','=','object_write'), ('state','=','client_action'), ('state','=','other')]}">
<page string="Email / SMS" attrs="{'invisible':[('state','=','python'),('state','=','dummy'),('state','=','trigger'), ('state','=','object_create'), ('state','=','object_write'), ('state','=','client_action'), ('state','=','other')]}">
<separator colspan="4" string="Email Configuration"/>
<field name="address" domain="[('model_id','=',model_id)]"/>
<field name="message" select="2" colspan="4"/>
<field name="message" select="2" colspan="4" widget="html_tag"/>
<newline/>
<label colspan="4" string="Use o to access the current object, you can use the any attributes which is belongs to current selected obect with o, i.e. o.partner_id.name for Invoice Object"/>
<label colspan="4" string="Access all the fields related to the current object easily just by defining name of the attribute, i.e. [[partner_id.name]] for Invoice Object"/>
</page>
<page string="Create / Write" attrs="{'invisible':[('state','=','python'),('state','=','dummy'),('state','=','trigger'), ('state','=','sms'), ('state','=','email'), ('state','=','client_action'), ('state','=','other')]}">
<separator colspan="4" string="Fields Mapping"/>
<field name="srcmodel_id" select="2"/>
<field name="fields_lines" nolabel="1" select="2" colspan="4">
<tree string="Field Mappings" editable="top">
<field name="col1" domain="[('model_id','=',parent.srcmodel_id)]"/>
<field name="type"/>
<field name="value"/>
</tree>
<form string="Field Mapping">
<field name="col1" domain="[('model_id','=',parent.srcmodel_id)]"/>
<field name="type"/>
<field name="value" colapsn="4"/>
</form>
</field>
</page>
<page string="Other Actions" attrs="{'invisible':[('state','!=','other')]}">

View File

@ -33,6 +33,7 @@ import tools
import time
from tools.config import config
import netsvc
import re
class actions(osv.osv):
_name = 'ir.actions.actions'
@ -278,6 +279,7 @@ class ir_model_fields(osv.osv):
}
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=80):
def get_fields(cr, uid, field, rel):
result = []
mobj = self.pool.get('ir.model')
@ -331,6 +333,23 @@ class ir_model_fields(osv.osv):
ir_model_fields()
class server_object_lines(osv.osv):
_name = 'ir.server.object.lines'
_sequence = 'ir_actions_id_seq'
_columns = {
'server_id': fields.many2one('ir.actions.server', 'Object Mapping'),
'col1': fields.many2one('ir.model.fields', 'Destination', required=True),
'value': fields.text('Value', required=True),
'type': fields.selection([
('value','Value'),
('equation','Formula')
], 'Type', required=True, size=32, change_default=True),
}
_defaults = {
'type': lambda *a: 'equation',
}
server_object_lines()
##
# Actions that are run on the server side
#
@ -356,14 +375,13 @@ class actions_server(osv.osv):
'model_id': fields.many2one('ir.model', 'Object', required=True),
'trigger_name': fields.char('Trigger Name', size=128),
'trigger_obj_id': fields.reference('Trigger On', selection=model_get, size=128),
#'trigger_object': fields.char('Trigger Object', size=128),
#'trigger_object_id': fields.char('Trigger Object ID', size=128),
'message': fields.text('Message', translate=True),
'address': fields.many2one('ir.model.fields', 'Email From / SMS'),
#selection(_get_fields ,'Email / SMS', size=128),
'child_ids': fields.one2many('ir.actions.actions', 'parent_id', 'Others Actions'),
'usage': fields.char('Action Usage', size=32),
'type': fields.char('Report Type', size=32, required=True),
'srcmodel_id': fields.many2one('ir.model', 'Model', required=True),
'fields_lines': fields.one2many('ir.server.object.lines', 'server_id', 'Fields Mapping'),
}
_defaults = {
'state': lambda *a: 'dummy',
@ -379,7 +397,53 @@ class actions_server(osv.osv):
# If you plan to return an action, assign: action = {...}
"""
}
def get_field_value(self, cr, uid, action, context):
obj_pool = self.pool.get(action.model_id.model)
id = context.get('active_id')
obj = obj_pool.browse(cr, uid, id)
fields = None
if '/' in action.address.complete_name:
fields = action.address.complete_name.split('/')
elif '.' in action.address.complete_name:
fields = action.address.complete_name.split('.')
for field in fields:
try:
obj = getattr(obj, field)
except Exception,e :
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (match.group()))
return obj
def merge_message(self, cr, uid, keystr, action, context):
logger = netsvc.Logger()
def merge(match):
obj_pool = self.pool.get(action.model_id.model)
id = context.get('active_id')
obj = obj_pool.browse(cr, uid, id)
field = match.group()
field = field.replace('[','')
field = field.replace(']','')
field = field.strip()
fields = field.split('.')
for field in fields:
try:
obj = getattr(obj, field)
except Exception,e :
logger.notifyChannel('Workflow', netsvc.LOG_ERROR, 'Failed to parse : %s' % (match.group()))
return str(obj)
com = re.compile('\[\[(.+?)\]\]')
message = com.sub(merge, keystr)
return message
#
# Context should contains:
# ids : original ids
@ -407,18 +471,8 @@ class actions_server(osv.osv):
user = config['email_from']
subject = action.name
obj_pool = self.pool.get(action.model_id.model)
id = context.get('active_id')
obj = obj_pool.browse(cr, uid, id)
fields = action.address.complete_name.split('/')
for field in fields:
obj = getattr(obj, field)
address = obj
body = action.message
#TODO : Apply Mail merge in to the Content of the Email
address = self.get_field_value(cr, uid, str(action.message), action, context)
body = self.merge_message(cr, uid, action, context)
if tools.email_send_attach(user, address, subject, body, debug=False) == True:
logger.notifyChannel('email', netsvc.LOG_INFO, 'Email successfully send to : %s' % (address))
@ -454,7 +508,22 @@ class actions_server(osv.osv):
exec code in localdict
if 'action' in localdict:
return localdict['action']
if action.state == 'object_write':
res = {}
for exp in action.fields_lines:
euq = exp.value
if exp.type == 'equation':
expr = self.merge_message(cr, uid, euq, action, context)
expr = eval(expr)
else:
expr = exp.value
res[exp.col1.name] = expr
obj_pool = self.pool.get(action.model_id.model)
obj_pool.write(cr, uid, [context.get('active_id')], res)
if action.state == 'object_create':
pass
return False
actions_server()

View File

@ -80,7 +80,7 @@ class view(osv.osv):
(_check_xml, 'Invalid XML for View Architecture!', ['arch'])
]
def read(self,cr, uid, ids, fields=None, context={}, load='_classic_read'):
def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'):
if not isinstance(ids, (list, tuple)):
ids = [ids]
@ -94,6 +94,7 @@ class view(osv.osv):
if oview:
rs['arch'] = oview[0]['arch']
return result
def write(self, cr, uid, ids, vals, context={}):
@ -107,7 +108,7 @@ class view(osv.osv):
vals2 = {'user_id': uid, 'ref_id': ids[0], 'arch': vals.pop('arch')}
# write fields except arch to the `ir.ui.view`
result = super(view, self).write(cr, uid, vids, vals, context)
result = super(view, self).write(cr, uid, ids, vals, context)
if not vids:
self.pool.get('ir.ui.view.custom').create(cr, uid, vals2)

View File

@ -578,7 +578,7 @@ class module_configuration(osv.osv_memory):
item = item_obj.browse(cr, uid, item_ids[0], context=context)
return item.note
else:
return "Your database is now fully configured.\n\nClick 'Continue' and enyoy your OpenERP experience..."
return "Your database is now fully configured.\n\nClick 'Continue' and enjoy your OpenERP experience..."
return False
def _get_action(self, cr, uid, context={}):
@ -591,15 +591,20 @@ class module_configuration(osv.osv_memory):
return item.id
return False
def _progress_get(self,cr,uid, context={}):
total = self.pool.get('ir.module.module.configuration.step').search_count(cr, uid, [], context)
todo = self.pool.get('ir.module.module.configuration.step').search_count(cr, uid, [('state','<>','open')], context)
return max(5.0,round(todo*100/total))
_columns = {
'name': fields.text('Next Wizard',readonly=True),
'progress': fields.float('Configuration Progress', readonly=True),
'item_id':fields.many2one('ir.module.module.configuration.step', 'Next Configuration Wizard',invisible=True, readonly=True),
}
_defaults={
'progress': _progress_get,
'item_id':_get_action,
'name':_get_action_name,
}
def button_skip(self,cr,uid,ids,context=None):
item_obj = self.pool.get('ir.module.module.configuration.step')

View File

@ -224,23 +224,24 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Next Configuration Step">
<image name="gtk-dialog-info"/>
<group>
<separator string="Next Configuration Step" colspan="4"/>
<field name="name" nolabel="1" colspan="4" width="500"/>
<separator colspan="4" string=""/>
<label string="" colspan="2"/>
<group colspan="2" col="2">
<button icon="gtk-cancel" special="cancel" string="Skip Step"/>
<button icon="gtk-go-forward" name="button_continue" string="Continue" type="object"/>
</group>
</group>
<image name="gtk-dialog-info"/>
<group>
<separator string="Next Configuration Step" colspan="4"/>
<field name="name" nolabel="1" colspan="4" width="500"/>
<field name="progress" widget="progressbar"/>
<separator colspan="4" string=""/>
<label string="" colspan="2"/>
<group colspan="2" col="2">
<button icon="gtk-cancel" special="cancel" string="Skip Step"/>
<button icon="gtk-go-forward" name="button_continue" string="Continue" type="object"/>
</group>
</group>
</form>
</field>
</record>
<record id="action_config_wizard_form" model="ir.actions.act_window">
<field name="name">Main Configuration Window</field>
<field name="name">Configuration Wizard</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ir.module.module.configuration.wizard</field>
<field name="view_type">form</field>

View File

@ -65,6 +65,39 @@
<field name="wiz_name">module.lang.import</field>
</record>
<menuitem action="wizard_lang_import" id="menu_wizard_lang_import" parent="base.menu_translation" type="wizard"/>
<record id="wizard_lang_import" model="ir.actions.wizard">
<field name="name">Import language</field>
<field name="wiz_name">module.lang.import</field>
</record>
<menuitem action="wizard_lang_import" id="menu_wizard_lang_import" parent="base.menu_translation" type="wizard"/>
<record id="wizard_update_translations" model="ir.ui.view">
<field name="name">Update Translations</field>
<field name="model">wizard.module.update_translations</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form col="3" string="Update Translations">
<image name="gtk-dialog-info"/>
<group col="2" fill="0" height="500">
<field name="lang" width="300"/>
</group>
<group col="2" colspan="3" fill="0">
<button icon="gtk-cancel" name="act_cancel" special="cancel" string="Cancel" type="object"/>
<button icon="gtk-ok" name="act_update" string="Update" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_wizard_update_translations" model="ir.actions.act_window">
<field name="name">Update Translations</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wizard.module.update_translations</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<menuitem action="action_wizard_update_translations" id="menu_wizard_update_translations" parent="base.menu_translation"/>
</data>
</terp>

View File

@ -35,6 +35,7 @@ import add_new
import wizard_export_lang
import wizard_import_lang
import wizard_module_import
import wizard_update_translations
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,67 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from osv import osv, fields
import tools
import pooler
import StringIO
class update_translations(osv.osv_memory):
def _get_languages(self, cr, uid, context):
lang_obj=pooler.get_pool(cr.dbname).get('res.lang')
ids=lang_obj.search(cr, uid, ['&', ('active', '=', True), ('translatable', '=', True),])
langs=lang_obj.browse(cr, uid, ids)
return [(lang.code, lang.name) for lang in langs]
def _get_lang_name(self, cr, uid, lang_code):
lang_obj=pooler.get_pool(cr.dbname).get('res.lang')
ids=lang_obj.search(cr, uid, [('code', '=', lang_code)])
if not ids:
raise osv.orm_except('Bad lang')
lang = lang_obj.browse(cr, uid, ids[0])
return lang.name
def act_cancel(self, cr, uid, ids, context=None):
return {'type': 'ir.actions.act_window_close'}
def act_update(self, cr, uid, ids, context=None):
this = self.browse(cr, uid, ids)[0]
lang_name = self._get_lang_name(cr, uid, this.lang)
buf=StringIO.StringIO()
tools.trans_export(this.lang, ['all'], buf, 'csv', dbname=cr.dbname)
tools.trans_load_data(cr.dbname, buf, 'csv', this.lang, lang_name=lang_name)
buf.close()
return {'type': 'ir.actions.act_window_close'}
_name = 'wizard.module.update_translations'
_columns = {
'lang': fields.selection(_get_languages, 'Language', required=True),
}
update_translations()

View File

@ -138,7 +138,7 @@ class res_partner(osv.osv):
'parent_id': fields.many2one('res.partner','Main Company', select=2),
'child_ids': fields.one2many('res.partner', 'parent_id', 'Partner Ref.'),
'ref': fields.char('Code', size=64),
'lang': fields.selection(_lang_get, 'Language', size=5),
'lang': fields.selection(_lang_get, 'Language', size=5, help="If the selected language is loaded in the system, all documents related to this partner will be printed in this language. If not, it will be english."),
'user_id': fields.many2one('res.users', 'Dedicated Salesman', help='The internal user that is in charge of communicating with this partner if any.'),
'responsible': fields.many2one('res.users', 'Users'),
'vat': fields.char('VAT',size=32 ,help="Value Added Tax number"),
@ -152,9 +152,12 @@ class res_partner(osv.osv):
'credit_limit': fields.float(string='Credit Limit'),
'ean13': fields.char('EAN13', size=13),
'active': fields.boolean('Active'),
'customer': fields.boolean('Customer'),
'supplier': fields.boolean('Supplier'),
}
_defaults = {
'active': lambda *a: 1,
'customer': lambda *a: 1,
}
_sql_constraints = [
('name_uniq', 'unique (name)', 'The name of the partner must be unique !')
@ -259,10 +262,18 @@ class res_partner(osv.osv):
# update the current partner
cr.execute("update res_partner set ref=%d where id=%d", (nextref, ids[0]))
return True
def view_header_get(self, cr, uid, view_id, view_type, context):
res = super(res_partner, self).view_header_get(cr, uid, view_id, view_type, context)
if res: return res
if (not context.get('category_id', False)):
return False
return _('Partners: ')+self.pool.get('res.partner.category').browse(cr, uid, context['category_id'], context).name
res_partner()
class res_partner_address(osv.osv):
_description ='Partner Contact'
_description ='Partner Addresses'
_name = 'res.partner.address'
_order = 'id'
_columns = {

View File

@ -6,10 +6,10 @@
<menuitem id="menu_base_config" name="Configuration" parent="menu_base_partner" sequence="1"/>
<!--
================================
Function
================================
-->
================================
Function
================================
-->
<record id="view_partner_function_form" model="ir.ui.view">
<field name="name">res.partner.function.form</field>
<field name="model">res.partner.function</field>
@ -41,16 +41,16 @@
<menuitem action="action_partner_function_form" id="menu_partner_function_form" parent="base.menu_base_config"/>
<!--
=====================
Partner Address
=====================
-->
=====================
Partner Address
=====================
-->
<record id="view_partner_address_tree" model="ir.ui.view">
<field name="name">res.partner.address.tree</field>
<field name="model">res.partner.address</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Partner contacts">
<tree string="Partner Addresses">
<field name="partner_id"/>
<field name="name"/>
<field name="zip"/>
@ -73,7 +73,7 @@
<field name="type">form</field>
<field eval="8" name="priority"/>
<field name="arch" type="xml">
<form string="Partner contacts">
<form string="Partner Address">
<field colspan="4" name="partner_id" select="1"/>
<newline/>
<field name="name" select="1"/>
@ -98,7 +98,7 @@
</field>
</record>
<record id="action_partner_address_form" model="ir.actions.act_window">
<field name="name">Partner Contacts</field>
<field name="name">Partner Addresses</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner.address</field>
<field name="view_type">form</field>
@ -118,10 +118,10 @@
<menuitem action="action_partner_address_form" id="menu_partner_address_form" parent="base.menu_base_partner"/>
<!--
=========================================
the short form used in the partner form
=========================================
-->
=========================================
the short form used in the partner form
=========================================
-->
<record id="view_partner_address_form2" model="ir.ui.view">
<field name="name">res.partner.address.form2</field>
<field name="model">res.partner.address</field>
@ -151,10 +151,10 @@
</record>
<!--
=======================
Partner Titles
=======================
-->
=======================
Partner Titles
=======================
-->
<record id="view_partner_title_form" model="ir.ui.view">
<field name="name">res.partner.title.form</field>
<field name="model">res.partner.title</field>
@ -176,10 +176,10 @@
<menuitem action="action_partner_title" id="menu_partner_title" parent="base.menu_base_config"/>
<!--
=======================
Partner
=======================
-->
=======================
Partner
=======================
-->
<record id="view_partner_tree" model="ir.ui.view">
<field name="name">res.partner.tree</field>
<field name="model">res.partner</field>
@ -201,13 +201,16 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Partners">
<notebook>
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="customer" select="1"/>
<field name="supplier" select="2"/>
<field domain="[('domain', '=', 'partner')]" name="title"/>
<field name="ref" select="1"/>
<field name="lang" select="2"/>
</group>
<notebook colspan="4">
<page string="General">
<field name="name" select="1"/>
<field domain="[('domain', '=', 'partner')]" name="title"/>
<field name="ref" select="1"/>
<field name="lang" select="2"/>
<newline/>
<field colspan="4" mode="form,tree" name="address" nolabel="1" select="1">
<form string="Partner contacts">
<field name="name" select="2"/>
@ -239,47 +242,19 @@
<separator colspan="4" string="Categories"/>
<field colspan="4" name="category_id" nolabel="1" select="2"/>
</page>
<page string="Extra Info">
<field name="active" select="2"/>
<newline/>
<field name="credit_limit"/>
<page string="Sales &amp; Purchases">
<separator string="General Information" colspan="4"/>
<field name="user_id" select="2"/>
<field name="parent_id"/>
<field name="active" select="2"/>
<field name="website" widget="url"/>
<field name="date" select="2"/>
<field colspan="4" context="address=address" name="bank_ids" nolabel="1">
<form string="Bank account">
<field name="state" select="2"/>
<newline/>
<field name="acc_number" select="1"/>
<newline/>
<field name="bank"/>
<newline/>
<field name="sequence"/>
<field colspan="4" name="name" select="2"/>
<separator colspan="4" string="Bank account owner"/>
<field colspan="4" name="owner_name"/>
<field colspan="4" name="street"/>
<newline/>
<field name="zip"/>
<field name="city"/>
<newline/>
<field completion="1" name="country_id"/>
<field name="state_id"/>
</form>
<tree string="Bank Details">
<field name="state"/>
<field name="owner_name"/>
<field name="acc_number"/>
</tree>
</field>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="comment" nolabel="1"/>
<field name="parent_id"/>
</page>
<page string="Event History">
<page string="History">
<field colspan="4" name="events" nolabel="1" widget="one2many_list"/>
</page>
<page string="Properties">
<page string="Notes">
<field colspan="4" name="comment" nolabel="1"/>
</page>
</notebook>
</form>
@ -305,7 +280,32 @@
<field name="act_window_id" ref="action_partner_form"/>
</record>
<menuitem action="action_partner_form" id="menu_partner_form" parent="base.menu_base_partner"/>
<record id="action_partner_customer_form" model="ir.actions.act_window">
<field name="name">Customers Partners</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="domain">[('customer','=',1)]</field>
</record>
<menuitem action="action_partner_customer_form" id="menu_partner_customer_form" parent="menu_partner_form"/>
<record id="action_partner_supplier_form" model="ir.actions.act_window">
<field name="name">Suppliers Partners</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="domain">[('supplier','=',1)]</field>
</record>
<menuitem action="action_partner_supplier_form" id="menu_partner_supplier_form" parent="menu_partner_form"/>
<record id="action_partner_other_form" model="ir.actions.act_window">
<field name="name">Others Partners</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="domain">[('supplier','&lt;&gt;',1),('customer','&lt;&gt;',1)]</field>
</record>
<menuitem action="action_partner_other_form" id="menu_partner_other_form" parent="menu_partner_form"/>
<record id="view_payterm_form" model="ir.ui.view">
<field name="name">res.payterm</field>
<field name="model">res.payterm</field>
@ -389,10 +389,10 @@
</record>
<!--
======================
Company Architecture
======================
-->
======================
Company Architecture
======================
-->
<record id="view_partner_tree2" model="ir.ui.view">
<field name="name">res.partner.tree</field>
<field name="model">res.partner</field>
@ -423,16 +423,16 @@
</record>
<!--
======================
Categories
======================
-->
======================
Categories
======================
-->
<record id="view_partner_category_form" model="ir.ui.view">
<field name="name">res.partner.category.form</field>
<field name="model">res.partner.category</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Partner categories">
<form string="Partner category">
<field name="name" select="1"/>
<field name="active" select="1"/>
<field name="parent_id"/>
@ -445,7 +445,7 @@
<field name="type">tree</field>
<field eval="6" name="priority"/>
<field name="arch" type="xml">
<tree string="Partner categories">
<tree string="Partner Categories">
<field name="complete_name"/>
</tree>
</field>
@ -462,7 +462,7 @@
</field>
</record>
<record id="action_partner_category" model="ir.actions.act_window">
<field name="name">Partner categories</field>
<field name="name">Partners by Categories</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner.category</field>
<field name="view_type">tree</field>
@ -472,11 +472,12 @@
<menuitem id="next_id_13" name="Categories" parent="base.menu_base_config"/><menuitem action="action_partner_category" id="menu_partner_category" parent="next_id_13"/>
<record id="action_partner_by_category" model="ir.actions.act_window">
<field name="name">Partners By Category</field>
<field name="name" eval="False"/>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('category_id','child_of', [active_id])]</field>
<field name="context">{'category_id':active_id}</field>
</record>
<record id="ir_action_partner_by_category" model="ir.values">
<field eval="'tree_but_open'" name="key2"/>

View File

@ -260,12 +260,11 @@ class res_config_view(osv.osv_memory):
_name='res.config.view'
_columns = {
'name':fields.char('Name', size=64),
'view': fields.selection([('simple','Simple'),('extended','Extended')], 'View', required=True ),
'view': fields.selection([('simple','Simplified Interface'),('extended','Extended Interface')], 'View Mode', required=True ),
}
_defaults={
'view':lambda *args: 'simple',
}
}
def action_cancel(self,cr,uid,ids,conect=None):
print ' Cancel action'

0
bin/addons/module_graph.py Normal file → Executable file
View File

View File

@ -70,7 +70,7 @@ class expression(object):
return []
ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context)
return ids+rg(ids2, table, parent)
return [(prefix+left, 'in', rg(ids2, table, parent))]
return [(left, 'in', rg(ids2, table, parent))]
self.__main_table = table
@ -148,7 +148,7 @@ class expression(object):
return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids)
dom = _rec_get(ids2, field_obj, working_table._parent_name)
ids2 = field_obj.search(cr, uid, doms, context=context)
ids2 = field_obj.search(cr, uid, dom, context=context)
self.__exp[i] = ('id', 'in', _rec_convert(ids2))
else:
if isinstance(right, basestring):
@ -165,7 +165,7 @@ class expression(object):
self.__operator = 'in'
if field._obj != working_table._name:
dom = _rec_get(ids2, field_obj, working_table._parent_name, left=left)
dom = _rec_get(ids2, field_obj, working_table._parent_name, left=left, prefix=field._obj)
else:
dom = _rec_get(ids2, working_table, left)
self.__exp = self.__exp[:i] + dom + self.__exp[i+1:]

View File

@ -768,7 +768,7 @@ class orm_template(object):
fields[node.getAttribute('name')] = attrs
elif node.nodeType==node.ELEMENT_NODE and node.localName in ('form', 'tree'):
result = self.view_header_get(cr, user, False, node.localName, context)
result = self.pool.get(self._name).view_header_get(cr, user, False, node.localName, context)
if result:
node.setAttribute('string', result.decode('utf-8'))
if node.nodeType == node.ELEMENT_NODE and node.hasAttribute('groups'):

View File

@ -92,6 +92,8 @@ def attr_get(node, attrs, dict={}):
res[key] = bool_get(node.getAttribute(key))
elif dict[key]=='int':
res[key] = int(node.getAttribute(key))
elif dict[key]=='unit':
res[key] = unit_get(node.getAttribute(name))
return res
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -394,7 +394,7 @@ def email_send_attach(email_from, email_to, subject, body, email_cc=None, email_
if tinycrm:
msg['Message-Id'] = '<'+str(time.time())+'-tinycrm-'+str(tinycrm)+'@'+socket.gethostname()+'>'
msg['Date'] = formatdate(localtime=True)
msg.attach( MIMEText(body or '', _charset='utf-8') )
msg.attach( MIMEText(body or '', _charset='utf-8', _subtype="html"))
for (fname,fcontent) in attach:
part = MIMEBase('application', "octet-stream")
part.set_payload( fcontent )