openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #01528
[Merge] lp:~xrg/openobject-addons/trunk-patch17-dev-atp into lp:~openerp-dev/openobject-addons/trunk-dev-addons1
xrg has proposed merging lp:~xrg/openobject-addons/trunk-patch17-dev-atp into lp:~openerp-dev/openobject-addons/trunk-dev-addons1.
Requested reviews:
OpenERP R&D Team (openerp-dev)
For more details, see:
https://code.launchpad.net/~xrg/openobject-addons/trunk-patch17-dev-atp/+merge/44578
Please use that one for merging
--
https://code.launchpad.net/~xrg/openobject-addons/trunk-patch17-dev-atp/+merge/44578
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~xrg/openobject-addons/trunk-patch17-dev-atp into lp:~openerp-dev/openobject-addons/trunk-dev-addons1.
=== modified file 'caldav/caldav_view.xml'
--- caldav/caldav_view.xml 2010-11-18 05:21:19 +0000
+++ caldav/caldav_view.xml 2010-12-23 14:43:06 +0000
@@ -168,6 +168,7 @@
<field name="res_model">basic.calendar</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
+ <field name="help">"Calendars" allow you to Customize calendar event and todo attribute with any of OpenERP model.Caledars provide iCal Import/Export functionality.Webdav server that provides remote access to calendar.Help You to synchronize Meeting with Calendars client.You can access Calendars using CalDAV clients, like sunbird, Calendar Evaluation, Mobile.</field>
</record>
<record id="action_caldav_view1" model="ir.actions.act_window.view">
=== modified file 'caldav/calendar.py'
--- caldav/calendar.py 2010-12-20 14:02:20 +0000
+++ caldav/calendar.py 2010-12-23 14:43:06 +0000
@@ -164,6 +164,8 @@
res[attr] = {}
res[attr]['field'] = field.field_id.name
res[attr]['type'] = field.field_id.ttype
+ if field.fn == 'datetime_utc':
+ res[attr]['type'] = 'utc'
if field.fn == 'hours':
res[attr]['type'] = "timedelta"
if res[attr]['type'] in ('one2many', 'many2many', 'many2one'):
@@ -254,7 +256,6 @@
@param name: Get Attribute Name
@param type: Get Attribute Type
"""
-
if self.__attribute__.get(name):
val = self.__attribute__.get(name).get(type, None)
valtype = self.__attribute__.get(name).get('type', None)
@@ -273,7 +274,6 @@
@param self: The object pointer,
@param type: Get Attribute Type
"""
-
for name in self.__attribute__:
if self.__attribute__[name]:
self.__attribute__[name][type] = None
@@ -446,6 +446,21 @@
dtfield.value = self.format_date_tz(parser.parse(data[map_field]), tzval.title())
else:
dtfield.value = parser.parse(data[map_field])
+
+ elif map_type == 'utc'and data[map_field]:
+ if tzval:
+ local = pytz.timezone (tzval.title())
+ naive = datetime.strptime (data[map_field], "%Y-%m-%d %H:%M:%S")
+ local_dt = naive.replace (tzinfo = local)
+ utc_dt = local_dt.astimezone (pytz.utc)
+ vevent.add(field).value = utc_dt
+ else:
+ utc_timezone = pytz.timezone ('UTC')
+ naive = datetime.strptime (data[map_field], "%Y-%m-%d %H:%M:%S")
+ local_dt = naive.replace (tzinfo = utc_timezone)
+ utc_dt = local_dt.astimezone (pytz.utc)
+ vevent.add(field).value = utc_dt
+
elif map_type == "timedelta":
vevent.add(field).value = timedelta(hours=data[map_field])
elif map_type == "many2one":
@@ -829,6 +844,7 @@
'fn': fields.selection([('field', 'Use the field'),
('const', 'Expression as constant'),
('hours', 'Interval in hours'),
+ ('datetime_utc', 'Datetime In UTC'),
], 'Function'),
'mapping': fields.text('Mapping'),
}
=== modified file 'crm_caldav/crm_caldav_data.xml'
--- crm_caldav/crm_caldav_data.xml 2010-11-24 04:53:34 +0000
+++ crm_caldav/crm_caldav_data.xml 2010-12-23 14:43:06 +0000
@@ -117,8 +117,8 @@
<record model="basic.calendar.fields" id="map_event_13">
<field name="name" ref="caldav.field_event_dtstamp"/>
<field name="type_id" ref="base_calendar.calendar_lines_event" />
- <field name="field_id" search="[('name','=','date'),('model_id.model','=','calendar.event')]" />
- <field name="fn">field</field>
+ <field name="field_id" search="[('name','=','write_date'),('model_id.model','=','crm.meeting')]" />
+ <field name="fn">datetime_utc</field>
</record>
<record model="basic.calendar.fields" id="map_event_14">
=== modified file 'crm_caldav/crm_caldav_setup.xml'
--- crm_caldav/crm_caldav_setup.xml 2010-11-22 11:42:07 +0000
+++ crm_caldav/crm_caldav_setup.xml 2010-12-23 14:43:06 +0000
@@ -176,8 +176,8 @@
<record id="basic_calendar_fields_24" model="basic.calendar.fields">
<field name="name" ref="caldav.field_event_dtstamp"/>
<field name="type_id" ref="basic_calendar_lines_vevent0"/>
- <field name="field_id" ref="base_calendar.field_calendar_event_date"/>
- <field name="fn">field</field>
+ <field name="field_id" ref="crm.field_crm_meeting_write_date"/>
+ <field name="fn">datetime_utc</field>
</record>
<record id="basic_calendar_fields_25" model="basic.calendar.fields">
<field name="name" ref="caldav.field_event_description"/>
=== modified file 'crm_claim/report/crm_claim_report.py'
--- crm_claim/report/crm_claim_report.py 2010-12-09 12:56:35 +0000
+++ crm_claim/report/crm_claim_report.py 2010-12-23 14:43:06 +0000
@@ -60,12 +60,14 @@
('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'create_date': fields.datetime('Create Date', readonly=True),
+ 'email': fields.integer('# Emails', size=128, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', readonly=True, domain="[('type','=','claim')]"),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.claim')]", readonly=True),
+ 'probability': fields.float('Probability',digits=(16,2),readonly=True, group_operator="avg"),
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'priority': fields.selection(AVAILABLE_PRIORITIES, 'Priority'),
@@ -101,6 +103,7 @@
count(*) as nbr,
c.priority as priority,
c.type_action as type_action,
+ (SELECT count(id) FROM mailgate_message WHERE model='crm.claim' AND res_id=id AND history=True) AS email,
date_trunc('day',c.create_date) as create_date,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close,
extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected
=== modified file 'crm_claim/report/crm_claim_report_view.xml'
--- crm_claim/report/crm_claim_report_view.xml 2010-12-09 12:56:35 +0000
+++ crm_claim/report/crm_claim_report_view.xml 2010-12-23 14:43:06 +0000
@@ -18,6 +18,7 @@
<field name="partner_id" invisible="1"/>
<field name="day" invisible="1"/>
<field name="nbr" string="#Claim" sum="#Claim"/>
+ <field name="email" sum="# Mails"/>
<field name="delay_close" avg="Avg Closing Delay"/>
<field name="delay_expected"/>
<field name="state" invisible="1"/>
=== modified file 'document/document.py'
--- document/document.py 2010-12-06 13:11:02 +0000
+++ document/document.py 2010-12-23 14:43:06 +0000
@@ -35,6 +35,36 @@
class document_file(osv.osv):
_inherit = 'ir.attachment'
_rec_name = 'datas_fname'
+
+ def _attach_parent_id(self, cr, uid, ids=None, context=None):
+ """Migrate ir.attachments to the document module.
+
+ When the 'document' module is loaded on a db that has had plain attachments,
+ they will need to be attached to some parent folder, and be converted from
+ base64-in-bytea to raw-in-bytea format.
+ This function performs the internal migration, once and forever, for these
+ attachments. It cannot be done through the nominal ORM maintenance code,
+ because the root folder is only created after the document_data.xml file
+ is loaded.
+ It also establishes the parent_id NOT NULL constraint that ir.attachment
+ should have had (but would have failed if plain attachments contained null
+ values).
+ """
+
+ parent_id = self.pool.get('document.directory')._get_root_directory(cr,uid)
+ if not parent_id:
+ logging.getLogger('document').warning("at _attach_parent_id(), still not able to set the parent!")
+ return False
+
+ if ids is not None:
+ raise NotImplementedError("Ids is just there by convention! Don't use it yet, please.")
+
+ cr.execute("UPDATE ir_attachment " \
+ "SET parent_id = %s, db_datas = decode(encode(db_datas,'escape'), 'base64') " \
+ "WHERE parent_id IS NULL", (parent_id,))
+ cr.execute("ALTER TABLE ir_attachment ALTER parent_id SET NOT NULL")
+ return True
+
def _get_filestore(self, cr):
return os.path.join(DMS_ROOT_PATH, cr.dbname)
@@ -168,7 +198,7 @@
ids2 = []
for fbro in self.browse(cr, uid, ids, context=context):
if ('parent_id' not in vals or fbro.parent_id.id == vals['parent_id']) \
- and ('name' not in vals or fbro.name == vals['name']) :
+ and ('name' not in vals or fbro.name == vals['name']):
ids2.append(fbro.id)
continue
fnode = nctx.get_file_node(cr, fbro)
=== modified file 'document/document_data.xml'
--- document/document_data.xml 2010-10-27 10:24:28 +0000
+++ document/document_data.xml 2010-12-23 14:43:06 +0000
@@ -97,8 +97,11 @@
<field name="user_id" eval="False"/>
<field name="parent_id" ref="dir_root"/>
<field name="ressource_id">0</field>
-
</record>
+ <!-- After we have setup the root directory, migrate the attachments
+ to point to that. -->
+ <function model="ir.attachment" name="_attach_parent_id"/>
+
</data>
</openerp>
=== modified file 'document/std_index.py'
--- document/std_index.py 2010-11-12 10:14:16 +0000
+++ document/std_index.py 2010-12-23 14:43:06 +0000
@@ -95,13 +95,9 @@
return ['.doc']
def _doIndexFile(self,fname):
- fp = Popen(['antiword', fname], shell=False, stdout=PIPE).stdout
- try:
- file_data = _to_unicode(fp.read())
- finally:
- fp.close()
-
- return file_data
+ pop = Popen(['antiword', fname], shell=False, stdout=PIPE)
+ (data, _) = pop.communicate()
+ return _to_unicode(data)
cntIndex.register(DocIndex())
@@ -162,13 +158,9 @@
return ['.pdf']
def _doIndexFile(self,fname):
- fp = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE).stdout
- try:
- file_data = _to_unicode( fp.read())
- finally:
- fp.close()
-
- return file_data
+ pop = Popen(['pdftotext', '-enc', 'UTF-8', '-nopgbrk', fname, '-'], shell=False, stdout=PIPE)
+ (data, _) = pop.communicate()
+ return _to_unicode(data)
cntIndex.register(PdfIndex())
=== modified file 'document_ftp/wizard/ftp_configuration.py'
--- document_ftp/wizard/ftp_configuration.py 2010-12-06 13:11:02 +0000
+++ document_ftp/wizard/ftp_configuration.py 2010-12-23 14:43:06 +0000
@@ -44,6 +44,7 @@
# Update the action for FTP browse.
aid = data_pool._get_id(cr, uid, 'document_ftp', 'action_document_browse')
aid = data_pool.browse(cr, uid, aid, context=context).res_id
- self.pool.get('ir.actions.url').write(cr, uid, [aid], {'url': 'ftp://'+(conf.host or 'localhost:8021')+'/'})
+ self.pool.get('ir.actions.url').write(cr, uid, [aid],
+ {'url': 'ftp://'+(conf.host or 'localhost:8021')+'/' + cr.dbname+'/'})
document_ftp_configuration()
Follow ups