[IMP] Apply improvement in search view ,group by expand=1 and extended options expand=0

bzr revid: ksa@tinyerp.co.in-20100524062613-bfzk6smcewhcr25c
This commit is contained in:
ksa (Open ERP) 2010-05-24 11:56:13 +05:30
parent be5cd712c5
commit d359e085a6
42 changed files with 1019 additions and 871 deletions

View File

@ -74,13 +74,13 @@
<page string="Accounting" position="inside"> <page string="Accounting" position="inside">
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator string="Customer Accounting Properties" colspan="2"/> <separator string="Customer Accounting Properties" colspan="2"/>
<field name="property_account_receivable"/> <field name="property_account_receivable" groups="base.group_extended"/>
<field name="property_account_position" widget="selection"/> <field name="property_account_position" widget="selection"/>
<field name="property_payment_term" widget="selection"/> <field name="property_payment_term" widget="selection"/>
</group> </group>
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator string="Supplier Accounting Properties" colspan="2"/> <separator string="Supplier Accounting Properties" colspan="2"/>
<field name="property_account_payable"/> <field name="property_account_payable" groups="base.group_extended"/>
</group> </group>
<group col="2" colspan="2"> <group col="2" colspan="2">
<separator string="Customer Credit" colspan="2"/> <separator string="Customer Credit" colspan="2"/>

View File

@ -47,8 +47,21 @@
<field name="user_id" widget="selection"/> <field name="user_id" widget="selection"/>
<field name="partner_id"/> <field name="partner_id"/>
</group> </group>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="User" name='User' icon="terp-account" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<filter string="Analytic Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<filter string="Analytic Account" icon="terp-account" context="{'group_by':'parent_id'}"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Month" icon="terp-account" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-account" context="{'group_by':'year'}"/>
</group>
<newline/> <newline/>
<group expand="1" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-account" <filter icon="terp-account"
string="Draft" string="Draft"
domain="[('state','=','draft')]"/> domain="[('state','=','draft')]"/>
@ -72,20 +85,8 @@
<field name="date_start"/> <field name="date_start"/>
<field name="date_end"/> <field name="date_end"/>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12"> </search>
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="User" name='User' icon="terp-account" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<filter string="Analytic Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<filter string="Analytic Account" icon="terp-account" context="{'group_by':'parent_id'}"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Month" icon="terp-account" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-account" context="{'group_by':'year'}"/>
</group>
</search>
</field> </field>
</record> </record>

View File

@ -87,6 +87,26 @@
<field name="partner_id"/> <field name="partner_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/> <field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group> </group>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Salesman" name='User' icon="terp-account" context="{'group_by':'user_id'}"/>
<filter string="Payment Term" icon="terp-account" context="{'group_by':'payment_term'}"/>
<separator orientation="vertical"/>
<filter string="Currency" icon="terp-account" context="{'group_by':'currency_id'}"/>
<filter string="Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="Type" icon="terp-account" context="{'group_by':'type'}"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Force Period" icon="terp-account" context="{'group_by':'period_id'}"/>
<filter string="Fiscal Position" icon="terp-account" context="{'group_by':'fiscal_position'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-account" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-account" context="{'group_by':'date'}"/>
<filter string="Year" icon="terp-account" context="{'group_by':'year'}"/>
</group>
<newline/> <newline/>
<group expand="0" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter string="Done" <filter string="Done"
@ -107,27 +127,7 @@
<field name="fiscal_position" widget="selection"/> <field name="fiscal_position" widget="selection"/>
<field name="date"/> <field name="date"/>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Salesman" name='User' icon="terp-account" context="{'group_by':'user_id'}"/>
<filter string="Payment Term" icon="terp-account" context="{'group_by':'payment_term'}"/>
<separator orientation="vertical"/>
<filter string="Currency" icon="terp-account" context="{'group_by':'currency_id'}"/>
<filter string="Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="Type" icon="terp-account" context="{'group_by':'type'}"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Force Period" icon="terp-account" context="{'group_by':'period_id'}"/>
<filter string="Fiscal Position" icon="terp-account" context="{'group_by':'fiscal_position'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-account" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-account" context="{'group_by':'date'}"/>
<filter string="Year" icon="terp-account" context="{'group_by':'year'}"/>
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -24,7 +24,7 @@ from tools.translate import _
class account_chart(osv.osv_memory): class account_chart(osv.osv_memory):
""" """
For Chart of Accounrs For Chart of Accounrs
""" """
_name = "account.chart" _name = "account.chart"
_description = "chart" _description = "chart"
_columns = { _columns = {

View File

@ -33,25 +33,25 @@ class audittrail_rule(osv.osv):
_name = 'audittrail.rule' _name = 'audittrail.rule'
_description = "Audittrail Rule" _description = "Audittrail Rule"
_columns = { _columns = {
"name": fields.char("Rule Name", size=32, required=True), "name": fields.char("Rule Name", size=32, required=True),
"object_id": fields.many2one('ir.model', 'Object', required=True), "object_id": fields.many2one('ir.model', 'Object', required=True),
"user_id": fields.many2many('res.users', 'audittail_rules_users', "user_id": fields.many2many('res.users', 'audittail_rules_users',
'user_id', 'rule_id', 'Users'), 'user_id', 'rule_id', 'Users'),
"log_read": fields.boolean("Log reads"), "log_read": fields.boolean("Log reads"),
"log_write": fields.boolean("Log writes"), "log_write": fields.boolean("Log writes"),
"log_unlink": fields.boolean("Log deletes"), "log_unlink": fields.boolean("Log deletes"),
"log_create": fields.boolean("Log creates"), "log_create": fields.boolean("Log creates"),
"state": fields.selection((("draft", "Draft"), "state": fields.selection((("draft", "Draft"),
("subscribed", "Subscribed")), ("subscribed", "Subscribed")),
"State", required=True), "State", required=True),
"action_id": fields.many2one('ir.actions.act_window', "Action ID"), "action_id": fields.many2one('ir.actions.act_window', "Action ID"),
} }
_defaults = { _defaults = {
'state': lambda *a: 'draft', 'state': lambda *a: 'draft',
'log_create': lambda *a: 1, 'log_create': lambda *a: 1,
'log_unlink': lambda *a: 1, 'log_unlink': lambda *a: 1,
'log_write': lambda *a: 1, 'log_write': lambda *a: 1,
} }
_sql_constraints = [ _sql_constraints = [
@ -65,7 +65,7 @@ class audittrail_rule(osv.osv):
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param ids: List of Auddittrail Rules IDs. @param ids: List of Auddittrail Rules IDs.
@return: True @return: True
""" """
obj_action = self.pool.get('ir.actions.act_window') obj_action = self.pool.get('ir.actions.act_window')
obj_model = self.pool.get('ir.model.data') obj_model = self.pool.get('ir.model.data')
@ -74,13 +74,13 @@ class audittrail_rule(osv.osv):
obj = self.pool.get(thisrule.object_id.model) obj = self.pool.get(thisrule.object_id.model)
if not obj: if not obj:
raise osv.except_osv( raise osv.except_osv(
_('WARNING: audittrail is not part of the pool'), _('WARNING: audittrail is not part of the pool'),
_('Change audittrail depends -- Setting rule as DRAFT')) _('Change audittrail depends -- Setting rule as DRAFT'))
self.write(cr, uid, [thisrule.id], {"state": "draft"}) self.write(cr, uid, [thisrule.id], {"state": "draft"})
val = { val = {
"name": 'View Log', "name": 'View Log',
"res_model": 'audittrail.log', "res_model": 'audittrail.log',
"src_model": thisrule.object_id.model, "src_model": thisrule.object_id.model,
"domain": "[('object_id','=', " + str(thisrule.object_id.id) + "), ('res_id', '=', active_id)]" "domain": "[('object_id','=', " + str(thisrule.object_id.id) + "), ('res_id', '=', active_id)]"
} }
@ -98,7 +98,7 @@ class audittrail_rule(osv.osv):
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param ids: List of Auddittrail Rules IDs. @param ids: List of Auddittrail Rules IDs.
@return: True @return: True
""" """
obj_action = self.pool.get('ir.actions.act_window') obj_action = self.pool.get('ir.actions.act_window')
val_obj = self.pool.get('ir.values') val_obj = self.pool.get('ir.values')
@ -128,16 +128,16 @@ class audittrail_log(osv.osv):
_description = "Audittrail Log" _description = "Audittrail Log"
_columns = { _columns = {
"name": fields.char("Name", size=32), "name": fields.char("Name", size=32),
"object_id": fields.many2one('ir.model', 'Object'), "object_id": fields.many2one('ir.model', 'Object'),
"user_id": fields.many2one('res.users', 'User'), "user_id": fields.many2one('res.users', 'User'),
"method": fields.selection((('read', 'Read'), "method": fields.selection((('read', 'Read'),
('write', 'Write'), ('write', 'Write'),
('unlink', 'Delete'), ('unlink', 'Delete'),
('create', 'Create')), "Method"), ('create', 'Create')), "Method"),
"timestamp": fields.datetime("Date"), "timestamp": fields.datetime("Date"),
"res_id": fields.integer('Resource Id'), "res_id": fields.integer('Resource Id'),
"line_ids": fields.one2many('audittrail.log.line', 'log_id', 'Log lines'), "line_ids": fields.one2many('audittrail.log.line', 'log_id', 'Log lines'),
} }
_defaults = { _defaults = {
@ -155,14 +155,14 @@ class audittrail_log_line(osv.osv):
_name = 'audittrail.log.line' _name = 'audittrail.log.line'
_description = "Log Line" _description = "Log Line"
_columns = { _columns = {
'field_id': fields.many2one('ir.model.fields', 'Fields', required=True), 'field_id': fields.many2one('ir.model.fields', 'Fields', required=True),
'log_id': fields.many2one('audittrail.log', 'Log'), 'log_id': fields.many2one('audittrail.log', 'Log'),
'log': fields.integer("Log ID"), 'log': fields.integer("Log ID"),
'old_value': fields.text("Old Value"), 'old_value': fields.text("Old Value"),
'new_value': fields.text("New Value"), 'new_value': fields.text("New Value"),
'old_value_text': fields.text('Old value Text'), 'old_value_text': fields.text('Old value Text'),
'new_value_text': fields.text('New value Text'), 'new_value_text': fields.text('New value Text'),
'field_description': fields.char('Field Description', size=64), 'field_description': fields.char('Field Description', size=64),
} }
audittrail_log_line() audittrail_log_line()
@ -170,7 +170,7 @@ audittrail_log_line()
class audittrail_objects_proxy(osv_pool): class audittrail_objects_proxy(osv_pool):
""" Uses Object proxy for auditing changes on object of subscribed Rules""" """ Uses Object proxy for auditing changes on object of subscribed Rules"""
def get_value_text(self, cr, uid, field_name, values, object, context=None): def get_value_text(self, cr, uid, field_name, values, object, context=None):
""" """
Gets textual values for the fields Gets textual values for the fields
@ -178,9 +178,9 @@ class audittrail_objects_proxy(osv_pool):
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param field_name: List of fields for text values @param field_name: List of fields for text values
@param values: Values for field to be converted into textual values @param values: Values for field to be converted into textual values
@return: values: List of textual values for given fields @return: values: List of textual values for given fields
""" """
if not context: if not context:
context = {} context = {}
@ -226,7 +226,7 @@ class audittrail_objects_proxy(osv_pool):
@param object: Object who's values are being changed @param object: Object who's values are being changed
@param lines: List of values for line is to be created @param lines: List of values for line is to be created
""" """
pool = pooler.get_pool(cr.dbname) pool = pooler.get_pool(cr.dbname)
obj = pool.get(object.model) obj = pool.get(object.model)
#start Loop #start Loop
@ -242,7 +242,7 @@ class audittrail_objects_proxy(osv_pool):
new_value = 'new_value' in line and line['new_value'] or '' new_value = 'new_value' in line and line['new_value'] or ''
old_value_text = 'old_value_text' in line and line['old_value_text'] or '' old_value_text = 'old_value_text' in line and line['old_value_text'] or ''
new_value_text = 'new_value_text' in line and line['new_value_text'] or '' new_value_text = 'new_value_text' in line and line['new_value_text'] or ''
if old_value_text == new_value_text: if old_value_text == new_value_text:
continue continue
if fields[0]['ttype'] == 'many2one': if fields[0]['ttype'] == 'many2one':
@ -251,12 +251,12 @@ class audittrail_objects_proxy(osv_pool):
if type(new_value) == tuple: if type(new_value) == tuple:
new_value = new_value[0] new_value = new_value[0]
vals = { vals = {
"log_id": id, "log_id": id,
"field_id": f_id[0], "field_id": f_id[0],
"old_value": old_value, "old_value": old_value,
"new_value": new_value, "new_value": new_value,
"old_value_text": old_value_text, "old_value_text": old_value_text,
"new_value_text": new_value_text, "new_value_text": new_value_text,
"field_description": fields[0]['field_description'] "field_description": fields[0]['field_description']
} }
line_id = pool.get('audittrail.log.line').create(cr, uid, vals) line_id = pool.get('audittrail.log.line').create(cr, uid, vals)
@ -270,10 +270,10 @@ class audittrail_objects_proxy(osv_pool):
@param db: the current database @param db: the current database
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param object: Object who's values are being changed @param object: Object who's values are being changed
@param method: method to log: create, read, write, unlink @param method: method to log: create, read, write, unlink
@param fct_src: execute method of Object proxy @param fct_src: execute method of Object proxy
@return: Returns result as per method of Object proxy @return: Returns result as per method of Object proxy
""" """
logged_uids = [] logged_uids = []
pool = pooler.get_pool(db) pool = pooler.get_pool(db)
@ -290,9 +290,9 @@ class audittrail_objects_proxy(osv_pool):
resource_name = pool.get(model_object.model).name_get(cr, uid, [res_id]) resource_name = pool.get(model_object.model).name_get(cr, uid, [res_id])
resource_name = resource_name and resource_name[0][1] or '' resource_name = resource_name and resource_name[0][1] or ''
vals = { vals = {
"method": method, "method": method,
"object_id": model_object.id, "object_id": model_object.id,
"user_id": uid, "res_id": res_id, "user_id": uid, "res_id": res_id,
"name": resource_name "name": resource_name
} }
id = pool.get('audittrail.log').create(cr, uid, vals) id = pool.get('audittrail.log').create(cr, uid, vals)
@ -300,8 +300,8 @@ class audittrail_objects_proxy(osv_pool):
for field in new_value: for field in new_value:
if new_value[field]: if new_value[field]:
line = { line = {
'name': field, 'name': field,
'new_value': new_value[field], 'new_value': new_value[field],
'new_value_text': self.get_value_text(cr, uid, field, new_value[field], model_object) 'new_value_text': self.get_value_text(cr, uid, field, new_value[field], model_object)
} }
lines.append(line) lines.append(line)
@ -329,10 +329,10 @@ class audittrail_objects_proxy(osv_pool):
for field in args[1].keys(): for field in args[1].keys():
if args[1].keys(): if args[1].keys():
line = { line = {
'name': field, 'name': field,
'new_value': field in new_values and new_values[field] or '', 'new_value': field in new_values and new_values[field] or '',
'old_value': field in old_values and old_values[field] or '', 'old_value': field in old_values and old_values[field] or '',
'new_value_text': self.get_value_text(cr, uid, field, new_values[field], model_object), 'new_value_text': self.get_value_text(cr, uid, field, new_values[field], model_object),
'old_value_text': old_values_text[field] 'old_value_text': old_values_text[field]
} }
lines.append(line) lines.append(line)
@ -360,8 +360,8 @@ class audittrail_objects_proxy(osv_pool):
for field in old_values[res_id]: for field in old_values[res_id]:
if old_values[res_id][field]: if old_values[res_id][field]:
line = { line = {
'name': field, 'name': field,
'old_value': old_values[res_id][field], 'old_value': old_values[res_id][field],
'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], model_object) 'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], model_object)
} }
lines.append(line) lines.append(line)
@ -385,8 +385,8 @@ class audittrail_objects_proxy(osv_pool):
for field in old_values[res_id]: for field in old_values[res_id]:
if old_values[res_id][field]: if old_values[res_id][field]:
line = { line = {
'name': field, 'name': field,
'old_value': old_values[res_id][field], 'old_value': old_values[res_id][field],
'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], model_object) 'old_value_text': self.get_value_text(cr, uid, field, old_values[res_id][field], model_object)
} }
lines.append(line) lines.append(line)
@ -403,9 +403,9 @@ class audittrail_objects_proxy(osv_pool):
@param db: the current database @param db: the current database
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param object: Object who's values are being changed @param object: Object who's values are being changed
@param method: method to log: create, read, write, unlink @param method: method to log: create, read, write, unlink
@return: Returns result as per method of Object proxy @return: Returns result as per method of Object proxy
""" """
pool = pooler.get_pool(db) pool = pooler.get_pool(db)
cr = pooler.get_db(db).cursor() cr = pooler.get_db(db).cursor()
@ -433,7 +433,7 @@ class audittrail_objects_proxy(osv_pool):
logged_uids.append(user.id) logged_uids.append(user.id)
if not logged_uids or uid in logged_uids: if not logged_uids or uid in logged_uids:
if field in ('read', 'write', 'create', 'unlink'): if field in ('read', 'write', 'create', 'unlink'):
if getattr(thisrule, 'log_' + field): if getattr(thisrule, 'log_',''):
return self.log_fct(db, uid, object, method, fct_src, *args) return self.log_fct(db, uid, object, method, fct_src, *args)
return fct_src(db, uid, object, method, *args) return fct_src(db, uid, object, method, *args)
res = my_fct(db, uid, object, method, *args) res = my_fct(db, uid, object, method, *args)

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# #
@ -15,34 +15,35 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
{ {
"name" : "Basic Calendar Functionality", "name" : "Basic Calendar Functionality",
"version" : "1.0", "version" : "1.0",
"depends" : ["base"], "depends" : ["base"],
'description': """Full featured calendar system that support: 'description': """Full featured calendar system that support:
- Alerts (create requests) - Alerts (create requests)
- Recurring events (*) - Recurring events (*)
- Invitations to others people""", - Invitations to others people""",
"author" : "Tiny", "author" : "Tiny",
'category': 'Generic Modules/Others', 'category': 'Generic Modules/Others',
'website': 'http://www.openerp.com', 'website': 'http://www.openerp.com',
"init_xml" : [ "init_xml" : [
'base_calendar_data.xml' 'base_calendar_data.xml'
], ],
"demo_xml" : [], "demo_xml" : [],
"update_xml" : [ "update_xml" : [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'wizard/calendar_event_edit_all_view.xml', 'wizard/calendar_event_edit_all_view.xml',
'wizard/base_calendar_invite_attendee_view.xml', 'wizard/base_calendar_invite_attendee_view.xml',
'wizard/base_calendar_set_exrule_view.xml',
'base_calendar_view.xml' 'base_calendar_view.xml'
], ],
"test" : ['test/base_calendar_test.yml'], # "test" : ['test/base_calendar_test.yml'],
"installable" : True, "installable" : True,
"active" : False, "active" : False,
} }
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -44,7 +44,6 @@ def get_recurrent_dates(rrulestring, exdate, startdate=None, exrule=None):
@param startdate: Startdate for computing recurrent dates @param startdate: Startdate for computing recurrent dates
@return: List of Recurrent dates @return: List of Recurrent dates
""" """
def todate(date): def todate(date):
val = parser.parse(''.join((re.compile('\d')).findall(date))) val = parser.parse(''.join((re.compile('\d')).findall(date)))
return val return val
@ -313,60 +312,60 @@ class calendar_attendee(osv.osv):
'cutype': fields.selection([('individual', 'Individual'), \ 'cutype': fields.selection([('individual', 'Individual'), \
('group', 'Group'), ('resource', 'Resource'), \ ('group', 'Group'), ('resource', 'Resource'), \
('room', 'Room'), ('unknown', '') ], \ ('room', 'Room'), ('unknown', '') ], \
'Invite Type', help="Specify the type of Invitation"), 'Invite Type', help="Specify the type of Invitation"),
'member': fields.char('Member', size=124, 'member': fields.char('Member', size=124,
help="Indicate the groups that the attendee belongs to"), help="Indicate the groups that the attendee belongs to"),
'role': fields.selection([('req-participant', 'Participation required'), \ 'role': fields.selection([('req-participant', 'Participation required'), \
('chair', 'Chair Person'), \ ('chair', 'Chair Person'), \
('opt-participant', 'Optional Participation'), \ ('opt-participant', 'Optional Participation'), \
('non-participant', 'For information Purpose')], 'Role', \ ('non-participant', 'For information Purpose')], 'Role', \
help='Participation role for the calendar user'), help='Participation role for the calendar user'),
'state': fields.selection([('tentative', 'Tentative'), 'state': fields.selection([('tentative', 'Tentative'),
('needs-action', 'Needs Action'), ('needs-action', 'Needs Action'),
('accepted', 'Accepted'), ('accepted', 'Accepted'),
('declined', 'Declined'), ('declined', 'Declined'),
('delegated', 'Delegated')], 'State', readonly=True, \ ('delegated', 'Delegated')], 'State', readonly=True, \
help="Status of the attendee's participation"), help="Status of the attendee's participation"),
'rsvp': fields.boolean('Required Reply?', 'rsvp': fields.boolean('Required Reply?',
help="Indicats whether the favor of a reply is requested"), help="Indicats whether the favor of a reply is requested"),
'delegated_to': fields.function(_compute_data, method=True, \ 'delegated_to': fields.function(_compute_data, method=True, \
string='Delegated To', type="char", size=124, store=True, \ string='Delegated To', type="char", size=124, store=True, \
multi='delegated_to', help="The users that the original \ multi='delegated_to', help="The users that the original \
request was delegated to"), request was delegated to"),
'delegated_from': fields.function(_compute_data, method=True, string=\ 'delegated_from': fields.function(_compute_data, method=True, string=\
'Delegated From', type="char", store=True, size=124, multi='delegated_from'), 'Delegated From', type="char", store=True, size=124, multi='delegated_from'),
'parent_ids': fields.many2many('calendar.attendee', 'calendar_attendee_parent_rel', \ 'parent_ids': fields.many2many('calendar.attendee', 'calendar_attendee_parent_rel', \
'attendee_id', 'parent_id', 'Delegrated From'), 'attendee_id', 'parent_id', 'Delegrated From'),
'child_ids': fields.many2many('calendar.attendee', 'calendar_attendee_child_rel', \ 'child_ids': fields.many2many('calendar.attendee', 'calendar_attendee_child_rel', \
'attendee_id', 'child_id', 'Delegrated To'), 'attendee_id', 'child_id', 'Delegrated To'),
'sent_by': fields.function(_compute_data, method=True, string='Sent By', \ 'sent_by': fields.function(_compute_data, method=True, string='Sent By', \
type="char", multi='sent_by', store=True, size=124, \ type="char", multi='sent_by', store=True, size=124, \
help="Specify the user that is acting on behalf of the calendar user"), help="Specify the user that is acting on behalf of the calendar user"),
'sent_by_uid': fields.function(_compute_data, method=True, string='Sent By User', \ 'sent_by_uid': fields.function(_compute_data, method=True, string='Sent By User', \
type="many2one", relation="res.users", multi='sent_by_uid'), type="many2one", relation="res.users", multi='sent_by_uid'),
'cn': fields.function(_compute_data, method=True, string='Common name', \ 'cn': fields.function(_compute_data, method=True, string='Common name', \
type="char", size=124, multi='cn', store=True), type="char", size=124, multi='cn', store=True),
'dir': fields.char('URI Reference', size=124, help="Reference to the URI\ 'dir': fields.char('URI Reference', size=124, help="Reference to the URI\
that points to the directory information corresponding to the attendee."), that points to the directory information corresponding to the attendee."),
'language': fields.function(_compute_data, method=True, string='Language', \ 'language': fields.function(_compute_data, method=True, string='Language', \
type="selection", selection=_lang_get, multi='language', \ type="selection", selection=_lang_get, multi='language', \
store=True, help="To specify the language for text values in a\ store=True, help="To specify the language for text values in a\
property or property parameter."), property or property parameter."),
'user_id': fields.many2one('res.users', 'User'), 'user_id': fields.many2one('res.users', 'User'),
'partner_address_id': fields.many2one('res.partner.address', 'Contact'), 'partner_address_id': fields.many2one('res.partner.address', 'Contact'),
'partner_id': fields.related('partner_address_id', 'partner_id', type='many2one', \ 'partner_id': fields.related('partner_address_id', 'partner_id', type='many2one', \
relation='res.partner', string='Partner', help="Partner related to contact"), relation='res.partner', string='Partner', help="Partner related to contact"),
'email': fields.char('Email', size=124, help="Email of Invited Person"), 'email': fields.char('Email', size=124, help="Email of Invited Person"),
'event_date': fields.function(_compute_data, method=True, string='Event Date', \ 'event_date': fields.function(_compute_data, method=True, string='Event Date', \
type="datetime", multi='event_date'), type="datetime", multi='event_date'),
'event_end_date': fields.function(_compute_data, method=True, \ 'event_end_date': fields.function(_compute_data, method=True, \
string='Event End Date', type="datetime", \ string='Event End Date', type="datetime", \
multi='event_end_date'), multi='event_end_date'),
'ref': fields.reference('Event Ref', selection=_links_get, size=128), 'ref': fields.reference('Event Ref', selection=_links_get, size=128),
'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"), 'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"),
} }
_defaults = { _defaults = {
'state': lambda *x: 'needs-action', 'state': lambda *x: 'needs-action',
} }
def get_ics_file(self, cr, uid, event_obj, context=None): def get_ics_file(self, cr, uid, event_obj, context=None):
@ -401,7 +400,7 @@ property or property parameter."),
event.add('location').value = event_obj.location event.add('location').value = event_obj.location
if event_obj.rrule: if event_obj.rrule:
event.add('rrule').value = event_obj.rrule event.add('rrule').value = event_obj.rrule
if event_obj.alarm_id: if event_obj.alarm_id:
# computes alarm data # computes alarm data
valarm = event.add('valarm') valarm = event.add('valarm')
@ -422,10 +421,10 @@ property or property parameter."),
if interval == 'minutes': if interval == 'minutes':
delta = timedelta(minutes=duration) delta = timedelta(minutes=duration)
trigger.value = delta trigger.value = delta
# Compute other details # Compute other details
valarm.add('DESCRIPTION').value = alarm_data['name'] or 'OpenERP' valarm.add('DESCRIPTION').value = alarm_data['name'] or 'OpenERP'
for attendee in event_obj.attendee_ids: for attendee in event_obj.attendee_ids:
attendee_add = event.add('attendee') attendee_add = event.add('attendee')
attendee_add.params['CUTYPE'] = [str(attendee.cutype)] attendee_add.params['CUTYPE'] = [str(attendee.cutype)]
@ -434,7 +433,7 @@ property or property parameter."),
attendee_add.value = 'MAILTO:' + attendee.email attendee_add.value = 'MAILTO:' + attendee.email
res = cal.serialize() res = cal.serialize()
return res return res
def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context={}): def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context={}):
""" """
Send mail for calendar attendee. Send mail for calendar attendee.
@ -457,14 +456,14 @@ property or property parameter."),
att_infos.append(((att2.user_id and att2.user_id.name) or \ att_infos.append(((att2.user_id and att2.user_id.name) or \
(att2.partner_id and att2.partner_id.name) or \ (att2.partner_id and att2.partner_id.name) or \
att2.email) + ' - Status: ' + att2.state.title()) att2.email) + ' - Status: ' + att2.state.title())
body_vals = {'name': res_obj.name, body_vals = {'name': res_obj.name,
'start_date': res_obj.date, 'start_date': res_obj.date,
'end_date': res_obj.date_deadline or False, 'end_date': res_obj.date_deadline or False,
'description': res_obj.description or '-', 'description': res_obj.description or '-',
'location': res_obj.location or '-', 'location': res_obj.location or '-',
'attendees': '<br>'.join(att_infos), 'attendees': '<br>'.join(att_infos),
'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User', 'user': res_obj.user_id and res_obj.user_id.name or 'OpenERP User',
'sign': sign, 'sign': sign,
'company': company 'company': company
} }
body = html_invitation % body_vals body = html_invitation % body_vals
@ -564,30 +563,30 @@ class res_alarm(osv.osv):
_name = 'res.alarm' _name = 'res.alarm'
_description = 'Basic Alarm Information' _description = 'Basic Alarm Information'
_columns = { _columns = {
'name':fields.char('Name', size=256, required=True), 'name':fields.char('Name', size=256, required=True),
'trigger_occurs': fields.selection([('before', 'Before'), \ 'trigger_occurs': fields.selection([('before', 'Before'), \
('after', 'After')], \ ('after', 'After')], \
'Triggers', required=True), 'Triggers', required=True),
'trigger_interval': fields.selection([('minutes', 'Minutes'), \ 'trigger_interval': fields.selection([('minutes', 'Minutes'), \
('hours', 'Hours'), \ ('hours', 'Hours'), \
('days', 'Days')], 'Interval', \ ('days', 'Days')], 'Interval', \
required=True), required=True),
'trigger_duration': fields.integer('Duration', required=True), 'trigger_duration': fields.integer('Duration', required=True),
'trigger_related': fields.selection([('start', 'The event starts'), \ 'trigger_related': fields.selection([('start', 'The event starts'), \
('end', 'The event ends')], \ ('end', 'The event ends')], \
'Related to', required=True), 'Related to', required=True),
'duration': fields.integer('Duration', help="""Duration' and 'Repeat' \ 'duration': fields.integer('Duration', help="""Duration' and 'Repeat' \
are both optional, but if one occurs, so MUST the other"""), are both optional, but if one occurs, so MUST the other"""),
'repeat': fields.integer('Repeat'), 'repeat': fields.integer('Repeat'),
'active': fields.boolean('Active', help="If the active field is set to \ 'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the event alarm information without removing it.") true, it will allow you to hide the event alarm information without removing it.")
} }
_defaults = { _defaults = {
'trigger_interval': lambda *x: 'minutes', 'trigger_interval': lambda *x: 'minutes',
'trigger_duration': lambda *x: 5, 'trigger_duration': lambda *x: 5,
'trigger_occurs': lambda *x: 'before', 'trigger_occurs': lambda *x: 'before',
'trigger_related': lambda *x: 'start', 'trigger_related': lambda *x: 'start',
'active': lambda *x: 1, 'active': lambda *x: 1,
} }
def do_alarm_create(self, cr, uid, ids, model, date, context={}): def do_alarm_create(self, cr, uid, ids, model, date, context={}):
@ -615,20 +614,20 @@ true, it will allow you to hide the event alarm information without removing it.
self.do_alarm_unlink(cr, uid, [data.id], model) self.do_alarm_unlink(cr, uid, [data.id], model)
if basic_alarm: if basic_alarm:
vals = { vals = {
'action': 'display', 'action': 'display',
'description': data.description, 'description': data.description,
'name': data.name, 'name': data.name,
'attendee_ids': [(6, 0, map(lambda x:x.id, data.attendee_ids))], 'attendee_ids': [(6, 0, map(lambda x:x.id, data.attendee_ids))],
'trigger_related': basic_alarm.trigger_related, 'trigger_related': basic_alarm.trigger_related,
'trigger_duration': basic_alarm.trigger_duration, 'trigger_duration': basic_alarm.trigger_duration,
'trigger_occurs': basic_alarm.trigger_occurs, 'trigger_occurs': basic_alarm.trigger_occurs,
'trigger_interval': basic_alarm.trigger_interval, 'trigger_interval': basic_alarm.trigger_interval,
'duration': basic_alarm.duration, 'duration': basic_alarm.duration,
'repeat': basic_alarm.repeat, 'repeat': basic_alarm.repeat,
'state': 'run', 'state': 'run',
'event_date': data[date], 'event_date': data[date],
'res_id': data.id, 'res_id': data.id,
'model_id': model_id, 'model_id': model_id,
'user_id': uid 'user_id': uid
} }
alarm_id = alarm_obj.create(cr, uid, vals) alarm_id = alarm_obj.create(cr, uid, vals)
@ -702,8 +701,8 @@ class calendar_alarm(osv.osv):
} }
_defaults = { _defaults = {
'action': lambda *x: 'email', 'action': lambda *x: 'email',
'state': lambda *x: 'run', 'state': lambda *x: 'run',
} }
def create(self, cr, uid, vals, context={}): def create(self, cr, uid, vals, context={}):
""" """
@ -754,11 +753,11 @@ class calendar_alarm(osv.osv):
for alarm in self.browse(cr, uid, alarm_ids): for alarm in self.browse(cr, uid, alarm_ids):
if alarm.action == 'display': if alarm.action == 'display':
value = { value = {
'name': alarm.name, 'name': alarm.name,
'act_from': alarm.user_id.id, 'act_from': alarm.user_id.id,
'act_to': alarm.user_id.id, 'act_to': alarm.user_id.id,
'body': alarm.description, 'body': alarm.description,
'trigger_date': alarm.trigger_date, 'trigger_date': alarm.trigger_date,
'ref_doc1': '%s,%s' % (alarm.model_id.model, alarm.res_id) 'ref_doc1': '%s,%s' % (alarm.model_id.model, alarm.res_id)
} }
request_id = request_obj.create(cr, uid, value) request_id = request_obj.create(cr, uid, value)
@ -788,9 +787,9 @@ class calendar_alarm(osv.osv):
mail_to.append(att.user_id.address_id.email) mail_to.append(att.user_id.address_id.email)
if mail_to: if mail_to:
tools.email_send( tools.email_send(
tools.config.get('email_from', False), tools.config.get('email_from', False),
mail_to, mail_to,
sub, sub,
body body
) )
self.write(cr, uid, [alarm.id], {'state':'done'}) self.write(cr, uid, [alarm.id], {'state':'done'})
@ -820,12 +819,12 @@ class calendar_event(osv.osv):
return {} return {}
event = self.browse(cr, uid, ids, context=context)[0] event = self.browse(cr, uid, ids, context=context)[0]
value = { value = {
'date': event.date and event.date[:11] + '00:00:00', 'date': event.date and event.date[:11] + '00:00:00',
'date_deadline': event.date_deadline and event.date_deadline[:11] + '00:00:00', 'date_deadline': event.date_deadline and event.date_deadline[:11] + '00:00:00',
'duration': 24 'duration': 24
} }
return {'value': value} return {'value': value}
def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context={}): def onchange_dates(self, cr, uid, ids, start_date, duration=False, end_date=False, allday=False, context={}):
""" """
@param self: The object pointer @param self: The object pointer
@ -847,8 +846,8 @@ class calendar_event(osv.osv):
if allday: # For all day event if allday: # For all day event
start = start_date[:11] + '00:00:00' start = start_date[:11] + '00:00:00'
value = { value = {
'date': start, 'date': start,
'date_deadline': start, 'date_deadline': start,
'duration': 24 'duration': 24
} }
return {'value': value} return {'value': value}
@ -877,7 +876,7 @@ class calendar_event(osv.osv):
cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\ cr.execute("UPDATE %s set freq='None',interval=0,count=0,end_date=Null,\
mo=False,tu=False,we=False,th=False,fr=False,sa=False,su=False,\ mo=False,tu=False,we=False,th=False,fr=False,sa=False,su=False,\
day=0,select1='date',month_list=Null ,byday=Null where id=%s" % (self._table, id)) day=0,select1='date',month_list=Null ,byday=Null where id=%s" % (self._table, id))
if not value: if not value:
cr.execute("UPDATE %s set rrule_type='none' where id=%s" % (self._table, id)) cr.execute("UPDATE %s set rrule_type='none' where id=%s" % (self._table, id))
return True return True
@ -906,19 +905,19 @@ class calendar_event(osv.osv):
for day in val['byday'].split(','): for day in val['byday'].split(','):
new_val[day] = True new_val[day] = True
val.pop('byday') val.pop('byday')
if val.get('until'): if val.get('until'):
until = parser.parse(''.join((re.compile('\d')).findall(val.get('until')))) until = parser.parse(''.join((re.compile('\d')).findall(val.get('until'))))
new_val['end_date'] = until.strftime('%Y-%m-%d') new_val['end_date'] = until.strftime('%Y-%m-%d')
val.pop('until') val.pop('until')
new_val.pop('until') new_val.pop('until')
if val.get('bymonthday'): if val.get('bymonthday'):
new_val['day'] = val.get('bymonthday') new_val['day'] = val.get('bymonthday')
val.pop('bymonthday') val.pop('bymonthday')
new_val['select1'] = 'date' new_val['select1'] = 'date'
new_val.pop('bymonthday') new_val.pop('bymonthday')
if val.get('byday'): if val.get('byday'):
d = val.get('byday') d = val.get('byday')
if '-' in d: if '-' in d:
@ -928,12 +927,12 @@ class calendar_event(osv.osv):
new_val['byday'] = d[:1] new_val['byday'] = d[:1]
new_val['week_list'] = d[1:3].upper() new_val['week_list'] = d[1:3].upper()
new_val['select1'] = 'day' new_val['select1'] = 'day'
if val.get('bymonth'): if val.get('bymonth'):
new_val['month_list'] = val.get('bymonth') new_val['month_list'] = val.get('bymonth')
val.pop('bymonth') val.pop('bymonth')
new_val.pop('bymonth') new_val.pop('bymonth')
for k, v in new_val.items(): for k, v in new_val.items():
temp = ", %s='%s'" % (k, v) temp = ", %s='%s'" % (k, v)
qry += temp qry += temp
@ -941,9 +940,9 @@ class calendar_event(osv.osv):
whr = " where id=%(id)s" whr = " where id=%(id)s"
qry = qry + whr qry = qry + whr
val.update({ val.update({
'table': self._table, 'table': self._table,
'rule_type': rrule_type, 'rule_type': rrule_type,
'id': id, 'id': id,
}) })
cr.execute(qry % val) cr.execute(qry % val)
return True return True
@ -968,7 +967,7 @@ class calendar_event(osv.osv):
raise osv.except_osv('Warning!', 'Interval can not be Negative') raise osv.except_osv('Warning!', 'Interval can not be Negative')
if datas.get('count', 0) < 0: if datas.get('count', 0) < 0:
raise osv.except_osv('Warning!', 'Count can not be Negative') raise osv.except_osv('Warning!', 'Count can not be Negative')
rrule_custom = self.compute_rule_string(cr, uid, datas,\ rrule_custom = self.compute_rule_string(cr, uid, datas, \
context=context) context=context)
result[event] = rrule_custom result[event] = rrule_custom
else: else:
@ -977,40 +976,40 @@ class calendar_event(osv.osv):
return result return result
_columns = { _columns = {
'id': fields.integer('ID'), 'id': fields.integer('ID'),
'sequence': fields.integer('Sequence'), 'sequence': fields.integer('Sequence'),
'name': fields.char('Description', size=64, required=True), 'name': fields.char('Description', size=64, required=True),
'date': fields.datetime('Date'), 'date': fields.datetime('Date'),
'date_deadline': fields.datetime('Deadline'), 'date_deadline': fields.datetime('Deadline'),
'create_date': fields.datetime('Created', readonly=True), 'create_date': fields.datetime('Created', readonly=True),
'duration': fields.float('Duration'), 'duration': fields.float('Duration'),
'description': fields.text('Your action'), 'description': fields.text('Your action'),
'class': fields.selection([('public', 'Public'), ('private', 'Private'), \ 'class': fields.selection([('public', 'Public'), ('private', 'Private'), \
('confidential', 'Confidential')], 'Mark as'), ('confidential', 'Confidential')], 'Mark as'),
'location': fields.char('Location', size=264, help="Location of Event"), 'location': fields.char('Location', size=264, help="Location of Event"),
'show_as': fields.selection([('free', 'Free'), ('busy', 'Busy')], \ 'show_as': fields.selection([('free', 'Free'), ('busy', 'Busy')], \
'Show as'), 'Show as'),
'base_calendar_url': fields.char('Caldav URL', size=264), 'base_calendar_url': fields.char('Caldav URL', size=264),
'exdate': fields.text('Exception Date/Times', help="This property \ 'exdate': fields.text('Exception Date/Times', help="This property \
defines the list of date/time exceptions for arecurring calendar component."), defines the list of date/time exceptions for arecurring calendar component."),
'exrule': fields.char('Exception Rule', size=352, help="defines a \ 'exrule': fields.char('Exception Rule', size=352, help="defines a \
rule or repeating pattern for an exception to a recurrence set"), rule or repeating pattern for an exception to a recurrence set"),
'rrule': fields.function(_get_rulestring, type='char', size=124, method=True, \ 'rrule': fields.function(_get_rulestring, type='char', size=124, method=True, \
string='Recurrent Rule', store=True, \ string='Recurrent Rule', store=True, \
fnct_inv=_set_rrulestring, help='Defines a\ fnct_inv=_set_rrulestring, help='Defines a\
rule or repeating pattern for recurring events\n\ rule or repeating pattern for recurring events\n\
e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'), FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'),
'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \ 'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \
('weekly', 'Weekly'), ('monthly', 'Monthly'), \ ('weekly', 'Weekly'), ('monthly', 'Monthly'), \
('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'), ('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'),
'alarm_id': fields.many2one('res.alarm', 'Alarm'), 'alarm_id': fields.many2one('res.alarm', 'Alarm'),
'base_calendar_alarm_id': fields.many2one('calendar.alarm', 'Alarm'), 'base_calendar_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
'recurrent_uid': fields.integer('Recurrent ID'), 'recurrent_uid': fields.integer('Recurrent ID'),
'recurrent_id': fields.datetime('Recurrent ID date'), 'recurrent_id': fields.datetime('Recurrent ID date'),
'vtimezone': fields.related('user_id', 'context_tz', type='char', size=24, \ 'vtimezone': fields.related('user_id', 'context_tz', type='char', size=24, \
string='Timezone', store=True), string='Timezone', store=True),
'user_id': fields.many2one('res.users', 'Responsible'), 'user_id': fields.many2one('res.users', 'Responsible'),
'freq': fields.selection([('None', 'No Repeat'), \ 'freq': fields.selection([('None', 'No Repeat'), \
('secondly', 'Secondly'), \ ('secondly', 'Secondly'), \
('minutely', 'Minutely'), \ ('minutely', 'Minutely'), \
@ -1018,44 +1017,44 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
('daily', 'Daily'), \ ('daily', 'Daily'), \
('weekly', 'Weekly'), \ ('weekly', 'Weekly'), \
('monthly', 'Monthly'), \ ('monthly', 'Monthly'), \
('yearly', 'Yearly')], 'Frequency'), ('yearly', 'Yearly')], 'Frequency'),
'interval': fields.integer('Interval'), 'interval': fields.integer('Interval'),
'count': fields.integer('Count'), 'count': fields.integer('Count'),
'mo': fields.boolean('Mon'), 'mo': fields.boolean('Mon'),
'tu': fields.boolean('Tue'), 'tu': fields.boolean('Tue'),
'we': fields.boolean('Wed'), 'we': fields.boolean('Wed'),
'th': fields.boolean('Thu'), 'th': fields.boolean('Thu'),
'fr': fields.boolean('Fri'), 'fr': fields.boolean('Fri'),
'sa': fields.boolean('Sat'), 'sa': fields.boolean('Sat'),
'su': fields.boolean('Sun'), 'su': fields.boolean('Sun'),
'select1': fields.selection([('date', 'Date of month'), \ 'select1': fields.selection([('date', 'Date of month'), \
('day', 'Day of month')], 'Option'), ('day', 'Day of month')], 'Option'),
'day': fields.integer('Date of month'), 'day': fields.integer('Date of month'),
'week_list': fields.selection([('MO', 'Monday'), ('TU', 'Tuesday'), \ 'week_list': fields.selection([('MO', 'Monday'), ('TU', 'Tuesday'), \
('WE', 'Wednesday'), ('TH', 'Thursday'), \ ('WE', 'Wednesday'), ('TH', 'Thursday'), \
('FR', 'Friday'), ('SA', 'Saturday'), \ ('FR', 'Friday'), ('SA', 'Saturday'), \
('SU', 'Sunday')], 'Weekday'), ('SU', 'Sunday')], 'Weekday'),
'byday': fields.selection([('1', 'First'), ('2', 'Second'), \ 'byday': fields.selection([('1', 'First'), ('2', 'Second'), \
('3', 'Third'), ('4', 'Fourth'), \ ('3', 'Third'), ('4', 'Fourth'), \
('5', 'Fifth'), ('-1', 'Last')], 'By day'), ('5', 'Fifth'), ('-1', 'Last')], 'By day'),
'month_list': fields.selection(months.items(), 'Month'), 'month_list': fields.selection(months.items(), 'Month'),
'end_date': fields.date('Repeat Until'), 'end_date': fields.date('Repeat Until'),
'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel',\ 'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel', \
'event_id', 'attendee_id', 'Attendees'), 'event_id', 'attendee_id', 'Attendees'),
'allday': fields.boolean('All Day'), 'allday': fields.boolean('All Day'),
'active': fields.boolean('Active', help="If the active field is set to \ 'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the event alarm information without removing it.") true, it will allow you to hide the event alarm information without removing it.")
} }
_defaults = { _defaults = {
'class': lambda *a: 'public', 'class': lambda *a: 'public',
'show_as': lambda *a: 'busy', 'show_as': lambda *a: 'busy',
'freq': lambda *x: 'None', 'freq': lambda *x: 'None',
'select1': lambda *x: 'date', 'select1': lambda *x: 'date',
'interval': lambda *x: 1, 'interval': lambda *x: 1,
'active': lambda *x: 1, 'active': lambda *x: 1,
} }
def open_event(self, cr, uid, ids, context=None): def open_event(self, cr, uid, ids, context=None):
""" """
Open Event From for Editing Open Event From for Editing
@ -1067,11 +1066,11 @@ true, it will allow you to hide the event alarm information without removing it.
""" """
if not context: if not context:
context = {} context = {}
data_obj = self.pool.get('ir.model.data') data_obj = self.pool.get('ir.model.data')
value = {} value = {}
id2 = data_obj._get_id(cr, uid, 'base_calendar', 'event_form_view') id2 = data_obj._get_id(cr, uid, 'base_calendar', 'event_form_view')
id3 = data_obj._get_id(cr, uid, 'base_calendar', 'event_tree_view') id3 = data_obj._get_id(cr, uid, 'base_calendar', 'event_tree_view')
id4 = data_obj._get_id(cr, uid, 'base_calendar', 'event_calendar_view') id4 = data_obj._get_id(cr, uid, 'base_calendar', 'event_calendar_view')
@ -1083,17 +1082,17 @@ true, it will allow you to hide the event alarm information without removing it.
id4 = data_obj.browse(cr, uid, id4, context=context).res_id id4 = data_obj.browse(cr, uid, id4, context=context).res_id
for id in ids: for id in ids:
value = { value = {
'name': _('Event'), 'name': _('Event'),
'view_type': 'form', 'view_type': 'form',
'view_mode': 'form,tree', 'view_mode': 'form,tree',
'res_model': 'calendar.event', 'res_model': 'calendar.event',
'view_id': False, 'view_id': False,
'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')], 'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')],
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'res_id': base_calendar_id2real_id(id), 'res_id': base_calendar_id2real_id(id),
'nodestroy': True 'nodestroy': True
} }
return value return value
def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args): def modify_this(self, cr, uid, event_id, defaults, real_date, context=None, *args):
@ -1111,9 +1110,9 @@ true, it will allow you to hide the event alarm information without removing it.
event_id = base_calendar_id2real_id(event_id) event_id = base_calendar_id2real_id(event_id)
datas = self.read(cr, uid, event_id, context=context) datas = self.read(cr, uid, event_id, context=context)
defaults.update({ defaults.update({
'recurrent_uid': base_calendar_id2real_id(datas['id']), 'recurrent_uid': base_calendar_id2real_id(datas['id']),
'recurrent_id': defaults.get('date') or real_date, 'recurrent_id': defaults.get('date') or real_date,
'rrule_type': 'none', 'rrule_type': 'none',
'rrule': '' 'rrule': ''
}) })
exdate = datas['exdate'] and datas['exdate'].split(',') or [] exdate = datas['exdate'] and datas['exdate'].split(',') or []
@ -1131,7 +1130,7 @@ true, it will allow you to hide the event alarm information without removing it.
@param event_ids: List of crm meetings IDs. @param event_ids: List of crm meetings IDs.
@return: True @return: True
""" """
for event_id in event_ids: for event_id in event_ids:
event_id = base_calendar_id2real_id(event_id) event_id = base_calendar_id2real_id(event_id)
@ -1146,7 +1145,7 @@ true, it will allow you to hide the event alarm information without removing it.
qry += ", location = '%(location)s'" qry += ", location = '%(location)s'"
qry += "WHERE id = %s" % (event_id) qry += "WHERE id = %s" % (event_id)
cr.execute(qry %(defaults)) cr.execute(qry %(defaults))
return True return True
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100): def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100):
@ -1167,7 +1166,7 @@ true, it will allow you to hide the event alarm information without removing it.
result = [] result = []
if ids and (base_start_date or base_until_date): if ids and (base_start_date or base_until_date):
cr.execute("select m.id, m.rrule, m.date, m.date_deadline, \ cr.execute("select m.id, m.rrule, m.date, m.date_deadline, \
m.exdate from " + self._table + \ m.exdate, m.exrule from " + self._table + \
" m where m.id in ("\ " m where m.id in ("\
+ ','.join(map(lambda x: str(x), ids))+")") + ','.join(map(lambda x: str(x), ids))+")")
@ -1214,7 +1213,7 @@ true, it will allow you to hide the event alarm information without removing it.
new_rule = '%s=%s' % (name, value) new_rule = '%s=%s' % (name, value)
new_rrule_str.append(new_rule) new_rrule_str.append(new_rule)
new_rrule_str = ';'.join(new_rrule_str) new_rrule_str = ';'.join(new_rrule_str)
rdates = get_recurrent_dates(str(new_rrule_str), exdate, start_date) rdates = get_recurrent_dates(str(new_rrule_str), exdate, start_date, data['exrule'])
for rdate in rdates: for rdate in rdates:
r_date = datetime.strptime(rdate, "%Y-%m-%d %H:%M:%S") r_date = datetime.strptime(rdate, "%Y-%m-%d %H:%M:%S")
if start_date and r_date < start_date: if start_date and r_date < start_date:
@ -1229,7 +1228,7 @@ true, it will allow you to hide the event alarm information without removing it.
if isinstance(select, (str, int, long)): if isinstance(select, (str, int, long)):
return ids and ids[0] or False return ids and ids[0] or False
return ids return ids
def compute_rule_string(self, cr, uid, datas, context=None, *args): def compute_rule_string(self, cr, uid, datas, context=None, *args):
""" """
Compute rule string. Compute rule string.
@ -1248,9 +1247,9 @@ true, it will allow you to hide the event alarm information without removing it.
freq = datas.get('freq') freq = datas.get('freq')
if freq == 'None': if freq == 'None':
return '' return ''
interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or '' interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or ''
if freq == 'weekly': if freq == 'weekly':
byday = map(lambda x: x.upper(), filter(lambda x: datas.get(x) and x in weekdays, datas)) byday = map(lambda x: x.upper(), filter(lambda x: datas.get(x) and x in weekdays, datas))
@ -1286,7 +1285,7 @@ true, it will allow you to hide the event alarm information without removing it.
return rrule_string return rrule_string
def search(self, cr, uid, args, offset=0, limit=100, order=None, def search(self, cr, uid, args, offset=0, limit=100, order=None,
context=None, count=False): context=None, count=False):
""" """
Overrides orm search method. Overrides orm search method.
@ -1317,6 +1316,7 @@ true, it will allow you to hide the event alarm information without removing it.
return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit) return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit)
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
""" """
Writes values in one or several fields. Writes values in one or several fields.
@ -1348,7 +1348,7 @@ true, it will allow you to hide the event alarm information without removing it.
event_id = base_calendar_id2real_id(event_id) event_id = base_calendar_id2real_id(event_id)
if not event_id in new_ids: if not event_id in new_ids:
new_ids.append(event_id) new_ids.append(event_id)
res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context) res = super(calendar_event, self).write(cr, uid, new_ids, vals, context=context)
if vals.has_key('alarm_id') or vals.has_key('base_calendar_alarm_id'): if vals.has_key('alarm_id') or vals.has_key('base_calendar_alarm_id'):
alarm_obj = self.pool.get('res.alarm') alarm_obj = self.pool.get('res.alarm')
@ -1478,7 +1478,7 @@ class calendar_todo(osv.osv):
_description = "Calendar Task" _description = "Calendar Task"
def _get_date(self, cr, uid, ids, name, arg, context): def _get_date(self, cr, uid, ids, name, arg, context):
""" """
Get Date Get Date
@param self: The object pointer @param self: The object pointer
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@ -1494,7 +1494,7 @@ class calendar_todo(osv.osv):
return res return res
def _set_date(self, cr, uid, id, name, value, arg, context): def _set_date(self, cr, uid, id, name, value, arg, context):
""" """
Set Date Set Date
@param self: The object pointer @param self: The object pointer
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@ -1512,8 +1512,8 @@ class calendar_todo(osv.osv):
_columns = { _columns = {
'date': fields.function(_get_date, method=True, fnct_inv=_set_date, \ 'date': fields.function(_get_date, method=True, fnct_inv=_set_date, \
string='Duration', store=True, type='datetime'), string='Duration', store=True, type='datetime'),
'duration': fields.integer('Duration'), 'duration': fields.integer('Duration'),
} }
__attribute__ = {} __attribute__ = {}
@ -1526,7 +1526,7 @@ class ir_attachment(osv.osv):
_inherit = 'ir.attachment' _inherit = 'ir.attachment'
def search_count(self, cr, user, args, context=None): def search_count(self, cr, user, args, context=None):
""" """
@param self: The object pointer @param self: The object pointer
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param user: the current users ID for security checks, @param user: the current users ID for security checks,
@ -1539,9 +1539,9 @@ class ir_attachment(osv.osv):
args1.append(map(lambda x:str(x).split('-')[0], arg)) args1.append(map(lambda x:str(x).split('-')[0], arg))
return super(ir_attachment, self).search_count(cr, user, args1, context) return super(ir_attachment, self).search_count(cr, user, args1, context)
def search(self, cr, uid, args, offset=0, limit=None, order=None, def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False): context=None, count=False):
""" """
@param self: The object pointer @param self: The object pointer
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@ -1555,8 +1555,8 @@ class ir_attachment(osv.osv):
for i, arg in enumerate(new_args): for i, arg in enumerate(new_args):
if arg[0] == 'res_id': if arg[0] == 'res_id':
new_args[i] = (arg[0], arg[1], base_calendar_id2real_id(arg[2])) new_args[i] = (arg[0], arg[1], base_calendar_id2real_id(arg[2]))
return super(ir_attachment, self).search(cr, uid, new_args, offset=offset, return super(ir_attachment, self).search(cr, uid, new_args, offset=offset,
limit=limit, order=order, limit=limit, order=order,
context=context, count=False) context=context, count=False)
ir_attachment() ir_attachment()
@ -1565,12 +1565,12 @@ class ir_values(osv.osv):
def set(self, cr, uid, key, key2, name, models, value, replace=True, \ def set(self, cr, uid, key, key2, name, models, value, replace=True, \
isobject=False, meta=False, preserve_user=False, company=False): isobject=False, meta=False, preserve_user=False, company=False):
""" """
Set IR Values Set IR Values
@param self: The object pointer @param self: The object pointer
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param model: Get The Model @param model: Get The Model
""" """
new_model = [] new_model = []
@ -1584,12 +1584,12 @@ class ir_values(osv.osv):
def get(self, cr, uid, key, key2, models, meta=False, context={}, \ def get(self, cr, uid, key, key2, models, meta=False, context={}, \
res_id_req=False, without_user=True, key2_req=True): res_id_req=False, without_user=True, key2_req=True):
""" """
Get IR Values Get IR Values
@param self: The object pointer @param self: The object pointer
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param model: Get The Model @param model: Get The Model
""" """
new_model = [] new_model = []
@ -1607,37 +1607,35 @@ class ir_model(osv.osv):
_inherit = 'ir.model' _inherit = 'ir.model'
def read(self, cr, uid, ids, fields=None, context={}, def read(self, cr, uid, ids, fields=None, context={},
load='_classic_read'): load='_classic_read'):
""" """
Read IR Model Read IR Model
@param self: The object pointer @param self: The object pointer
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param ids: List of IR Models IDs. @param ids: List of IR Models IDs.
@param context: A standard dictionary for contextual values @param context: A standard dictionary for contextual values
""" """
new_ids = isinstance(ids, (str, int, long)) and [ids] or ids data = super(ir_model, self).read(cr, uid, ids, fields=fields, \
data = super(ir_model, self).read(cr, uid, new_ids, fields=fields, \
context=context, load=load) context=context, load=load)
if data: if data:
for val in data: for val in data:
val['id'] = base_calendar_id2real_id(val['id']) val['id'] = base_calendar_id2real_id(val['id'])
return isinstance(ids, (str, int, long)) and data[0] or data return data
ir_model() ir_model()
class virtual_report_spool(web_services.report_spool): class virtual_report_spool(web_services.report_spool):
def exp_report(self, db, uid, object, ids, datas=None, context=None): def exp_report(self, db, uid, object, ids, datas=None, context=None):
""" """
Export Report Export Report
@param self: The object pointer @param self: The object pointer
@param db: get the current database, @param db: get the current database,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param context: A standard dictionary for contextual values @param context: A standard dictionary for contextual values
""" """
if object == 'printscreen.list': if object == 'printscreen.list':
@ -1656,20 +1654,20 @@ class res_users(osv.osv):
_inherit = 'res.users' _inherit = 'res.users'
def _get_user_avail(self, cr, uid, ids, context=None): def _get_user_avail(self, cr, uid, ids, context=None):
""" """
Get USer Availability Get USer Availability
@param self: The object pointer @param self: The object pointer
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param ids: List of res users IDs. @param ids: List of res users IDs.
@param context: A standard dictionary for contextual values @param context: A standard dictionary for contextual values
""" """
current_datetime = datetime.now().strftime('%Y-%m-%d %H:%M:%S') current_datetime = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
res = {} res = {}
attendee_obj = self.pool.get('calendar.attendee') attendee_obj = self.pool.get('calendar.attendee')
attendee_ids = attendee_obj.search(cr, uid, [ attendee_ids = attendee_obj.search(cr, uid, [
('event_date', '<=', current_datetime), ('event_end_date', '<=', current_datetime), ('event_date', '<=', current_datetime), ('event_end_date', '<=', current_datetime),
('state', '=', 'accepted'), ('user_id', 'in', ids) ('state', '=', 'accepted'), ('user_id', 'in', ids)
]) ])
@ -1687,13 +1685,13 @@ class res_users(osv.osv):
return res return res
def _get_user_avail_fun(self, cr, uid, ids, name, args, context=None): def _get_user_avail_fun(self, cr, uid, ids, name, args, context=None):
""" """
Get USer Availability Function Get USer Availability Function
@param self: The object pointer @param self: The object pointer
@param cr: the current row, from the database cursor, @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, @param uid: the current users ID for security checks,
@param ids: List of res users IDs. @param ids: List of res users IDs.
@param context: A standard dictionary for contextual values @param context: A standard dictionary for contextual values
""" """
return self._get_user_avail(cr, uid, ids, context=context) return self._get_user_avail(cr, uid, ids, context=context)
@ -1701,7 +1699,7 @@ class res_users(osv.osv):
_columns = { _columns = {
'availability': fields.function(_get_user_avail_fun, type='selection', \ 'availability': fields.function(_get_user_avail_fun, type='selection', \
selection=[('free', 'Free'), ('busy', 'Busy')], \ selection=[('free', 'Free'), ('busy', 'Busy')], \
string='Free/Busy', method=True), string='Free/Busy', method=True),
} }
res_users() res_users()

View File

@ -102,8 +102,8 @@
</search> </search>
</field> </field>
</record> </record>
<record id="action_view_attendee_form" model="ir.actions.act_window"> <record id="action_view_attendee_form" model="ir.actions.act_window">
<field name="name">Event Invitations</field> <field name="name">Event Invitations</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
@ -113,11 +113,11 @@
<field name="view_id" ref="base_calendar.base_calendar_attendee_tree_view" /> <field name="view_id" ref="base_calendar.base_calendar_attendee_tree_view" />
<field name="context">{'default_sent_by_uid': uid}</field> <field name="context">{'default_sent_by_uid': uid}</field>
</record> </record>
<!-- Calenadar's menu --> <!-- Calenadar's menu -->
<menuitem id="base.menu_calendar_configuration" name="Calendar" <menuitem id="base.menu_calendar_configuration" name="Calendar"
parent="base.menu_base_config" sequence="10" /> parent="base.menu_base_config" sequence="10" />
<!-- Invitation menu --> <!-- Invitation menu -->
<menuitem id="menu_attendee_invitations" <menuitem id="menu_attendee_invitations"
name="Event Invitations" parent="base.menu_calendar_configuration" name="Event Invitations" parent="base.menu_calendar_configuration"
@ -161,8 +161,8 @@
</tree> </tree>
</field> </field>
</record> </record>
<record id="action_res_alarm_view" model="ir.actions.act_window"> <record id="action_res_alarm_view" model="ir.actions.act_window">
<field name="name">Available Alarms</field> <field name="name">Available Alarms</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
@ -176,8 +176,8 @@
action="base_calendar.action_res_alarm_view" action="base_calendar.action_res_alarm_view"
parent="base.menu_calendar_configuration" /> parent="base.menu_calendar_configuration" />
<!-- Event Form View--> <!-- Event Form View-->
<record model="ir.ui.view" id="event_form_view"> <record model="ir.ui.view" id="event_form_view">
<field name="name">Event Form</field> <field name="name">Event Form</field>
<field name="model">calendar.event</field> <field name="model">calendar.event</field>
@ -338,7 +338,7 @@
</tree> </tree>
</field> </field>
</record> </record>
<!-- Event Calendar View --> <!-- Event Calendar View -->
<record model="ir.ui.view" id="event_calendar_view"> <record model="ir.ui.view" id="event_calendar_view">
@ -354,9 +354,9 @@
</calendar> </calendar>
</field> </field>
</record> </record>
<!-- Event Search View--> <!-- Event Search View-->
<record id="view_calendar_event_filter" model="ir.ui.view"> <record id="view_calendar_event_filter" model="ir.ui.view">
<field name="name">Calendar Events Search</field> <field name="name">Calendar Events Search</field>
<field name="model">calendar.event</field> <field name="model">calendar.event</field>
@ -377,7 +377,7 @@
<field name="class" select="1"/> <field name="class" select="1"/>
</group> </group>
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="16"> <group expand="1" string="Group By..." colspan="16">
<filter string="Date" icon="terp-project" <filter string="Date" icon="terp-project"
domain="[]" context="{'group_by':'date'}" /> domain="[]" context="{'group_by':'date'}" />
<filter string="Availability" icon="terp-project" <filter string="Availability" icon="terp-project"
@ -394,7 +394,7 @@
<!-- Event action --> <!-- Event action -->
<record id="action_view_event" model="ir.actions.act_window"> <record id="action_view_event" model="ir.actions.act_window">
<field name="name">Events</field> <field name="name">Events</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
@ -403,11 +403,11 @@
<field name="view_mode">tree,form,calendar</field> <field name="view_mode">tree,form,calendar</field>
<field name="search_view_id" ref="view_calendar_event_filter"/> <field name="search_view_id" ref="view_calendar_event_filter"/>
</record> </record>
<!-- Event menu --> <!-- Event menu -->
<menuitem id="menu_events" <menuitem id="menu_events"
name="Events" parent="base.menu_calendar_configuration" name="Events" parent="base.menu_calendar_configuration"
sequence="5" action="action_view_event" /> sequence="5" action="action_view_event" />
</data> </data>
</openerp> </openerp>

View File

@ -6,3 +6,4 @@
"access_calendar_todo","calendar.todo","model_calendar_todo",,1,1,1,1 "access_calendar_todo","calendar.todo","model_calendar_todo",,1,1,1,1
"access_base_calendar_invite_attendee","base_calendar.invite.attendee","model_base_calendar_invite_attendee",,1,1,1,1 "access_base_calendar_invite_attendee","base_calendar.invite.attendee","model_base_calendar_invite_attendee",,1,1,1,1
"access_calendar_event_edit_all","calendar_event_edit_all","model_calendar_event_edit_all",,1,1,1,1 "access_calendar_event_edit_all","calendar_event_edit_all","model_calendar_event_edit_all",,1,1,1,1
"access_base_calendar_set_exrule","base.calendar.set.exrule","model_base_calendar_set_exrule",,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 access_calendar_todo calendar.todo model_calendar_todo 1 1 1 1
7 access_base_calendar_invite_attendee base_calendar.invite.attendee model_base_calendar_invite_attendee 1 1 1 1
8 access_calendar_event_edit_all calendar_event_edit_all model_calendar_event_edit_all 1 1 1 1
9 access_base_calendar_set_exrule base.calendar.set.exrule model_base_calendar_set_exrule 1 1 1 1

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# #
@ -15,12 +15,13 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
import calendar_event_edit_all import calendar_event_edit_all
import base_calendar_invite_attendee import base_calendar_invite_attendee
import base_calendar_set_exrule
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -13,37 +13,38 @@
<field name="type" /> <field name="type" />
<field name="send_mail" /> <field name="send_mail" />
<newline /> <newline />
<group col="1" colspan="4" <group col="2" colspan="6"
attrs="{'invisible': [('type', '!=', 'external')]}"> attrs="{'invisible': [('type', '!=', 'external')]}">
<field name="email" colspan="4" <field name="email" colspan="4"
attrs="{'required': [('type', '=', 'external')]}" /> attrs="{'required': [('type', '=', 'external')]}" />
</group> </group>
<group col="1" colspan="4" <group col="2" colspan="6"
attrs="{'invisible': [('type', '!=', 'internal')]}"> attrs="{'invisible': [('type', '!=', 'internal')]}">
<separator string="Users" colspan="4" /> <separator string="Users" colspan="4" />
<field name="user_ids" select="1" colspan="4" <field name="user_ids" select="1" colspan="4"
nolabel="1" /> nolabel="1" />
<newline /> <newline />
</group> </group>
<group col="2" colspan="4" <group col="2" colspan="6"
attrs="{'invisible': [('type', '!=', 'partner')]}"> attrs="{'invisible': [('type', '!=', 'partner')]}">
<field name="partner_id" colspan="2" <field name="partner_id" colspan="2"
on_change="onchange_partner_id(partner_id)" on_change="onchange_partner_id(partner_id)"
attrs="{'required': [('type', '=', 'partner')]}" /> attrs="{'required': [('type', '=', 'partner')]}" />
<newline /> <newline />
<separator string="Partner Contacts" <separator string="Partner Contacts"
colspan="4" /> colspan="6" />
<field name="contact_ids" select="1" colspan="4" <field name="contact_ids" select="1" colspan="4"
nolabel="1" domain="[('partner_id', '=', partner_id)]" nolabel="1" domain="[('partner_id', '=', partner_id)]"
attrs="{'readonly': [('type', '!=', 'partner')]}" /> attrs="{'readonly': [('type', '!=', 'partner')]}" />
</group> </group>
<newline /> <newline />
<separator string="" colspan="6" /> <separator string="" colspan="6" />
<label string="" colspan="2" /> <group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel" <button icon='gtk-cancel' special="cancel"
string="Cancel" /> string="Cancel" />
<button name="do_invite" string="Invite" <button name="do_invite" string="Invite"
type="object" icon="gtk-ok" /> type="object" icon="gtk-ok" />
</group>
</form> </form>
</field> </field>
</record> </record>

View File

@ -43,12 +43,12 @@ class recording_objects_proxy(osv_pool):
res = super(recording_objects_proxy, self).execute(*args, **argv) res = super(recording_objects_proxy, self).execute(*args, **argv)
pool = pooler.get_pool(args[0]) pool = pooler.get_pool(args[0])
mod = pool.get('ir.module.record') mod = pool.get('ir.module.record')
if mod and mod.recording: if mod and mod.recording:
if args[3] not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink'): if args[3] not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink'):
if _old_args is not None: if _old_args is not None:
if args[3] != 'write' and args[3] != 'create' and len(args) > 5 and isinstance(args[5], dict): if args[3] != 'write' and args[3] != 'create' and len(args) > 5 and isinstance(args[5], dict):
args=list(args) args=list(args)
args[5]=_old_args args[5]=_old_args
args=tuple(args) args=tuple(args)
mod.recording_data.append(('osv_memory_action', args, argv ,None)) mod.recording_data.append(('osv_memory_action', args, argv ,None))
@ -69,7 +69,7 @@ class recording_objects_proxy(osv_pool):
return res return res
recording_objects_proxy() recording_objects_proxy()
class xElement(minidom.Element): class xElement(minidom.Element):
"""dom.Element with compact print """dom.Element with compact print
The Element in minidom has a problem: if printed, adds whitespace The Element in minidom has a problem: if printed, adds whitespace
@ -88,7 +88,7 @@ def doc_createXElement(xdoc, tagName):
return e return e
import yaml import yaml
class record(yaml.YAMLObject): class record(yaml.YAMLObject):
yaml_tag = u'!record' yaml_tag = u'!record'
def __init__(self, model, id=None, attrs={}): def __init__(self, model, id=None, attrs={}):
@ -106,7 +106,7 @@ class workflow(yaml.YAMLObject):
self.action=action self.action=action
def __repr__(self): def __repr__(self):
return '!workflow {model: %s, action: %s, ref: %s}' % (str(self.model,), str(self.action,), str(self.ref,)) return '!workflow {model: %s, action: %s, ref: %s}' % (str(self.model,), str(self.action,), str(self.ref,))
class ref(yaml.YAMLObject): class ref(yaml.YAMLObject):
yaml_tag = u'!ref' yaml_tag = u'!ref'
def __init__(self, expr="False"): def __init__(self, expr="False"):
@ -129,7 +129,7 @@ class function(yaml.YAMLObject):
self.attrs=attrs self.attrs=attrs
def __repr__(self): def __repr__(self):
return '!python {model: %s}: |' % (str(self.model), ) return '!python {model: %s}: |' % (str(self.model), )
class base_module_record(osv.osv): class base_module_record(osv.osv):
_name = "ir.module.record" _name = "ir.module.record"
_columns = { _columns = {
@ -169,16 +169,16 @@ class base_module_record(osv.osv):
obj = dt.browse(cr, uid, dtids[0]) obj = dt.browse(cr, uid, dtids[0])
self.depends[obj.module] = True self.depends[obj.module] = True
return obj.module+'.'+obj.name, obj.noupdate return obj.module+'.'+obj.name, obj.noupdate
def _create_record(self, cr, uid, doc, model, data, record_id, noupdate=False): def _create_record(self, cr, uid, doc, model, data, record_id, noupdate=False):
data_pool = self.pool.get('ir.model.data') data_pool = self.pool.get('ir.model.data')
model_pool = self.pool.get(model) model_pool = self.pool.get(model)
record = doc.createElement('record') record = doc.createElement('record')
record.setAttribute("id", record_id) record.setAttribute("id", record_id)
record.setAttribute("model", model) record.setAttribute("model", model)
record_list = [record] record_list = [record]
lids = data_pool.search(cr, uid, [('model','=',model)]) lids = data_pool.search(cr, uid, [('model','=',model)])
res = data_pool.read(cr, uid, lids[:1], ['module']) res = data_pool.read(cr, uid, lids[:1], ['module'])
if res: if res:
@ -207,7 +207,7 @@ class base_module_record(osv.osv):
noupdate = noupdate or update noupdate = noupdate or update
if not id: if not id:
relation_pool = self.pool.get(fields[key]['relation']) relation_pool = self.pool.get(fields[key]['relation'])
field.setAttribute("model", fields[key]['relation']) field.setAttribute("model", fields[key]['relation'])
fld_nm = relation_pool._rec_name fld_nm = relation_pool._rec_name
name = relation_pool.read(cr, uid, val,[fld_nm])[fld_nm] or False name = relation_pool.read(cr, uid, val,[fld_nm])[fld_nm] or False
@ -231,7 +231,7 @@ class base_module_record(osv.osv):
newid = self._create_id(cr, uid, fields[key]['relation'], valitem[2]) newid = self._create_id(cr, uid, fields[key]['relation'], valitem[2])
valitem[1]=newid valitem[1]=newid
self.ids[(fields[key]['relation'], valitem[1])] = newid self.ids[(fields[key]['relation'], valitem[1])] = newid
childrecord, update = self._create_record(cr, uid, doc, fields[key]['relation'],valitem[2], newid) childrecord, update = self._create_record(cr, uid, doc, fields[key]['relation'],valitem[2], newid)
noupdate = noupdate or update noupdate = noupdate or update
record_list += childrecord record_list += childrecord
@ -260,11 +260,11 @@ class base_module_record(osv.osv):
def _create_yaml_record(self, cr, uid, model, data, record_id): def _create_yaml_record(self, cr, uid, model, data, record_id):
record={'model': model, 'id': str(record_id)} record={'model': model, 'id': str(record_id)}
model_pool = self.pool.get(model) model_pool = self.pool.get(model)
data_pool = self.pool.get('ir.model.data') data_pool = self.pool.get('ir.model.data')
lids = data_pool.search(cr, uid, [('model','=',model)]) lids = data_pool.search(cr, uid, [('model','=',model)])
res = data_pool.read(cr, uid, lids[:1], ['module']) res = data_pool.read(cr, uid, lids[:1], ['module'])
attrs={} attrs={}
if res: if res:
@ -275,7 +275,7 @@ class base_module_record(osv.osv):
defaults[model] = model_pool.default_get(cr, uid, data) defaults[model] = model_pool.default_get(cr, uid, data)
except: except:
defaults[model]={} defaults[model]={}
for key,val in data.items(): for key,val in data.items():
if ((key in defaults[model]) and (val == defaults[model][key])) and not(fields[key].get('required',False)): if ((key in defaults[model]) and (val == defaults[model][key])) and not(fields[key].get('required',False)):
continue continue
if fields[key]['type'] in ('integer','float'): if fields[key]['type'] in ('integer','float'):
@ -303,7 +303,7 @@ class base_module_record(osv.osv):
else: else:
fname = model_pool._inherit_fields[key][2]._fields_id fname = model_pool._inherit_fields[key][2]._fields_id
del valitem[2][fname] #delete parent_field from child's fields list del valitem[2][fname] #delete parent_field from child's fields list
childrecord = self._create_yaml_record(cr, uid, fields[key]['relation'],valitem[2], None) childrecord = self._create_yaml_record(cr, uid, fields[key]['relation'],valitem[2], None)
items[0].append(childrecord['attrs']) items[0].append(childrecord['attrs'])
attrs[key] = items attrs[key] = items
@ -343,7 +343,7 @@ class base_module_record(osv.osv):
for f in filter(lambda a: isinstance(obj._columns[a], fields.function)\ for f in filter(lambda a: isinstance(obj._columns[a], fields.function)\
and (not obj._columns[a].store),obj._columns): and (not obj._columns[a].store),obj._columns):
del data[f] del data[f]
for key,val in data.items(): for key,val in data.items():
if result.has_key(key): if result.has_key(key):
continue continue
@ -378,6 +378,7 @@ class base_module_record(osv.osv):
return result return result
def _create_function(self, cr, uid, doc, model, name, record_id): def _create_function(self, cr, uid, doc, model, name, record_id):
print "creareeeeeeeeeeeeeeeeee"
record = doc.createElement('function') record = doc.createElement('function')
record.setAttribute("name", name) record.setAttribute("name", name)
record.setAttribute("model", model) record.setAttribute("model", model)
@ -402,7 +403,7 @@ class base_module_record(osv.osv):
record,update = self._create_record(cr, uid, doc, rec[2], rec[5], id) record,update = self._create_record(cr, uid, doc, rec[2], rec[5], id)
noupdate = noupdate or update noupdate = noupdate or update
record_list += record record_list += record
elif rec[4] in ('menu_create',): elif rec[4] in ('menu_create',):
for id in rec[5]: for id in rec[5]:
id,update = self._get_id(cr, uid, rec[3], id) id,update = self._get_id(cr, uid, rec[3], id)
@ -460,6 +461,7 @@ class base_module_record(osv.osv):
return record return record
def _generate_function_yaml(self, cr, uid, args): def _generate_function_yaml(self, cr, uid, args):
print "geberareeeeeeeeeeeeeeee",args
db, uid, model, action, ids, context = args db, uid, model, action, ids, context = args
temp_context = context.copy() temp_context = context.copy()
active_id = temp_context['active_id'] active_id = temp_context['active_id']
@ -484,7 +486,7 @@ class base_module_record(osv.osv):
attrs=str(attrs)+'})' attrs=str(attrs)+'})'
function['attrs'] = attrs function['attrs'] = attrs
return function return function
def _generate_assert_xml(self, rec, doc): def _generate_assert_xml(self, rec, doc):
pass pass
@ -526,7 +528,7 @@ class base_module_record(osv.osv):
self.ids = {} self.ids = {}
if len(self.recording_data): if len(self.recording_data):
yaml_file='''\n''' yaml_file='''\n'''
for rec in self.recording_data: for rec in self.recording_data:
if rec[1][3] == 'create': if rec[1][3] == 'create':
self.mode="create" self.mode="create"
@ -565,21 +567,21 @@ class base_module_record(osv.osv):
yaml_file += str(object) + '''\n''' yaml_file += str(object) + '''\n'''
attrs=yaml.dump(object.attrs, default_flow_style=False) attrs=yaml.dump(object.attrs, default_flow_style=False)
yaml_file += attrs + '''\n\n''' yaml_file += attrs + '''\n\n'''
yaml_result='''''' yaml_result=''''''
for line in yaml_file.split('\n'): for line in yaml_file.split('\n'):
line=line.replace("''","'") line=line.replace("''","'")
if (line.find('!record') == 0) or (line.find('!workflow') == 0) or (line.find('!python') == 0): if (line.find('!record') == 0) or (line.find('!workflow') == 0) or (line.find('!python') == 0):
line = "- \n" + " " + line line = "- \n" + " " + line
elif line.find('!comment') == 0: elif line.find('!comment') == 0:
line=line.replace('!comment','- \n ') line=line.replace('!comment','- \n ')
elif line.find('- -') != -1: elif line.find('- -') != -1:
line=line.replace('- -',' -') line=line.replace('- -',' -')
line = " " + line line = " " + line
else: else:
line = " " + line line = " " + line
yaml_result += line + '''\n''' yaml_result += line + '''\n'''
return yaml_result return yaml_result
base_module_record() base_module_record()

View File

@ -27,8 +27,6 @@ import pooler
from osv import osv from osv import osv
from tools.translate import _ from tools.translate import _
class report_creator_open(wizard.interface): class report_creator_open(wizard.interface):
def _open_report(self, cr, uid, data, context): def _open_report(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname) pool = pooler.get_pool(cr.dbname)

View File

@ -47,7 +47,7 @@
name="convert_opportunity" name="convert_opportunity"
string="Convert" string="Convert"
help="Convert to Opportunity" help="Convert to Opportunity"
icon="gtk-index" icon="gtk-index"
type="object" type="object"
attrs="{'invisible':[('opportunity_id','!=',False)]}"/> attrs="{'invisible':[('opportunity_id','!=',False)]}"/>
<newline /> <newline />
@ -176,7 +176,7 @@
<field name="email_to"/> <field name="email_to"/>
<field name="description"/> <field name="description"/>
</tree> </tree>
</field> </field>
<button colspan="2" string="Send New Email" <button colspan="2" string="Send New Email"
name="%(action_crm_send_mail)d" name="%(action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}" context="{'mail':'new', 'model': 'crm.lead'}"
@ -307,7 +307,7 @@
help="Show Sales Team"/> help="Show Sales Team"/>
</field> </field>
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="14"> <group expand="1" string="Group By..." colspan="14">
<filter string="Stage" icon="terp-crm" domain="[]" context="{'group_by':'stage_id'}"/> <filter string="Stage" icon="terp-crm" domain="[]" context="{'group_by':'stage_id'}"/>
<filter string="State" icon="terp-crm" domain="[]" context="{'group_by':'state'}"/> <filter string="State" icon="terp-crm" domain="[]" context="{'group_by':'state'}"/>
<filter string="Source" icon="terp-crm" domain="[]" context="{'group_by':'categ_id'}"/> <filter string="Source" icon="terp-crm" domain="[]" context="{'group_by':'categ_id'}"/>

View File

@ -274,7 +274,7 @@
<field name="user_id" select="1" widget="selection"/> <field name="user_id" select="1" widget="selection"/>
</group> </group>
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="16"> <group expand="1" string="Group By..." colspan="16">
<filter string="Date" icon="terp-project" <filter string="Date" icon="terp-project"
domain="[]" context="{'group_by':'date'}" /> domain="[]" context="{'group_by':'date'}" />
<filter string="Privacy" icon="terp-crm" <filter string="Privacy" icon="terp-crm"
@ -320,7 +320,7 @@
</field> </field>
</field> </field>
</record> </record>
<!-- Partners inherited form --> <!-- Partners inherited form -->
<record id="view_meeting_partner_info_form" model="ir.ui.view"> <record id="view_meeting_partner_info_form" model="ir.ui.view">

View File

@ -303,7 +303,7 @@
help="My Sale Team" /> help="My Sale Team" />
</field> </field>
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="16"> <group expand="1" string="Group By..." colspan="16">
<filter string="Stage" icon="terp-crm" domain="[]" <filter string="Stage" icon="terp-crm" domain="[]"
context="{'group_by':'stage_id'}" /> context="{'group_by':'stage_id'}" />
<filter string="Priority" icon="terp-crm" domain="[]" <filter string="Priority" icon="terp-crm" domain="[]"
@ -325,7 +325,7 @@
</search> </search>
</field> </field>
</record> </record>
<!-- Partners inherited form --> <!-- Partners inherited form -->
<record id="view_opp_partner_info_form" model="ir.ui.view"> <record id="view_opp_partner_info_form" model="ir.ui.view">
@ -342,11 +342,11 @@
<field name="name"/> <field name="name"/>
<field name="email_from"/> <field name="email_from"/>
<field name="phone"/> <field name="phone"/>
<field name="categ_id" invisible="1"/> <field name="categ_id" invisible="1"/>
<field name="type_id" invisible="1"/> <field name="type_id" invisible="1"/>
<field name="referred" invisible="1"/> <field name="referred" invisible="1"/>
<field name="stage_id"/> <field name="stage_id"/>
<button name="stage_previous" string="Previous" <button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" /> states="open,pending" type="object" icon="gtk-go-back" />

View File

@ -137,7 +137,7 @@
</form> </form>
</field> </field>
</record> </record>
<!--Inbound Phonecalls Form View --> <!--Inbound Phonecalls Form View -->
<record model="ir.ui.view" id="crm_case_inbound_phone_form_view"> <record model="ir.ui.view" id="crm_case_inbound_phone_form_view">
@ -197,9 +197,9 @@
</form> </form>
</field> </field>
</record> </record>
<!--Inbound Phonecalls Tree View --> <!--Inbound Phonecalls Tree View -->
<record model="ir.ui.view" id="crm_case_inbound_phone_tree_view"> <record model="ir.ui.view" id="crm_case_inbound_phone_tree_view">
<field name="name">CRM - Inbound Phone Calls Tree</field> <field name="name">CRM - Inbound Phone Calls Tree</field>
<field name="model">crm.phonecall</field> <field name="model">crm.phonecall</field>
@ -274,7 +274,7 @@
help="My Sale Team" /> help="My Sale Team" />
</field> </field>
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="4"> <group expand="1" string="Group By..." colspan="4">
<filter string="Partner" icon="terp-crm" domain="[]" <filter string="Partner" icon="terp-crm" domain="[]"
context="{'group_by':'partner_id'}" /> context="{'group_by':'partner_id'}" />
<filter string="Responsible" icon="terp-crm" <filter string="Responsible" icon="terp-crm"
@ -288,9 +288,9 @@
</search> </search>
</field> </field>
</record> </record>
<!-- Partners inherited form --> <!-- Partners inherited form -->
<record id="view_phonecall_partner_info_form" model="ir.ui.view"> <record id="view_phonecall_partner_info_form" model="ir.ui.view">
<field name="name">res.partner.phonecall.info.inherit</field> <field name="name">res.partner.phonecall.info.inherit</field>
<field name="model">res.partner</field> <field name="model">res.partner</field>
@ -302,6 +302,6 @@
</field> </field>
</field> </field>
</record> </record>
</data> </data>
</openerp> </openerp>

View File

@ -63,7 +63,7 @@
</record> </record>
<!-- Leads by user and section Search View --> <!-- Leads by user and section Search View -->
<record id="view_report_crm_lead_filter" model="ir.ui.view"> <record id="view_report_crm_lead_filter" model="ir.ui.view">
<field name="name">crm.lead.report.select</field> <field name="name">crm.lead.report.select</field>
<field name="model">crm.lead.report</field> <field name="model">crm.lead.report</field>
@ -118,8 +118,41 @@
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" /> <filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
</field> </field>
</group> </group>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Stage" icon="terp-sale" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
<newline/> <newline/>
<group expand="1" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-sale" <filter icon="terp-sale"
string="Done" string="Done"
domain="[('state','=','done')]"/> domain="[('state','=','done')]"/>
@ -132,40 +165,6 @@
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/> <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.lead')]"/>
</group> </group>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Stage" icon="terp-sale" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
</search> </search>
</field> </field>
</record> </record>
@ -220,7 +219,7 @@
<field name="view_id" ref="view_report_crm_lead_graph"/> <field name="view_id" ref="view_report_crm_lead_graph"/>
<field name="act_window_id" ref="action_report_crm_lead"/> <field name="act_window_id" ref="action_report_crm_lead"/>
</record> </record>
<record id="action_report_crm_opportunity" model="ir.actions.act_window"> <record id="action_report_crm_opportunity" model="ir.actions.act_window">
<field name="name">Opportunities</field> <field name="name">Opportunities</field>
<field name="res_model">crm.lead.report</field> <field name="res_model">crm.lead.report</field>
@ -244,7 +243,7 @@
<field name="view_id" ref="view_report_crm_lead_graph"/> <field name="view_id" ref="view_report_crm_lead_graph"/>
<field name="act_window_id" ref="action_report_crm_opportunity"/> <field name="act_window_id" ref="action_report_crm_opportunity"/>
</record> </record>
<menuitem name="Leads" id="menu_report_crm_leads_tree" <menuitem name="Leads" id="menu_report_crm_leads_tree"
groups="base.group_extended" groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_lead" /> parent="base.next_id_64" action="action_report_crm_lead" />

View File

@ -63,7 +63,7 @@
</record> </record>
<!-- Phone calls by user and section Search View --> <!-- Phone calls by user and section Search View -->
<record id="view_report_crm_phonecall_filter" model="ir.ui.view"> <record id="view_report_crm_phonecall_filter" model="ir.ui.view">
<field name="name">crm.phonecall.report.select</field> <field name="name">crm.phonecall.report.select</field>
<field name="model">crm.phonecall.report</field> <field name="model">crm.phonecall.report</field>
@ -118,8 +118,39 @@
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" /> <filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
</field> </field>
</group> </group>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
<newline/> <newline/>
<group expand="1" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-sale" <filter icon="terp-sale"
string="Done" string="Done"
domain="[('state','=','done')]"/> domain="[('state','=','done')]"/>
@ -131,39 +162,8 @@
<separator orientation="vertical"/> <separator orientation="vertical"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/> <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
</group> </group>
</group> </group>
<newline/> <newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -271,7 +271,7 @@
<field name="section_id" select="1" <field name="section_id" select="1"
widget="selection"/> widget="selection"/>
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="10" col="20"> <group expand="1" string="Group By..." colspan="10" col="20">
<filter string="Deadline" icon="terp-crm" <filter string="Deadline" icon="terp-crm"
domain="[]" domain="[]"
context="{'group_by':'date_deadline'}" /> context="{'group_by':'date_deadline'}" />

View File

@ -67,7 +67,7 @@
</record> </record>
<!-- CRM Claim Report Search View --> <!-- CRM Claim Report Search View -->
<record id="view_report_crm_claim_filter" model="ir.ui.view"> <record id="view_report_crm_claim_filter" model="ir.ui.view">
<field name="name">crm.claim.report.select</field> <field name="name">crm.claim.report.select</field>
<field name="model">crm.claim.report</field> <field name="model">crm.claim.report</field>
@ -122,8 +122,47 @@
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" /> <filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
</field> </field>
</group> </group>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Stage" icon="terp-sale" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical"/>
<filter string="Priority" icon="terp-sale" domain="[]"
context="{'group_by':'priority'}" />
<filter string="Type" icon="terp-sale" domain="[]"
context="{'group_by':'type_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
<newline/> <newline/>
<group expand="1" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-sale" <filter icon="terp-sale"
string="Done" string="Done"
domain="[('state','=','done')]"/> domain="[('state','=','done')]"/>
@ -141,46 +180,6 @@
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/> <field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
</group> </group>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Stage" icon="terp-sale" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical"/>
<filter string="Priority" icon="terp-sale" domain="[]"
context="{'group_by':'priority'}" />
<filter string="Type" icon="terp-sale" domain="[]"
context="{'group_by':'type_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -284,7 +284,7 @@
</field> </field>
</group> </group>
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="10" col="20"> <group expand="1" string="Group By..." colspan="10" col="20">
<filter string="Partner" icon="terp-partner" <filter string="Partner" icon="terp-partner"
domain="[]" domain="[]"
context="{'group_by':'partner_id'}" /> context="{'group_by':'partner_id'}" />

View File

@ -121,8 +121,38 @@
<filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" /> <filter icon="terp-crm" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
</field> </field>
</group> </group>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
<newline/> <newline/>
<group expand="1" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-sale" <filter icon="terp-sale"
string="Done" string="Done"
domain="[('state','=','done')]"/> domain="[('state','=','done')]"/>
@ -130,44 +160,12 @@
<filter icon="terp-sale" <filter icon="terp-sale"
string="Cancel" string="Cancel"
domain="[('state','=','cancel')]"/> domain="[('state','=','cancel')]"/>
<group> <group>
<separator orientation="vertical"/> <separator orientation="vertical"/>
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/> <field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.fundraising')]"/>
</group> </group>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -243,7 +243,7 @@
help="My section" /> help="My section" />
</field> </field>
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="12" col="20"> <group expand="1" string="Group By..." colspan="12" col="20">
<filter string="Customer" icon="terp-crm" <filter string="Customer" icon="terp-crm"
domain="[]" context="{'group_by':'partner_id'}" /> domain="[]" context="{'group_by':'partner_id'}" />
<filter string="State" icon="terp-crm" domain="[]" <filter string="State" icon="terp-crm" domain="[]"

View File

@ -114,36 +114,13 @@
<field name="user_id" widget="selection"/> <field name="user_id" widget="selection"/>
</group> </group>
<newline/> <newline/>
<group expand="1" string="Extended options..." colspan="4" col="5">
<filter icon="terp-sale"
string="Lowest"
domain="[('priority','=','5')]"/>
<filter icon="terp-sale" <!-- Helpdesk report after Sales Services Apply Group -->
string="Low"
domain="[('priority','=','4')]"/>
<filter icon="terp-sale"
string="Normal"
domain="[('priority','=','3')]"/>
<filter icon="terp-sale"
string="High"
domain="[('priority','=','2')]"/>
<filter icon="terp-sale"
string="Highest"
domain="[('priority','=','1')]"/>
</group>
<newline/>
<!-- Helpdesk report after Sales Services Apply Group -->
<group expand="1" string="Group By..." colspan="4" col="8"> <group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" icon="terp-sale" <filter string="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" domain="[]" context="{'group_by':'user_id'}"
default="1" /> default="1" />
<filter string="Company" icon="terp-sale" <filter string="Company" icon="terp-sale"
domain="[]" domain="[]"
@ -169,6 +146,31 @@
domain="[]" context="{'group_by':'name'}" /> domain="[]" context="{'group_by':'name'}" />
</group> </group>
<group expand="0" string="Extended options..." colspan="4" col="5">
<filter icon="terp-sale"
string="Lowest"
domain="[('priority','=','5')]"/>
<filter icon="terp-sale"
string="Low"
domain="[('priority','=','4')]"/>
<filter icon="terp-sale"
string="Normal"
domain="[('priority','=','3')]"/>
<filter icon="terp-sale"
string="High"
domain="[('priority','=','2')]"/>
<filter icon="terp-sale"
string="Highest"
domain="[('priority','=','1')]"/>
</group>
<newline/>
</search> </search>
</field> </field>
</record> </record>

View File

@ -118,7 +118,7 @@
<record model="ir.ui.view" id="view_document_directory_tree"> <record model="ir.ui.view" id="view_document_directory_tree">
<field name="name">document.directory</field> <field name="name">document.directory</field>
<field name="model">document.directory</field> <field name="model">document.directory</field>
<field name="type">tree</field> <field name="type">tree</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Directories" toolbar="1"> <tree string="Directories" toolbar="1">
<field name="name"/> <field name="name"/>

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# OpenERP, Open Source Management Solution # OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# #
@ -15,7 +15,7 @@
# GNU Affero General Public License for more details. # GNU Affero General Public License for more details.
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
@ -49,7 +49,7 @@ class node_context(object):
context """ context """
cached_roots = {} cached_roots = {}
def __init__(self, cr, uid, context=None): def __init__(self, cr, uid, context=None):
self.dbname = cr.dbname self.dbname = cr.dbname
self.uid = uid self.uid = uid
self.context = context self.context = context
@ -59,21 +59,18 @@ class node_context(object):
def get_uri(self, cr, uri): def get_uri(self, cr, uri):
""" Although this fn passes back to doc.dir, it is needed since """ Although this fn passes back to doc.dir, it is needed since
it is a potential caching point """ it is a potential caching point """
(ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self) (ndir, duri) = self._dirobj._locate_child(cr,self.uid, self.rootdir,uri, None, self)
while duri: while duri:
ndir = ndir.child(cr, duri[0]) ndir = ndir.child(cr, duri[0])
if not ndir: if not ndir:
return False return False
duri = duri[1:] duri = duri[1:]
return ndir return ndir
class node_class(object): class node_class(object):
""" this is a superclass for our inodes """ this is a superclass for our inodes
It is an API for all code that wants to access the document files. It is an API for all code that wants to access the document files.
Nodes have attributes which contain usual file properties Nodes have attributes which contain usual file properties
""" """
our_type = 'baseclass' our_type = 'baseclass'
@ -93,10 +90,10 @@ class node_class(object):
if parent: if parent:
self.dctx = parent.dctx.copy() self.dctx = parent.dctx.copy()
self.displayname = 'Object' self.displayname = 'Object'
def full_path(self): def full_path(self):
""" Return the components of the full path for some """ Return the components of the full path for some
node. node.
The returned list only contains the names of nodes. The returned list only contains the names of nodes.
""" """
if self.parent: if self.parent:
@ -120,7 +117,7 @@ class node_class(object):
def path_get(self): def path_get(self):
print "node_class.path_get()" print "node_class.path_get()"
return False return False
def get_data(self,cr): def get_data(self,cr):
raise TypeError('no data for %s'% self.type) raise TypeError('no data for %s'% self.type)
@ -129,7 +126,7 @@ class node_class(object):
def get_etag(self,cr): def get_etag(self,cr):
""" Get a tag, unique per object + modification. """ Get a tag, unique per object + modification.
see. http://tools.ietf.org/html/rfc2616#section-13.3.3 """ see. http://tools.ietf.org/html/rfc2616#section-13.3.3 """
return self._get_ttag(cr) + ':' + self._get_wtag(cr) return self._get_ttag(cr) + ':' + self._get_wtag(cr)
@ -139,14 +136,14 @@ class node_class(object):
wtime = time.mktime(time.strptime(self.write_date,'%Y-%m-%d %H:%M:%S')) wtime = time.mktime(time.strptime(self.write_date,'%Y-%m-%d %H:%M:%S'))
else: wtime = time.time() else: wtime = time.time()
return str(wtime) return str(wtime)
def _get_ttag(self,cr): def _get_ttag(self,cr):
""" Get a unique tag for this type/id of object. """ Get a unique tag for this type/id of object.
Must be overriden, so that each node is uniquely identified. Must be overriden, so that each node is uniquely identified.
""" """
print "node_class.get_ttag()",self print "node_class.get_ttag()",self
raise RuntimeError("get_etag stub()") raise RuntimeError("get_etag stub()")
def get_dav_props(self, cr): def get_dav_props(self, cr):
""" If this class has special behaviour for GroupDAV etc, export """ If this class has special behaviour for GroupDAV etc, export
its capabilities """ its capabilities """
@ -172,17 +169,17 @@ class node_class(object):
class node_database(node_class): class node_database(node_class):
""" A node representing the database directory """ A node representing the database directory
""" """
our_type = 'database' our_type = 'database'
def __init__(self, path=[], parent=False, context=None): def __init__(self, path=[], parent=False, context=None):
super(node_database,self).__init__(path, parent, context) super(node_database,self).__init__(path, parent, context)
def children(self, cr, domain=None): def children(self, cr, domain=None):
res = self._child_get(cr, domain=domain) + self._file_get(cr) res = self._child_get(cr, domain=domain) + self._file_get(cr)
return res return res
def child(self, cr, name, domain=None): def child(self, cr, name, domain=None):
res = self._child_get(cr, name, domain=None) res = self._child_get(cr, name, domain=None)
if res: if res:
return res[0] return res[0]
@ -196,7 +193,7 @@ class node_database(node_class):
uid = self.context.uid uid = self.context.uid
ctx = self.context.context.copy() ctx = self.context.context.copy()
ctx.update(self.dctx) ctx.update(self.dctx)
where = [('parent_id','=',parent_id)] where = [('parent_id','=',parent_id)]
if name: if name:
where.append(('name','=',name)) where.append(('name','=',name))
if not domain: if not domain:
@ -204,16 +201,16 @@ class node_database(node_class):
where2 = where + domain + [('type', '=', 'directory')] where2 = where + domain + [('type', '=', 'directory')]
ids = dirobj.search(cr, uid, where2, context=ctx) ids = dirobj.search(cr, uid, where2, context=ctx)
res = [] res = []
for dirr in dirobj.browse(cr,uid,ids,context=ctx): for dirr in dirobj.browse(cr,uid,ids,context=ctx):
res.append(node_dir(dirr.name,self,self.context,dirr)) res.append(node_dir(dirr.name,self,self.context,dirr))
where2 = where + domain + [('type', '=', 'ressource'), ('ressource_parent_type_id','=',False)] where2 = where + domain + [('type', '=', 'ressource'), ('ressource_parent_type_id','=',False)]
ids = dirobj.search(cr, uid, where2, context=ctx) ids = dirobj.search(cr, uid, where2, context=ctx)
for dirr in dirobj.browse(cr,uid,ids,context=ctx): for dirr in dirobj.browse(cr,uid,ids,context=ctx):
res.append(node_res_dir(dirr.name,self,self.context,dirr)) res.append(node_res_dir(dirr.name,self,self.context,dirr))
fil_obj = dirobj.pool.get('ir.attachment') fil_obj = dirobj.pool.get('ir.attachment')
ids = fil_obj.search(cr,uid,where,context=ctx) ids = fil_obj.search(cr,uid,where,context=ctx)
if ids: if ids:
for fil in fil_obj.browse(cr,uid,ids,context=ctx): for fil in fil_obj.browse(cr,uid,ids,context=ctx):
@ -237,7 +234,7 @@ class node_database(node_class):
def _get_ttag(self,cr): def _get_ttag(self,cr):
return 'db-%s' % cr.dbname return 'db-%s' % cr.dbname
class node_dir(node_database): class node_dir(node_database):
our_type = 'collection' our_type = 'collection'
@ -268,29 +265,27 @@ class node_dir(node_database):
print e print e
pass pass
def get_data(self,cr): def get_data(self,cr):
res = '' res = ''
for child in self.children(cr): for child in self.children(cr):
res += child.get_data(cr) res += child.get_data(cr)
return res return res
def _file_get(self,cr, nodename=False): def _file_get(self,cr, nodename=False):
return super(node_dir,self)._file_get(cr, nodename, self.dir_id) return super(node_dir,self)._file_get(cr, nodename, self.dir_id)
def _child_get(self, cr, name=None, domain=None): def _child_get(self, cr, name=None, domain=None):
return super(node_dir,self)._child_get(cr, name, self.dir_id, domain=domain) return super(node_dir,self)._child_get(cr, name, self.dir_id, domain=domain)
def rmcol(self, cr): def rmcol(self, cr):
uid = self.context.uid uid = self.context.uid
directory = self.context._dirobj.browse(cr, uid, self.dir_id) directory = self.context._dirobj.browse(cr, uid, self.dir_id)
res = False res = False
if not directory: if not directory:
raise OSError(2, 'Not such file or directory.') raise OSError(2, 'Not such file or directory.')
if directory._table_name=='document.directory': if directory._table_name=='document.directory':
if self.children(cr): if self.children(cr):
raise OSError(39, 'Directory not empty.') raise OSError(39, 'Directory not empty.')
@ -300,12 +295,12 @@ class node_dir(node_database):
return res return res
def create_child_collection(self, cr, objname): def create_child_collection(self, cr, objname):
object2 = False object2 = False
dirobj = self.context._dirobj dirobj = self.context._dirobj
uid = self.context.uid uid = self.context.uid
ctx = self.context.context.copy() ctx = self.context.context.copy()
ctx.update(self.dctx) ctx.update(self.dctx)
obj = dirobj.browse(cr, uid, self.dir_id) obj = dirobj.browse(cr, uid, self.dir_id)
if obj and (obj.type == 'ressource') and not object2: if obj and (obj.type == 'ressource') and not object2:
raise OSError(1, 'Operation not permited.') raise OSError(1, 'Operation not permited.')
@ -315,11 +310,11 @@ class node_dir(node_database):
'ressource_parent_type_id': obj and obj.ressource_type_id.id or False, 'ressource_parent_type_id': obj and obj.ressource_type_id.id or False,
'ressource_id': object2 and object2.id or False, 'ressource_id': object2 and object2.id or False,
'parent_id' : obj and obj.id or False 'parent_id' : obj and obj.id or False
} }
return dirobj.create(cr, uid, val) return dirobj.create(cr, uid, val)
def create_child(self,cr,path,data): def create_child(self,cr,path,data):
""" API function to create a child file object and node """ API function to create a child file object and node
Return the node_* created Return the node_* created
@ -353,8 +348,8 @@ class node_dir(node_database):
if self.write_date: if self.write_date:
wtime = time.mktime(time.strptime(self.write_date, '%Y-%m-%d %H:%M:%S')) wtime = time.mktime(time.strptime(self.write_date, '%Y-%m-%d %H:%M:%S'))
else: wtime = time.time() else: wtime = time.time()
return str(wtime) return str(wtime)
def _get_ttag(self,cr): def _get_ttag(self,cr):
return 'dir-%d' % self.dir_id return 'dir-%d' % self.dir_id
@ -379,13 +374,13 @@ class node_res_dir(node_class):
self.resm_id = dirr.ressource_id self.resm_id = dirr.ressource_id
self.namefield = dirr.resource_field.name or 'name' self.namefield = dirr.resource_field.name or 'name'
self.displayname = dirr.name self.displayname = dirr.name
# Important: the domain is evaluated using the *parent* dctx! # Important: the domain is evaluated using the *parent* dctx!
self.domain = dirr.domain self.domain = dirr.domain
self.ressource_tree = dirr.ressource_tree self.ressource_tree = dirr.ressource_tree
# and then, we add our own vars in the dctx: # and then, we add our own vars in the dctx:
if dctx: if dctx:
self.dctx.update(dctx) self.dctx.update(dctx)
# and then, we prepare a dctx dict, for deferred evaluation: # and then, we prepare a dctx dict, for deferred evaluation:
self.dctx_dict = {} self.dctx_dict = {}
for dfld in dirr.dctx_ids: for dfld in dirr.dctx_ids:
@ -394,7 +389,7 @@ class node_res_dir(node_class):
def children(self, cr, domain=None): def children(self, cr, domain=None):
return self._child_get(cr, domain=domain) return self._child_get(cr, domain=domain)
def child(self,cr, name, domain=None): def child(self,cr, name, domain=None):
res = self._child_get(cr, name, domain=domain) res = self._child_get(cr, name, domain=domain)
if res: if res:
return res[0] return res[0]
@ -403,7 +398,7 @@ class node_res_dir(node_class):
def _child_get(self,cr, name = None, domain=None): def _child_get(self,cr, name = None, domain=None):
""" return virtual children of resource, based on the """ return virtual children of resource, based on the
foreign object. foreign object.
Note that many objects use NULL for a name, so we should Note that many objects use NULL for a name, so we should
better call the name_search(),name_get() set of methods better call the name_search(),name_get() set of methods
""" """
@ -420,28 +415,28 @@ class node_res_dir(node_class):
where += safe_eval(self.domain, self.dctx) where += safe_eval(self.domain, self.dctx)
if self.resm_id: if self.resm_id:
where.append(('id','=',self.resm_id)) where.append(('id','=',self.resm_id))
if name: if name:
where.append((self.namefield,'=',name)) where.append((self.namefield,'=',name))
# print "Where clause for %s" % self.res_model, where # print "Where clause for %s" % self.res_model, where
if self.ressource_tree: if self.ressource_tree:
object2 = False object2 = False
if self.resm_id: if self.resm_id:
object2 = dirobj.pool.get(self.res_model).browse(cr, uid, self.resm_id) or False object2 = dirobj.pool.get(self.res_model).browse(cr, uid, self.resm_id) or False
if obj._parent_name in obj.fields_get(cr, uid): if obj._parent_name in obj.fields_get(cr, uid):
where.append((obj._parent_name,'=',object2 and object2.id or False)) where.append((obj._parent_name,'=',object2 and object2.id or False))
resids = obj.search(cr,uid, where, context=ctx) resids = obj.search(cr,uid, where, context=ctx)
res = [] res = []
for bo in obj.browse(cr,uid,resids,context=ctx): for bo in obj.browse(cr,uid,resids,context=ctx):
if not bo: if not bo:
continue continue
name = getattr(bo,self.namefield) name = getattr(bo,self.namefield)
if not name: if not name:
continue continue
# Yes! we can't do better but skip nameless records. # Yes! we can't do better but skip nameless records.
res.append(node_res_obj(name, self.dir_id, self, self.context, self.res_model, bo)) res.append(node_res_obj(name, self.dir_id, self, self.context, self.res_model, bo))
return res return res
@ -458,7 +453,7 @@ class node_res_obj(node_class):
def __init__(self, path, dir_id, parent, context, res_model, res_bo, res_id = None): def __init__(self, path, dir_id, parent, context, res_model, res_bo, res_id = None):
super(node_res_obj,self).__init__(path, parent,context) super(node_res_obj,self).__init__(path, parent,context)
assert parent assert parent
#todo: more info from dirr #todo: more info from dirr
self.dir_id = dir_id self.dir_id = dir_id
self.mimetype = 'application/x-directory' self.mimetype = 'application/x-directory'
# 'httpd/unix-directory' # 'httpd/unix-directory'
@ -468,15 +463,15 @@ class node_res_obj(node_class):
self.content_length = 0 self.content_length = 0
self.res_model = res_model self.res_model = res_model
self.domain = parent.domain self.domain = parent.domain
self.displayname = path self.displayname = path
self.dctx_dict = parent.dctx_dict self.dctx_dict = parent.dctx_dict
if res_bo: if res_bo:
self.res_id = res_bo.id self.res_id = res_bo.id
dc2 = self.context.context dc2 = self.context.context
dc2.update(self.dctx) dc2.update(self.dctx)
dc2['res_model'] = res_model dc2['res_model'] = res_model
dc2['res_id'] = res_bo.id dc2['res_id'] = res_bo.id
dc2['this'] = res_bo dc2['this'] = res_bo
for fld,expr in self.dctx_dict.items(): for fld,expr in self.dctx_dict.items():
try: try:
self.dctx[fld] = safe_eval(expr,dc2) self.dctx[fld] = safe_eval(expr,dc2)
@ -487,11 +482,14 @@ class node_res_obj(node_class):
else: else:
self.res_id = res_id self.res_id = res_id
def children(self, cr, domain=None): def children(self, cr, domain=None):
return self._child_get(cr, domain=domain) + self._file_get(cr) return self._child_get(cr, domain=domain) + self._file_get(cr)
def child(self,cr, name, domain=None): def child(self,cr, name):
res = self._child_get(cr, name, domain=domain) res = self._child_get(cr,name)
def child(self,cr, name, domain=None):
res = self._child_get(cr, name, domain=domain)
if res: if res:
return res[0] return res[0]
res = self._file_get(cr,name) res = self._file_get(cr,name)
@ -546,7 +544,7 @@ class node_res_obj(node_class):
return ('vevent-collection','http://groupdav.org/') return ('vevent-collection','http://groupdav.org/')
return None return None
def _child_get(self,cr, name=None, domain=None): def _child_get(self,cr, name=None, domain=None):
dirobj = self.context._dirobj dirobj = self.context._dirobj
uid = self.context.uid uid = self.context.uid
ctx = self.context.context.copy() ctx = self.context.context.copy()
@ -554,38 +552,38 @@ class node_res_obj(node_class):
directory = dirobj.browse(cr, uid, self.dir_id) directory = dirobj.browse(cr, uid, self.dir_id)
obj = dirobj.pool.get(self.res_model) obj = dirobj.pool.get(self.res_model)
where = [] where = []
res = [] res = []
if name: if name:
where.append(('name','=',name)) where.append(('name','=',name))
# Directory Structure display in tree structure # Directory Structure display in tree structure
if self.res_id and directory.ressource_tree: if self.res_id and directory.ressource_tree:
where1 = [] where1 = []
if obj._parent_name in obj.fields_get(cr, uid): if obj._parent_name in obj.fields_get(cr, uid):
where1 = where + [(obj._parent_name, '=', self.res_id)] where1 = where + [(obj._parent_name, '=', self.res_id)]
resids = obj.search(cr,uid, where1, context=ctx) resids = obj.search(cr,uid, where1, context=ctx)
for bo in obj.browse(cr,uid,resids,context=ctx): for bo in obj.browse(cr,uid,resids,context=ctx):
namefield = directory.resource_field.name or 'name' namefield = directory.resource_field.name or 'name'
if not bo: if not bo:
continue continue
res_name = getattr(bo, namefield) res_name = getattr(bo, namefield)
if not res_name: if not res_name:
continue continue
res.append(node_res_obj(res_name, self.dir_id, self, self.context, self.res_model, res_bo = bo)) res.append(node_res_obj(res_name, self.dir_id, self, self.context, self.res_model, res_bo = bo))
where2 = where + [('parent_id','=',self.dir_id) ] where2 = where + [('parent_id','=',self.dir_id) ]
ids = dirobj.search(cr, uid, where2, context=ctx) ids = dirobj.search(cr, uid, where2, context=ctx)
for dirr in dirobj.browse(cr, uid, ids, context=ctx): for dirr in dirobj.browse(cr, uid, ids, context=ctx):
if dirr.type == 'directory': if dirr.type == 'directory':
res.append(node_res_obj(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = None, res_id = self.res_id)) res.append(node_res_obj(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = None, res_id = self.res_id))
elif dirr.type == 'ressource': elif dirr.type == 'ressource':
# child resources can be controlled by properly set dctx # child resources can be controlled by properly set dctx
res.append(node_res_dir(dirr.name,self,self.context, dirr, {'active_id': self.res_id})) res.append(node_res_dir(dirr.name,self,self.context, dirr, {'active_id': self.res_id}))
fil_obj = dirobj.pool.get('ir.attachment') fil_obj = dirobj.pool.get('ir.attachment')
where3 = where2 + [('res_model', '=', self.res_model), ('res_id','=',self.res_id)] where3 = where2 + [('res_model', '=', self.res_model), ('res_id','=',self.res_id)]
# print "where clause for dir_obj", where2 # print "where clause for dir_obj", where2
@ -593,20 +591,20 @@ class node_res_obj(node_class):
if ids: if ids:
for fil in fil_obj.browse(cr, uid, ids, context=ctx): for fil in fil_obj.browse(cr, uid, ids, context=ctx):
res.append(node_file(fil.name, self, self.context, fil)) res.append(node_file(fil.name, self, self.context, fil))
# Get Child Ressource Directories # Get Child Ressource Directories
if directory.ressource_type_id and directory.ressource_type_id.id: if directory.ressource_type_id and directory.ressource_type_id.id:
where4 = where + [('ressource_parent_type_id','=',directory.ressource_type_id.id)] where4 = where + [('ressource_parent_type_id','=',directory.ressource_type_id.id)]
where5 = where4 + [('ressource_id','=',0)] where5 = where4 + [('ressource_id','=',0)]
dirids = dirobj.search(cr,uid, where5) dirids = dirobj.search(cr,uid, where5)
where5 = where4 + [('ressource_id','=',self.res_id)] where5 = where4 + [('ressource_id','=',self.res_id)]
dirids = dirids + dirobj.search(cr,uid, where5) dirids = dirids + dirobj.search(cr,uid, where5)
for dirr in dirobj.browse(cr, uid, dirids, context=ctx): for dirr in dirobj.browse(cr, uid, dirids, context=ctx):
if dirr.type == 'directory' and not dirr.parent_id: if dirr.type == 'directory' and not dirr.parent_id:
res.append(node_res_obj(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = None, res_id = self.res_id)) res.append(node_res_obj(dirr.name, dirr.id, self, self.context, self.res_model, res_bo = None, res_id = self.res_id))
if dirr.type == 'ressource': if dirr.type == 'ressource':
res.append(node_res_dir(dirr.name, self, self.context, dirr, {'active_id': self.res_id})) res.append(node_res_dir(dirr.name, self, self.context, dirr, {'active_id': self.res_id}))
return res return res
def create_child_collection(self, cr, objname): def create_child_collection(self, cr, objname):
@ -614,26 +612,26 @@ class node_res_obj(node_class):
uid = self.context.uid uid = self.context.uid
ctx = self.context.context.copy() ctx = self.context.context.copy()
ctx.update(self.dctx) ctx.update(self.dctx)
res_obj = dirobj.pool.get(self.context.context['res_model']) res_obj = dirobj.pool.get(self.context.context['res_model'])
object2 = res_obj.browse(cr, uid, self.context.context['res_id']) or False object2 = res_obj.browse(cr, uid, self.context.context['res_id']) or False
obj = dirobj.browse(cr, uid, self.dir_id) obj = dirobj.browse(cr, uid, self.dir_id)
if obj and (obj.type == 'ressource') and not object2: if obj and (obj.type == 'ressource') and not object2:
raise OSError(1, 'Operation not permited.') raise OSError(1, 'Operation not permited.')
val = { val = {
'name': objname, 'name': objname,
'ressource_parent_type_id': obj and obj.ressource_type_id.id or False, 'ressource_parent_type_id': obj and obj.ressource_type_id.id or False,
'ressource_id': object2 and object2.id or False, 'ressource_id': object2 and object2.id or False,
'parent_id' : False 'parent_id' : False
} }
if (obj and (obj.type in ('directory'))) or not object2: if (obj and (obj.type in ('directory'))) or not object2:
val['parent_id'] = obj and obj.id or False val['parent_id'] = obj and obj.id or False
return dirobj.create(cr, uid, val) return dirobj.create(cr, uid, val)
def create_child(self,cr,path,data): def create_child(self,cr,path,data):
""" API function to create a child file object and node """ API function to create a child file object and node
Return the node_* created Return the node_* created
@ -673,41 +671,41 @@ class node_file(node_class):
self.write_date = fil.write_date or fil.create_date self.write_date = fil.write_date or fil.create_date
self.content_length = fil.file_size self.content_length = fil.file_size
self.displayname = fil.name self.displayname = fil.name
# This only propagates the problem to get_data. Better # This only propagates the problem to get_data. Better
# fix those files to point to the root dir. # fix those files to point to the root dir.
if fil.parent_id: if fil.parent_id:
self.storage_id = fil.parent_id.storage_id.id self.storage_id = fil.parent_id.storage_id.id
else: else:
self.storage_id = None self.storage_id = None
def open(self, cr, mode=False): def open(self, cr, mode=False):
uid = self.context.uid uid = self.context.uid
if self.type in ('collection','database'): if self.type in ('collection','database'):
return False return False
fobj = self.context._dirobj.pool.get('ir.attachment').browse(cr, uid, self.file_id, context=self.context.context) fobj = self.context._dirobj.pool.get('ir.attachment').browse(cr, uid, self.file_id, context=self.context.context)
if fobj.store_method and fobj.store_method== 'fs' : if fobj.store_method and fobj.store_method== 'fs' :
s = StringIO.StringIO(self.get_data(cr, fobj)) s = StringIO.StringIO(self.get_data(cr, fobj))
else: else:
s = StringIO.StringIO(base64.decodestring(fobj.db_datas or '')) s = StringIO.StringIO(base64.decodestring(fobj.db_datas or ''))
s.name = self s.name = self
return s return s
def rm(self, cr): def rm(self, cr):
uid = self.context.uid uid = self.context.uid
document_obj = self.context._dirobj.pool.get('ir.attachment') document_obj = self.context._dirobj.pool.get('ir.attachment')
if self.type in ('collection','database'): if self.type in ('collection','database'):
return False return False
document = document_obj.browse(cr, uid, self.file_id, context=self.context.context) document = document_obj.browse(cr, uid, self.file_id, context=self.context.context)
res = False res = False
if document and document._table_name == 'ir.attachment': if document and document._table_name == 'ir.attachment':
res = document_obj.unlink(cr, uid, [document.id]) res = document_obj.unlink(cr, uid, [document.id])
return res return res
def fix_ppath(self, cr, fbro): def fix_ppath(self, cr, fbro):
"""Sometimes we may init this w/o path, parent. """Sometimes we may init this w/o path, parent.
This function fills the missing path from the file browse object This function fills the missing path from the file browse object
Note: this may be an expensive operation, do on demand. However, Note: this may be an expensive operation, do on demand. However,
once caching is in, we might want to do that at init time and keep once caching is in, we might want to do that at init time and keep
this object anyway this object anyway
@ -716,7 +714,7 @@ class node_file(node_class):
return return
assert fbro assert fbro
uid = self.context.uid uid = self.context.uid
dirpath = [] dirpath = []
if fbro.parent_id: if fbro.parent_id:
dirobj = self.context._dirobj.pool.get('document.directory') dirobj = self.context._dirobj.pool.get('document.directory')
@ -725,14 +723,14 @@ class node_file(node_class):
dirpath.append(fbro.datas_fname) dirpath.append(fbro.datas_fname)
else: else:
dirpath.append(fbro.name) dirpath.append(fbro.name)
if len(dirpath)>1: if len(dirpath)>1:
self.path = dirpath self.path = dirpath
else: else:
self.path = dirpath[0] self.path = dirpath[0]
def get_data(self, cr, fil_obj = None): def get_data(self, cr, fil_obj = None):
""" Retrieve the data for some file. """ Retrieve the data for some file.
fil_obj may optionally be specified, and should be a browse object fil_obj may optionally be specified, and should be a browse object
for the file. This is useful when the caller has already initiated for the file. This is useful when the caller has already initiated
the browse object. """ the browse object. """
@ -742,7 +740,7 @@ class node_file(node_class):
data_obj = self.context._dirobj.pool.get('ir.model.data') data_obj = self.context._dirobj.pool.get('ir.model.data')
data_id = data_obj._get_id(cr, self.context.uid, 'document', 'storage_db') data_id = data_obj._get_id(cr, self.context.uid, 'document', 'storage_db')
if data_id: if data_id:
stor = data_obj.browse(cr, self.context.uid, data_id, context=self.context.context).res_id stor = data_obj.browse(cr, self.context.uid, data_id, context=self.context.context).res_id
assert stor assert stor
stobj = self.context._dirobj.pool.get('document.storage') stobj = self.context._dirobj.pool.get('document.storage')
return stobj.get_data(cr,self.context.uid,stor, self,self.context.context, fil_obj) return stobj.get_data(cr,self.context.uid,stor, self,self.context.context, fil_obj)
@ -755,7 +753,7 @@ class node_file(node_class):
return self.content_length return self.content_length
def set_data(self, cr, data, fil_obj = None): def set_data(self, cr, data, fil_obj = None):
""" Store data at some file. """ Store data at some file.
fil_obj may optionally be specified, and should be a browse object fil_obj may optionally be specified, and should be a browse object
for the file. This is useful when the caller has already initiated for the file. This is useful when the caller has already initiated
the browse object. """ the browse object. """
@ -765,7 +763,7 @@ class node_file(node_class):
data_obj = self.context._dirobj.pool.get('ir.model.data') data_obj = self.context._dirobj.pool.get('ir.model.data')
data_id = data_obj._get_id(cr, self.context.uid, 'document', 'storage_db') data_id = data_obj._get_id(cr, self.context.uid, 'document', 'storage_db')
if data_id: if data_id:
stor = data_obj.browse(cr, self.context.uid, data_id, context=self.context.context).res_id stor = data_obj.browse(cr, self.context.uid, data_id, context=self.context.context).res_id
assert stor assert stor
stobj = self.context._dirobj.pool.get('document.storage') stobj = self.context._dirobj.pool.get('document.storage')
return stobj.set_data(cr,self.context.uid,stor, self, data, self.context.context, fil_obj) return stobj.set_data(cr,self.context.uid,stor, self, data, self.context.context, fil_obj)
@ -792,20 +790,20 @@ class node_content(node_class):
def open(self, cr, mode=False): def open(self, cr, mode=False):
uid = self.context.uid uid = self.context.uid
if self.type in ('collection','database'): if self.type in ('collection','database'):
return False return False
pool = self.context._dirobj.pool pool = self.context._dirobj.pool
res = getattr(pool.get('document.directory.content'), 'process_read')(cr, uid, self) res = getattr(pool.get('document.directory.content'), 'process_read')(cr, uid, self)
res = StringIO.StringIO(res) res = StringIO.StringIO(res)
res.name = self res.name = self
return res return res
def fill_fields(self,cr,dctx = None): def fill_fields(self,cr,dctx = None):
""" Try to read the object and fill missing fields, like mimetype, """ Try to read the object and fill missing fields, like mimetype,
dates etc. dates etc.
This function must be different from the constructor, because This function must be different from the constructor, because
it uses the db cursor. it uses the db cursor.
""" """
cr.execute('SELECT DISTINCT mimetype FROM document_directory_content_type WHERE active AND code = %s;', cr.execute('SELECT DISTINCT mimetype FROM document_directory_content_type WHERE active AND code = %s;',
(self.extension,)) (self.extension,))
res = cr.fetchall() res = cr.fetchall()
@ -835,3 +833,149 @@ class node_content(node_class):
def _get_ttag(self,cr): def _get_ttag(self,cr):
return 'cnt-%d%s' % (self.cnt_id,(self.act_id and ('-' + str(self.act_id))) or '') return 'cnt-%d%s' % (self.cnt_id,(self.act_id and ('-' + str(self.act_id))) or '')
class old_class(osv.osv):
# the old code, remove..
def __init__(self, cr, uid, path, object, object2=False, context={}, content=False, type='collection', root=False):
self.cr = cr
def _file_get(self, nodename=False):
if not self.object:
return []
pool = pooler.get_pool(self.cr.dbname)
fobj = pool.get('ir.attachment')
res2 = []
where = []
if self.object2:
where.append( ('res_model','=',self.object2._name) )
where.append( ('res_id','=',self.object2.id) )
else:
where.append( ('parent_id','=',self.object.id) )
where.append( ('res_id','=',False) )
if nodename:
where.append( (fobj._rec_name,'=',nodename) )
for content in self.object.content_ids:
res3 = content._table._file_get(self,nodename,content)
if res3:
res2.extend(res3)
ids = fobj.search(self.cr, self.uid, where+[ ('parent_id','=',self.object and self.object.id or False) ])
if self.object and self.root and (self.object.type=='ressource'):
ids += fobj.search(self.cr, self.uid, where+[ ('parent_id','=',False) ])
res = fobj.browse(self.cr, self.uid, ids, context=self.context)
return map(lambda x: node_class(self.cr, self.uid, self.path+'/'+eval('x.'+fobj._rec_name), x, False, context=self.context, type='file', root=False), res) + res2
def get_translation(self,value,lang):
# Must go, it works on arbitrary models and could be ambiguous.
result = value
pool = pooler.get_pool(self.cr.dbname)
translation_ids = pool.get('ir.translation').search(self.cr, self.uid, [('value','=',value),('lang','=',lang),('type','=','model')])
if len(translation_ids):
tran_id = translation_ids[0]
translation = pool.get('ir.translation').read(self.cr, self.uid, tran_id, ['res_id','name'])
res_model,field_name = tuple(translation['name'].split(','))
res_id = translation['res_id']
res = pool.get(res_model).read(self.cr, self.uid, res_id, [field_name])
if res:
result = res[field_name]
return result
def directory_list_for_child(self,nodename,parent=False):
pool = pooler.get_pool(self.cr.dbname)
where = []
if nodename:
nodename = self.get_translation(nodename, self.context['lang'])
where.append(('name','=',nodename))
if (self.object and self.object.type=='directory') or not self.object2:
where.append(('parent_id','=',self.object and self.object.id or False))
else:
where.append(('parent_id','=',False))
if self.object:
where.append(('ressource_parent_type_id','=',self.object.ressource_type_id.id))
else:
where.append(('ressource_parent_type_id','=',False))
ids = pool.get('document.directory').search(self.cr, self.uid, where+[('ressource_id','=',0)])
if self.object2:
ids += pool.get('document.directory').search(self.cr, self.uid, where+[('ressource_id','=',self.object2.id)])
res = pool.get('document.directory').browse(self.cr, self.uid, ids, self.context)
return res
def _child_get(self, nodename=False):
if self.type not in ('collection','database'):
return []
res = self.directory_list_for_child(nodename)
result= map(lambda x: node_class(self.cr, self.uid, self.path+'/'+x.name, x, x.type=='directory' and self.object2 or False, context=self.context, root=self.root), res)
if self.type=='database':
pool = pooler.get_pool(self.cr.dbname)
fobj = pool.get('ir.attachment')
vargs = [('parent_id','=',False),('res_id','=',False)]
if nodename:
vargs.append((fobj._rec_name,'=',nodename))
file_ids=fobj.search(self.cr,self.uid,vargs)
res = fobj.browse(self.cr, self.uid, file_ids, context=self.context)
result +=map(lambda x: node_class(self.cr, self.uid, self.path+'/'+eval('x.'+fobj._rec_name), x, False, context=self.context, type='file', root=self.root), res)
if self.type=='collection' and self.object.type=="ressource":
where = self.object.domain and eval(self.object.domain, {'active_id':self.root, 'uid':self.uid}) or []
pool = pooler.get_pool(self.cr.dbname)
obj = pool.get(self.object.ressource_type_id.model)
_dirname_field = obj._rec_name
if len(obj.fields_get(self.cr, self.uid, ['dirname'])):
_dirname_field = 'dirname'
name_for = obj._name.split('.')[-1]
if nodename and nodename.find(name_for) == 0 :
id = int(nodename.replace(name_for,''))
where.append(('id','=',id))
elif nodename:
if nodename.find('__') :
nodename=nodename.replace('__','/')
for invalid in INVALID_CHARS:
if nodename.find(INVALID_CHARS[invalid]) :
nodename=nodename.replace(INVALID_CHARS[invalid],invalid)
nodename = self.get_translation(nodename, self.context['lang'])
where.append((_dirname_field,'=',nodename))
if self.object.ressource_tree:
if obj._parent_name in obj.fields_get(self.cr,self.uid):
where.append((obj._parent_name,'=',self.object2 and self.object2.id or False))
ids = obj.search(self.cr, self.uid, where)
res = obj.browse(self.cr, self.uid, ids,self.context)
result+= map(lambda x: node_class(self.cr, self.uid, self.path+'/'+x.name.replace('/','__'), self.object, x, context=self.context, root=x.id), res)
return result
else :
if self.object2:
return result
else:
if self.object2:
return result
ids = obj.search(self.cr, self.uid, where)
res = obj.browse(self.cr, self.uid, ids,self.context)
for r in res:
if len(obj.fields_get(self.cr, self.uid, [_dirname_field])):
r.name = eval('r.'+_dirname_field)
else:
r.name = False
if not r.name:
r.name = name_for + '%d'%r.id
for invalid in INVALID_CHARS:
if r.name.find(invalid) :
r.name = r.name.replace(invalid,INVALID_CHARS[invalid])
result2 = map(lambda x: node_class(self.cr, self.uid, self.path+'/'+x.name.replace('/','__'), self.object, x, context=self.context, root=x.id), res)
if result2:
if self.object.ressource_tree:
result += result2
else:
result = result2
return result
def path_get(self):
path = self.path
if self.path[0]=='/':
path = self.path[1:]
return path
old_class()

View File

@ -71,6 +71,19 @@
<field name="employee_id" widget="selection"/> <field name="employee_id" widget="selection"/>
</group> </group>
<newline/> <newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Employee" name="employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<filter string="Rating" icon="terp-hr" context="{'group_by':'rating'}"/>
<separator orientation="vertical"/>
<filter string="Plan" icon="terp-hr" context="{'group_by':'plan_id'}"/>
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'create_date'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-hr" <filter icon="terp-hr"
string="Done" string="Done"
@ -87,18 +100,6 @@
<field name="create_date"/> <field name="create_date"/>
<field name="closed"/> <field name="closed"/>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Employee" name="employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<filter string="Rating" icon="terp-hr" context="{'group_by':'rating'}"/>
<separator orientation="vertical"/>
<filter string="Plan" icon="terp-hr" context="{'group_by':'plan_id'}"/>
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'create_date'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -80,6 +80,20 @@
domain="[('user_id','=',False)]"/> domain="[('user_id','=',False)]"/>
</field> </field>
</group> </group>
<group expand="1" string="Group By...">
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<filter string="Employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<filter string="Company" icon="terp-hr" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
<filter string="Product" icon="terp-hr" context="{'group_by':'product_id'}"/>
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
<filter string="Force Journal" icon="terp-hr" context="{'group_by':'journal_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'date'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
<newline/> <newline/>
<group expand="0" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter string="Invoiced" <filter string="Invoiced"
@ -105,21 +119,6 @@
<field name="date_confirm"/> <field name="date_confirm"/>
<field name="date_valid"/> <field name="date_valid"/>
</group> </group>
<newline/>
<group expand="1" string="Group By...">
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<filter string="Employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
<filter string="Company" icon="terp-hr" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
<filter string="Product" icon="terp-hr" context="{'group_by':'product_id'}"/>
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
<filter string="Force Journal" icon="terp-hr" context="{'group_by':'journal_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'date'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -232,7 +232,7 @@
help="My Department"/> help="My Department"/>
</field> </field>
<newline/> <newline/>
<group expand="0" string="Group By..." colspan="11" col="20"> <group expand="1" string="Group By..." colspan="11" col="20">
<filter string="Department" icon="terp-project" domain="[]" context="{'group_by':'department_id'}"/> <filter string="Department" icon="terp-project" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Responsible" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/> <filter string="Responsible" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/> <separator orientation="vertical"/>

View File

@ -90,8 +90,23 @@
domain="[('user_id','=',False)]"/> domain="[('user_id','=',False)]"/>
</field> </field>
</group> </group>
<group expand="1" string="Group By ..." colspan="10" col="12">
<filter string="User" name='User' icon="terp-hr" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-hr" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Stage" name="Stage" icon="terp-hr" domain="[]" context="{'group_by':'stage_id'}" />
<separator orientation="vertical"/>
<filter string="State" icon="terp-hr" domain="[]" context="{'group_by':'state'}"/>
<filter string="Jobs" icon="terp-sale" domain="[]" context="{'group_by':'job_id'}"/>
<filter string="Department" icon="terp-hr" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Degree" icon="terp-hr" domain="[]" context="{'group_by':'type_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" name = "day" icon="terp-hr" domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" domain="[]" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" domain="[]" context="{'group_by':'year'}"/>
</group>
<newline/> <newline/>
<group expand="1" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-hr" <filter icon="terp-hr"
string="Hired" string="Hired"
name="done" name="done"
@ -108,22 +123,7 @@
<field name="date"/> <field name="date"/>
<field name="date_closed"/> <field name="date_closed"/>
</group> </group>
<newline/> </search>
<group expand="1" string="Group By ..." colspan="10" col="12">
<filter string="User" name='User' icon="terp-hr" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-hr" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Stage" name="Stage" icon="terp-hr" domain="[]" context="{'group_by':'stage_id'}" />
<separator orientation="vertical"/>
<filter string="State" icon="terp-hr" domain="[]" context="{'group_by':'state'}"/>
<filter string="Jobs" icon="terp-sale" domain="[]" context="{'group_by':'job_id'}"/>
<filter string="Department" icon="terp-hr" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Degree" icon="terp-hr" domain="[]" context="{'group_by':'type_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" name = "day" icon="terp-hr" domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" domain="[]" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" domain="[]" context="{'group_by':'year'}"/>
</group>
</search>
</field> </field>
</record> </record>

View File

@ -69,24 +69,24 @@
<field name="account_id"/> <field name="account_id"/>
<field name="product_id"/> <field name="product_id"/>
</group> </group>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Account" icon="terp-hr" context="{'group_by':'account_id'}"/>
<filter string="Product" icon="terp-hr" context="{'group_by':'product_id'}"/>
<filter string="Invoice" icon="terp-hr" context="{'group_by':'invoice_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'name'}"/>
</group>
<newline/> <newline/>
<group expand="0" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<field name="date"/> <field name="date"/>
<separator orientation="vertical"/> <separator orientation="vertical"/>
<field name="invoice_id" widget="selection"/> <field name="invoice_id" widget="selection"/>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Account" icon="terp-hr" context="{'group_by':'account_id'}"/>
<filter string="Product" icon="terp-hr" context="{'group_by':'product_id'}"/>
<filter string="Invoice" icon="terp-hr" context="{'group_by':'invoice_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'name'}"/>
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -75,6 +75,17 @@
</field> </field>
<field name="company_id" widget="selection" groups="base.group_multi_company"/> <field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group> </group>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-hr" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'date_current'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
<newline/> <newline/>
<group expand="0" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-hr" <filter icon="terp-hr"
@ -86,18 +97,6 @@
<field name="date_from"/> <field name="date_from"/>
<field name="date_to"/> <field name="date_to"/>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="User" name="User" icon="terp-hr" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-hr" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-hr" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" context="{'group_by':'date_current'}"/>
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -57,7 +57,22 @@
<field name="date_planned"/> <field name="date_planned"/>
</group> </group>
<newline/> <newline/>
<group expand="1" string="Extended options..." colspan="10" col="12">
<group expand="1" string="Group By..." colspan="4" col="6">
<filter string="Source Location" icon="terp-mrp" context="{'group_by':'location_src_id'}"/>
<filter string="Destination Location" icon="terp-mrp" context="{'group_by':'location_dest_id'}"/>
<filter string="Picking" icon="terp-mrp" context="{'group_by':'picking_id'}"/>
<separator orientation="vertical"/>
<filter string="Routing" icon="terp-mrp" context="{'group_by':'routing_id'}"/>
<filter string="Product" name="Product" icon="terp-mrp" context="{'group_by':'product_id'}" />
<filter string="State" icon="terp-mrp" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="BOM" icon="terp-mrp" context="{'group_by':'bom_id'}"/>
<filter string="Month" icon="terp-mrp" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-mrp" context="{'group_by':'name'}"/>
</group>
<group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-mrp" string="Draft" domain="[('state','=','draft')]"/> <filter icon="terp-mrp" string="Draft" domain="[('state','=','draft')]"/>
<filter icon="terp-mrp" string="Picking Exception" domain="[('state','=','picking_except')]"/> <filter icon="terp-mrp" string="Picking Exception" domain="[('state','=','picking_except')]"/>
<separator orientation="vertical"/> <separator orientation="vertical"/>
@ -78,20 +93,7 @@
<field name="date_finnished"/> <field name="date_finnished"/>
</group> </group>
<newline/> <newline/>
<group expand="1" string="Group By..." colspan="4" col="6"> </search>
<filter string="Source Location" icon="terp-mrp" context="{'group_by':'location_src_id'}"/>
<filter string="Destination Location" icon="terp-mrp" context="{'group_by':'location_dest_id'}"/>
<filter string="Picking" icon="terp-mrp" context="{'group_by':'picking_id'}"/>
<separator orientation="vertical"/>
<filter string="Routing" icon="terp-mrp" context="{'group_by':'routing_id'}"/>
<filter string="Product" name="Product" icon="terp-mrp" context="{'group_by':'product_id'}" />
<filter string="State" icon="terp-mrp" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="BOM" icon="terp-mrp" context="{'group_by':'bom_id'}"/>
<filter string="Month" icon="terp-mrp" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-mrp" context="{'group_by':'name'}"/>
</group>
</search>
</field> </field>
</record> </record>
<record id="action_report_mrp_production_order" model="ir.actions.act_window"> <record id="action_report_mrp_production_order" model="ir.actions.act_window">

View File

@ -10,13 +10,14 @@
multi="True" multi="True"
id="bi_conf_cube_query_builder"/> id="bi_conf_cube_query_builder"/>
<wizard
<!-- <wizard
string="Load Tables" string="Load Tables"
model="olap.schema" model="olap.schema"
name="olap.load.table" name="olap.load.table"
menu= "False" menu= "False"
multi="True" multi="True"
id="bi_menu_olap_load_table"/> id="bi_menu_olap_load_table"/>-->
<wizard <wizard

View File

@ -53,7 +53,7 @@ def get_cube(self, cr, uid, context):
pool = pooler.get_pool(cr.dbname).get('olap.cube') pool = pooler.get_pool(cr.dbname).get('olap.cube')
ids = pool.search(cr, uid, []) ids = pool.search(cr, uid, [])
res = pool.read(cr, uid, ids, ['schema_id','name'], context) res = pool.read(cr, uid, ids, ['schema_id','name'], context)
res=[(r['schema_id'], r['name']) for r in res] res=[(r['schema_id'][0], r['name']) for r in res]
return res return res
@ -63,7 +63,7 @@ def get_details(self, cr, uid,data, context):
""" """
pool = pooler.get_pool(cr.dbname).get('olap.cube') pool = pooler.get_pool(cr.dbname).get('olap.cube')
search_id=data['form']['cube_schema'][0] search_id=data['form']['cube_schema']
ids=pool.search(cr,uid,[('schema_id','=',search_id)]) ids=pool.search(cr,uid,[('schema_id','=',search_id)])
@ -162,7 +162,7 @@ def _execute_mdx(self, cr, uid, data, context):
log=Log() log=Log()
pool = pooler.get_pool(cr.dbname).get('olap.schema') pool = pooler.get_pool(cr.dbname).get('olap.schema')
ids = pool.search(cr, uid, [('database_id','=',data['form']['cube_schema'][0])]) ids = pool.search(cr, uid, [('database_id','=',data['form']['cube_schema'])])
res1 = pool.read(cr, uid, ids,['name'], context) res1 = pool.read(cr, uid, ids,['name'], context)
""" """

View File

@ -17,11 +17,6 @@
<field name="default_code" select="1"/> <field name="default_code" select="1"/>
<field name="name" select="1"/> <field name="name" select="1"/>
<field name="categ_id" select="1" widget="selection" operator="child_of"/> <field name="categ_id" select="1" widget="selection" operator="child_of"/>
<newline/>
<group col='8' colspan='14' expand="1" string="Extended options...">
<field name="pricelist_id" select="1" widget="selection" context="{'pricelist': self}" />
</group>
<newline/>
<group col='8' colspan='15' expand='1' string='Group by...'> <group col='8' colspan='15' expand='1' string='Group by...'>
<filter string='Category' icon="terp-stock" domain="[]" context="{'group_by' : 'categ_id'}" /> <filter string='Category' icon="terp-stock" domain="[]" context="{'group_by' : 'categ_id'}" />
<separator orientation="vertical"/> <separator orientation="vertical"/>
@ -29,6 +24,15 @@
<separator orientation="vertical"/> <separator orientation="vertical"/>
<filter string='Type' icon="terp-stock" domain="[]" context="{'group_by' : 'type'}" /> <filter string='Type' icon="terp-stock" domain="[]" context="{'group_by' : 'type'}" />
</group> </group>
<newline/>
<group col='8' colspan='14' expand="0" string="Extended options...">
<field name="pricelist_id" select="1" widget="selection" context="{'pricelist': self}" />
</group>
<newline/>
<group col='8' colspan='14' expand="0" string="Extended options..." groups="base.group_extended">
<field name="pricelist_id" select="1" widget="selection" context="{'pricelist': self}" />
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -95,6 +95,20 @@
domain="[('project_id','=',False"/> domain="[('project_id','=',False"/>
</field> </field>
</group> </group>
<group expand="1" string="Group By..." colspan="10" col="11">
<filter string="User" name="User" icon="terp-project" context="{'group_by':'user_id'}" />
<filter string="Project" icon="terp-project" context="{'group_by':'project_id'}"/>
<filter string="Partner" icon="terp-project" context="{'group_by':'partner_id'}" />
<filter string="Task" icon="terp-project" context="{'group_by':'name'}" />
<separator orientation="vertical"/>
<filter string="State" icon="terp-project" context="{'group_by':'state'}"/>
<filter string="Company" icon="terp-project" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Stage" icon="terp-project" context="{'group_by':'type'}" />
<separator orientation="vertical"/>
<filter string="Day" icon="terp-project" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-project" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-project" context="{'group_by':'year'}"/>
</group>
<newline/> <newline/>
<group expand="0" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter string="Done" <filter string="Done"
@ -114,21 +128,6 @@
<field name="date_start"/> <field name="date_start"/>
<field name="date_end"/> <field name="date_end"/>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="11">
<filter string="User" name="User" icon="terp-project" context="{'group_by':'user_id'}" />
<filter string="Project" icon="terp-project" context="{'group_by':'project_id'}"/>
<filter string="Partner" icon="terp-project" context="{'group_by':'partner_id'}" />
<filter string="Task" icon="terp-project" context="{'group_by':'name'}" />
<separator orientation="vertical"/>
<filter string="State" icon="terp-project" context="{'group_by':'state'}"/>
<filter string="Company" icon="terp-project" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Stage" icon="terp-project" context="{'group_by':'type'}" />
<separator orientation="vertical"/>
<filter string="Day" icon="terp-project" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-project" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-project" context="{'group_by':'year'}"/>
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -95,8 +95,51 @@
</field> </field>
<field name="user_id" select="1" widget="selection"/> <field name="user_id" select="1" widget="selection"/>
</group> </group>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<filter string="Stage" icon="terp-sale" domain="[]" context="{'group_by':'stage_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" icon="terp-sale" domain="[]" context="{'group_by':'project_id'}" />
<filter string="Priority" icon="terp-sale" domain="[]" context="{'group_by':'priority'}" />
<separator orientation="vertical"/>
<filter string="Type" icon="terp-sale" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="Task" icon="terp-sale" domain="[]" context="{'group_by':'task_id'}"/>
<newline/>
<filter string="Assigned To" icon="terp-sale" domain="[]" context="{'group_by':'assigned_to'}"/>
<filter string="Partner" icon="terp-sale" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Channel" icon="terp-sale" domain="[]" context="{'group_by':'canal_id'}"/>
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
<newline/> <newline/>
<group expand="1" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-sale" <filter icon="terp-sale"
string="Done" string="Done"
domain="[('state','=','done')]"/> domain="[('state','=','done')]"/>
@ -127,49 +170,6 @@
</group> </group>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="8">
<filter string="User" name="User" icon="terp-sale"
domain="[]" context="{'group_by':'user_id'}" />
<filter string="Company" icon="terp-sale"
domain="[]"
context="{'group_by':'company_id'}" />
<filter string="Section" icon="terp-sale"
domain="[]"
context="{'group_by':'section_id'}" />
<separator orientation="vertical" />
<filter string="State" icon="terp-sale"
domain="[]" context="{'group_by':'state'}" />
<filter string="Category" icon="terp-sale"
domain="[]" context="{'group_by':'categ_id'}" />
<filter string="Stage" icon="terp-sale" domain="[]" context="{'group_by':'stage_id'}"/>
<separator orientation="vertical"/>
<filter string="Project" icon="terp-sale" domain="[]" context="{'group_by':'project_id'}" />
<filter string="Priority" icon="terp-sale" domain="[]" context="{'group_by':'priority'}" />
<separator orientation="vertical"/>
<filter string="Type" icon="terp-sale" domain="[]" context="{'group_by':'type_id'}"/>
<filter string="Task" icon="terp-sale" domain="[]" context="{'group_by':'task_id'}"/>
<newline/>
<filter string="Assigned To" icon="terp-sale" domain="[]" context="{'group_by':'assigned_to'}"/>
<filter string="Partner" icon="terp-sale" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Channel" icon="terp-sale" domain="[]" context="{'group_by':'canal_id'}"/>
<separator orientation="vertical" />
<filter string="Day" icon="terp-sale"
domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale"
domain="[]" context="{'group_by':'month'}" />
<filter string="Year" icon="terp-sale"
domain="[]" context="{'group_by':'name'}" />
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -81,6 +81,21 @@
<field name="product_id"/> <field name="product_id"/>
</group> </group>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Company" icon="terp-purchase" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Warehouse" icon="terp-purchase" context="{'group_by':'warehouse_id'}"/>
<filter string="Location" icon="terp-purchase" context="{'group_by':'location_id'}"/>
<filter string="Responsible" name="Responsible" icon="terp-purchase" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-purchase" context="{'group_by':'product_id'}"/>
<filter string="Partner" name="partner_id" icon="terp-purchase" context="{'group_by':'partner_id'}"/>
<filter string="State" icon="terp-purchase" context="{'group_by':'state'}"/>
<filter string="Fiscal Position" icon="terp-purchase" context="{'group_by':'fiscal_position'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-purchase" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-purchase" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-purchase" context="{'group_by':'name'}"/>
</group>
<newline/> <newline/>
<group expand="0" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-purchase" string="Shipping Exception" domain="[('state','=','shipping_except')]"/> <filter icon="terp-purchase" string="Shipping Exception" domain="[('state','=','shipping_except')]"/>
@ -97,22 +112,6 @@
<field name="company_id" groups="base.group_multi_company" widget="selection"/> <field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="date"/> <field name="date"/>
</group> </group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Company" icon="terp-purchase" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Warehouse" icon="terp-purchase" context="{'group_by':'warehouse_id'}"/>
<filter string="Location" icon="terp-purchase" context="{'group_by':'location_id'}"/>
<filter string="Responsible" name="Responsible" icon="terp-purchase" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-purchase" context="{'group_by':'product_id'}"/>
<filter string="Partner" name="partner_id" icon="terp-purchase" context="{'group_by':'partner_id'}"/>
<filter string="State" icon="terp-purchase" context="{'group_by':'state'}"/>
<filter string="Fiscal Position" icon="terp-purchase" context="{'group_by':'fiscal_position'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-purchase" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-purchase" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-purchase" context="{'group_by':'name'}"/>
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -80,6 +80,21 @@
<field name="partner_id"/> <field name="partner_id"/>
<field name="product_id"/> <field name="product_id"/>
</group> </group>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Company" icon="terp-sale" groups="base.group_multi_company" context="{'group_by':'company_id'}"/>
<filter string="Shop" icon="terp-sale" context="{'group_by':'shop_id'}"/>
<filter string="Salesman" icon="terp-sale" name="User" context="{'group_by':'user_id'}"/>
<filter string="Fiscal Position" icon="terp-sale" context="{'group_by':'fiscal_position'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-sale" context="{'group_by':'product_id'}"/>
<filter string="Partner" icon="terp-sale" context="{'group_by':'partner_id'}"/>
<filter string="Payment Term" icon="terp-sale" context="{'group_by':'payment_term'}"/>
<filter string="State" icon="terp-sale" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-sale" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale" context="{'group_by':'date'}"/>
<filter string="Year" icon="terp-sale" context="{'group_by':'year'}"/>
</group>
<newline/> <newline/>
<group expand="0" string="Extended options..." colspan="10" col="12"> <group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-sale" string="Shipping Exception" domain="[('state','=','shipping_except')]"/> <filter icon="terp-sale" string="Shipping Exception" domain="[('state','=','shipping_except')]"/>
@ -96,23 +111,7 @@
<field name="company_id" groups="base.group_multi_company" widget="selection"/> <field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="date"/> <field name="date"/>
</group> </group>
<newline/>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="Company" icon="terp-sale" groups="base.group_multi_company" context="{'group_by':'company_id'}"/>
<filter string="Shop" icon="terp-sale" context="{'group_by':'shop_id'}"/>
<filter string="Salesman" icon="terp-sale" name="User" context="{'group_by':'user_id'}"/>
<filter string="Fiscal Position" icon="terp-sale" context="{'group_by':'fiscal_position'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-sale" context="{'group_by':'product_id'}"/>
<filter string="Partner" icon="terp-sale" context="{'group_by':'partner_id'}"/>
<filter string="Payment Term" icon="terp-sale" context="{'group_by':'payment_term'}"/>
<filter string="State" icon="terp-sale" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-sale" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-sale" context="{'group_by':'date'}"/>
<filter string="Year" icon="terp-sale" context="{'group_by':'year'}"/>
</group>
</search> </search>
</field> </field>
</record> </record>

View File

@ -14,8 +14,8 @@
<page string="Sales &amp; Purchases" position="inside"> <page string="Sales &amp; Purchases" position="inside">
<group colspan="4" col="4" groups="base.group_extended"> <group colspan="4" col="4" groups="base.group_extended">
<separator string="Stock Properties" colspan="4"/> <separator string="Stock Properties" colspan="4"/>
<field name="property_stock_customer" widget="selection" domain="[('usage','=','customer')]" /> <field name="property_stock_customer" widget="selection" domain="[('usage','=','customer')]" groups="base.group_extended" />
<field name="property_stock_supplier" widget="selection" domain="[('usage','=','supplier')]"/> <field name="property_stock_supplier" widget="selection" domain="[('usage','=','supplier')]" groups="base.group_extended"/>
</group> </group>
</page> </page>
</field> </field>