[MERGE] Sync with trunk.
bzr revid: tde@openerp.com-20121115131824-60tl5f9hvxpca827 bzr revid: tde@openerp.com-20121115181930-ypj3zbdhg9bvcdf5
This commit is contained in:
commit
99c1145d81
|
@ -377,9 +377,8 @@ class account_asset_depreciation_line(osv.osv):
|
|||
move_line_obj = self.pool.get('account.move.line')
|
||||
currency_obj = self.pool.get('res.currency')
|
||||
created_move_ids = []
|
||||
asset_ids = []
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if currency_obj.is_zero(cr, uid, line.asset_id.currency_id, line.remaining_value):
|
||||
can_close = True
|
||||
depreciation_date = time.strftime('%Y-%m-%d')
|
||||
period_ids = period_obj.find(cr, uid, depreciation_date, context=context)
|
||||
company_currency = line.asset_id.company_id.currency_id.id
|
||||
|
@ -409,8 +408,8 @@ class account_asset_depreciation_line(osv.osv):
|
|||
'period_id': period_ids and period_ids[0] or False,
|
||||
'journal_id': journal_id,
|
||||
'partner_id': partner_id,
|
||||
'currency_id': company_currency <> current_currency and current_currency or False,
|
||||
'amount_currency': company_currency <> current_currency and - sign * line.amount or 0.0,
|
||||
'currency_id': company_currency != current_currency and current_currency or False,
|
||||
'amount_currency': company_currency != current_currency and - sign * line.amount or 0.0,
|
||||
'date': depreciation_date,
|
||||
})
|
||||
move_line_obj.create(cr, uid, {
|
||||
|
@ -423,16 +422,19 @@ class account_asset_depreciation_line(osv.osv):
|
|||
'period_id': period_ids and period_ids[0] or False,
|
||||
'journal_id': journal_id,
|
||||
'partner_id': partner_id,
|
||||
'currency_id': company_currency <> current_currency and current_currency or False,
|
||||
'amount_currency': company_currency <> current_currency and sign * line.amount or 0.0,
|
||||
'currency_id': company_currency != current_currency and current_currency or False,
|
||||
'amount_currency': company_currency != current_currency and sign * line.amount or 0.0,
|
||||
'analytic_account_id': line.asset_id.category_id.account_analytic_id.id,
|
||||
'date': depreciation_date,
|
||||
'asset_id': line.asset_id.id
|
||||
})
|
||||
self.write(cr, uid, line.id, {'move_id': move_id}, context=context)
|
||||
created_move_ids.append(move_id)
|
||||
if can_close:
|
||||
asset_obj.write(cr, uid, [line.asset_id.id], {'state': 'close'}, context=context)
|
||||
asset_ids.append(line.asset_id.id)
|
||||
# we re-evaluate the assets to determine whether we can close them
|
||||
for asset in asset_obj.browse(cr, uid, list(set(asset_ids)), context=context):
|
||||
if currency_obj.is_zero(cr, uid, asset.currency_id, asset.value_residual):
|
||||
asset.write({'state': 'close'})
|
||||
return created_move_ids
|
||||
|
||||
account_asset_depreciation_line()
|
||||
|
|
|
@ -201,6 +201,20 @@ class users(osv.osv):
|
|||
# Return early if no one has a login name like that.
|
||||
return False
|
||||
|
||||
# Check if the authentification is made with OpenID. In this case, don't encrypt the password
|
||||
cr.execute('SELECT id FROM ir_module_module WHERE name = \'auth_openid\' and state = \'installed\'')
|
||||
if cr.rowcount:
|
||||
cr.execute( 'SELECT password, id FROM res_users WHERE login=%s AND openid_key = %s AND active',
|
||||
(login.encode('utf-8'),password.encode('utf-8')))
|
||||
if cr.rowcount:
|
||||
# Check if the encrypted password matches against the one in the db.
|
||||
cr.execute("""UPDATE res_users SET login_date=now() AT TIME ZONE 'UTC' WHERE id=%s AND openid_key=%s AND active RETURNING id""",
|
||||
(int(id), password.encode('utf-8')))
|
||||
res = cr.fetchone()
|
||||
cr.commit()
|
||||
if res:
|
||||
return res[0]
|
||||
|
||||
stored_pw = self.maybe_encrypt(cr, stored_pw, id)
|
||||
|
||||
if not stored_pw:
|
||||
|
|
|
@ -25,6 +25,21 @@ from osv import osv
|
|||
from osv import fields
|
||||
|
||||
|
||||
def _reopen(self, res_id, model):
|
||||
return {'type': 'ir.actions.act_window',
|
||||
'view_mode': 'form',
|
||||
'view_type': 'form',
|
||||
'res_id': res_id,
|
||||
'res_model': self._name,
|
||||
'target': 'new',
|
||||
# save original model in context, because selecting the list of available
|
||||
# templates requires a model in context
|
||||
'context': {
|
||||
'default_model': model,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class mail_compose_message(osv.TransientModel):
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
|
@ -42,10 +57,8 @@ class mail_compose_message(osv.TransientModel):
|
|||
else:
|
||||
model = context.get('default_model', context.get('active_model'))
|
||||
|
||||
if model:
|
||||
record_ids = email_template_obj.search(cr, uid, [('model', '=', model)], context=context)
|
||||
return email_template_obj.name_get(cr, uid, record_ids, context) + [(False, '')]
|
||||
return []
|
||||
record_ids = email_template_obj.search(cr, uid, [('model', '=', model)], context=context)
|
||||
return email_template_obj.name_get(cr, uid, record_ids, context) + [(False, '')]
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
|
@ -109,7 +122,7 @@ class mail_compose_message(osv.TransientModel):
|
|||
onchange_res['partner_ids'] = [(4, partner_id) for partner_id in onchange_res.pop('partner_ids', [])]
|
||||
onchange_res['attachment_ids'] = [(4, attachment_id) for attachment_id in onchange_res.pop('attachment_ids', [])]
|
||||
record.write(onchange_res)
|
||||
return True
|
||||
return _reopen(self, record.id, record.model)
|
||||
|
||||
def onchange_use_template(self, cr, uid, ids, use_template, template_id, composition_mode, model, res_id, context=None):
|
||||
""" onchange_use_template (values: True or False). If use_template is
|
||||
|
@ -141,8 +154,8 @@ class mail_compose_message(osv.TransientModel):
|
|||
'attachment_ids': [(6, 0, [att.id for att in record.attachment_ids])]
|
||||
}
|
||||
template_id = email_template.create(cr, uid, values, context=context)
|
||||
record.write({'template_id': template_id, 'use_template': True})
|
||||
return True
|
||||
record.write(record.onchange_template_id(True, template_id, record.composition_mode, record.model, record.res_id)['value'])
|
||||
return _reopen(self, record.id, record.model)
|
||||
|
||||
#------------------------------------------------------
|
||||
# Wizard validation and send
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
</xpath>
|
||||
<xpath expr="//footer" position="inside">
|
||||
<group class="oe_right" col="1">
|
||||
<div>Use template
|
||||
<div attrs="{'invisible':[('use_template','=',False)]}">Use template
|
||||
<field name="template_id" attrs="{'invisible':[('use_template','=',False)]}"
|
||||
nolabel="1"
|
||||
on_change="onchange_template_id(use_template, template_id, composition_mode, model, res_id, context)"/>
|
||||
</div>
|
||||
or
|
||||
<button icon="/email_template/static/src/img/email_template_save.png"
|
||||
type="object" name="save_as_template" string="Save as new template" class="oe_link"
|
||||
help="Save as a new template"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<field name="subtype_id" ref="mail.mt_comment"/>
|
||||
<field name="subject">Welcome to OpenERP!</field>
|
||||
<field name="body"><![CDATA[<p>Your homepage is a summary of messages you received and key information about documents you follow.</p><p>
|
||||
The top menu bar contains all applications you installed. You can use this <i>Settings</i> menu to install more applications, activate others features or give access to new users.</p><p>
|
||||
The top menu bar contains all applications you installed. You can use the <i>Settings</i> menu to install more applications, activate others features or give access to new users.</p><p>
|
||||
To setup your preferences (name, email signature, avatar), click on the top right corner.</p>]]></field>
|
||||
</record>
|
||||
</data>
|
||||
|
|
|
@ -130,7 +130,7 @@ class mail_group(osv.Model):
|
|||
params = {
|
||||
'search_view_id': search_ref and search_ref[1] or False,
|
||||
'domain': [('model', '=', 'mail.group'), ('res_id', '=', mail_group_id)],
|
||||
'context': {'default_model': 'mail.group', 'default_res_id': mail_group_id},
|
||||
'context': {'default_model': 'mail.group', 'default_res_id': mail_group_id, 'search_default_message_unread': True},
|
||||
'res_model': 'mail.message',
|
||||
'thread_level': 1,
|
||||
'header_description': vals.get('description'),
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<field name="res_model">mail.message</field>
|
||||
<field name="context">{
|
||||
'default_model': 'res.users',
|
||||
'default_res_id': uid
|
||||
'default_res_id': uid,
|
||||
}</field>
|
||||
<field name="params" eval=""{
|
||||
'domain': [
|
||||
|
|
|
@ -55,9 +55,10 @@ class res_partner_mail(osv.Model):
|
|||
if type == 'email':
|
||||
partner_ids = kwargs.get('partner_ids', [])
|
||||
if thread_id not in partner_ids:
|
||||
partner_ids.append(thread_id)
|
||||
partner_ids.append((4, thread_id))
|
||||
kwargs['partner_ids'] = partner_ids
|
||||
return super(res_partner_mail, self).message_post(cr, uid, False, body=body, subject=subject,
|
||||
thread_id = False
|
||||
return super(res_partner_mail, self).message_post(cr, uid, thread_id, body=body, subject=subject,
|
||||
type=type, subtype=subtype, parent_id=parent_id, attachments=attachments, context=context, **kwargs)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -113,7 +113,8 @@ class res_users(osv.Model):
|
|||
alias_pool.unlink(cr, uid, alias_ids, context=context)
|
||||
return res
|
||||
|
||||
def message_post_api(self, cr, uid, thread_id, body='', subject=False, parent_id=False, attachment_ids=None, context=None):
|
||||
def message_post_user_api(self, cr, uid, thread_id, body='', subject=False, parent_id=False,
|
||||
attachment_ids=None, context=None, content_subtype='plaintext', **kwargs):
|
||||
""" Redirect the posting of message on res.users to the related partner.
|
||||
This is done because when giving the context of Chatter on the
|
||||
various mailboxes, we do not have access to the current partner_id.
|
||||
|
@ -124,8 +125,8 @@ class res_users(osv.Model):
|
|||
if isinstance(thread_id, (list, tuple)):
|
||||
thread_id = thread_id[0]
|
||||
partner_id = self.pool.get('res.users').read(cr, uid, thread_id, ['partner_id'], context=context)['partner_id'][0]
|
||||
return self.pool.get('res.partner').message_post_api(cr, uid, partner_id, body=body, subject=subject,
|
||||
parent_id=parent_id, attachment_ids=attachment_ids, context=context)
|
||||
return self.pool.get('res.partner').message_post_user_api(cr, uid, partner_id, body=body, subject=subject,
|
||||
parent_id=parent_id, attachment_ids=attachment_ids, context=context, content_subtype=content_subtype, **kwargs)
|
||||
|
||||
def message_post(self, cr, uid, thread_id, context=None, **kwargs):
|
||||
""" Redirect the posting of message on res.users to the related partner.
|
||||
|
@ -145,6 +146,7 @@ class res_users(osv.Model):
|
|||
return self.pool.get('res.partner').message_update(cr, uid, [partner_id], msg_dict,
|
||||
update_vals=update_vals, context=context)
|
||||
|
||||
|
||||
class res_users_mail_group(osv.Model):
|
||||
""" Update of res.users class
|
||||
- if adding groups to an user, check mail.groups linked to this user
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
border-collapse: separate;
|
||||
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
|
||||
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
|
||||
box-shadow: 0 1px 4px 3px rgba(0, 0, 0, 0.4);
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
|
||||
-o-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ openerp.mail = function (session) {
|
|||
*/
|
||||
var context_keys = ['default_template_id', 'default_composition_mode',
|
||||
'default_use_template', 'default_partner_ids', 'default_model',
|
||||
'default_res_id', 'default_content_subtype', , 'default_subject',
|
||||
'default_res_id', 'default_content_subtype', 'default_subject',
|
||||
'default_body', 'active_id', 'lang', 'bin_raw', 'tz',
|
||||
'active_model', 'edi_web_url_view', 'active_ids',
|
||||
'default_attachment_ids']
|
||||
|
@ -521,8 +521,6 @@ openerp.mail = function (session) {
|
|||
on_compose_fullmail: function (default_composition_mode) {
|
||||
if (default_composition_mode == 'reply') {
|
||||
var context = {
|
||||
'default_model': this.context.default_model,
|
||||
'default_res_id': this.context.default_res_id,
|
||||
'default_composition_mode': default_composition_mode,
|
||||
'default_parent_id': this.id,
|
||||
'default_body': mail.ChatterUtils.get_text2html(this.$el ? (this.$el.find('textarea:not(.oe_compact)').val() || '') : ''),
|
||||
|
@ -532,7 +530,6 @@ openerp.mail = function (session) {
|
|||
var context = {
|
||||
'default_model': this.context.default_model,
|
||||
'default_res_id': this.context.default_res_id,
|
||||
'default_content_subtype': 'html',
|
||||
'default_composition_mode': default_composition_mode,
|
||||
'default_parent_id': this.id,
|
||||
'default_body': mail.ChatterUtils.get_text2html(this.$el ? (this.$el.find('textarea:not(.oe_compact)').val() || '') : ''),
|
||||
|
@ -1709,7 +1706,6 @@ openerp.mail = function (session) {
|
|||
views: [[false, 'form']],
|
||||
target: 'new',
|
||||
context: {
|
||||
'default_content_subtype': 'html',
|
||||
},
|
||||
};
|
||||
session.client.action_manager.do_action(action);
|
||||
|
@ -1743,7 +1739,7 @@ openerp.mail = function (session) {
|
|||
view_type: 'form',
|
||||
views: [[false, 'form']],
|
||||
target: 'new',
|
||||
context: { 'default_content_subtype': 'html' },
|
||||
context: {},
|
||||
};
|
||||
session.client.action_manager.do_action(action);
|
||||
},
|
||||
|
|
|
@ -96,14 +96,6 @@
|
|||
</t>
|
||||
</t>
|
||||
|
||||
<t t-name="mail.thread.message.private">
|
||||
<div>
|
||||
<span class="oe_placeholder_checkbox_private"/>
|
||||
<span class="oe_send_private">This email is private.</span>
|
||||
<span class="oe_send_public">I wrote for contacts and all my followers.</span>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<!--
|
||||
template to the recipients list
|
||||
-->
|
||||
|
|
|
@ -463,7 +463,8 @@ class test_mail(test_mail_mockup.TestMailMockups):
|
|||
# 1. Comment group_pigs with body_text and subject
|
||||
compose_id = mail_compose.create(cr, uid,
|
||||
{'subject': _subject, 'body_text': _body_text, 'partner_ids': [(4, p_c_id), (4, p_d_id)]},
|
||||
{'default_composition_mode': 'comment', 'default_model': 'mail.group', 'default_res_id': self.group_pigs_id})
|
||||
{'default_composition_mode': 'comment', 'default_model': 'mail.group', 'default_res_id': self.group_pigs_id,
|
||||
'default_content_subtype': 'plaintext'})
|
||||
compose = mail_compose.browse(cr, uid, compose_id)
|
||||
# Test: mail.compose.message: composition_mode, model, res_id
|
||||
self.assertEqual(compose.composition_mode, 'comment', 'mail.compose.message incorrect composition_mode')
|
||||
|
|
|
@ -114,7 +114,7 @@ class mail_compose_message(osv.TransientModel):
|
|||
|
||||
_defaults = {
|
||||
'composition_mode': 'comment',
|
||||
'content_subtype': lambda self, cr, uid, ctx={}: 'plain',
|
||||
'content_subtype': lambda self, cr, uid, ctx={}: 'html',
|
||||
'body_text': lambda self, cr, uid, ctx={}: False,
|
||||
'body': lambda self, cr, uid, ctx={}: '',
|
||||
'subject': lambda self, cr, uid, ctx={}: False,
|
||||
|
@ -135,7 +135,7 @@ class mail_compose_message(osv.TransientModel):
|
|||
related to.
|
||||
:param int res_id: id of the document record this mail is related to
|
||||
"""
|
||||
doc_name_get = self.pool.get(model).name_get(cr, uid, res_id, context=context)
|
||||
doc_name_get = self.pool.get(model).name_get(cr, uid, [res_id], context=context)
|
||||
if doc_name_get:
|
||||
record_name = doc_name_get[0][1]
|
||||
else:
|
||||
|
|
|
@ -38,6 +38,7 @@ Notes can be found in the 'Home' menu.
|
|||
'author': 'OpenERP SA',
|
||||
'website': 'http://openerp.com',
|
||||
'summary': 'Sticky notes, Collaborative, Memos',
|
||||
'sequence': 9,
|
||||
'depends': [
|
||||
'mail',
|
||||
],
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
'name': 'Todo Lists',
|
||||
'version': '1.0',
|
||||
'category': 'Project Management',
|
||||
'sequence': 9,
|
||||
'sequence': 100,
|
||||
'summary': 'Personal Tasks, Contexts, Timeboxes',
|
||||
'description': """
|
||||
Implement concepts of the "Getting Things Done" methodology
|
||||
|
|
|
@ -2,19 +2,19 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="project_project_1" model="project.project">
|
||||
<record id="project.project_project_1" model="project.project">
|
||||
<field name="use_issues" eval="True"/>
|
||||
</record>
|
||||
<record id="project_project_2" model="project.project">
|
||||
<record id="project.project_project_2" model="project.project">
|
||||
<field name="use_issues" eval="True"/>
|
||||
</record>
|
||||
<record id="project_project_3" model="project.project">
|
||||
<record id="project.project_project_3" model="project.project">
|
||||
<field name="use_issues" eval="True"/>
|
||||
</record>
|
||||
<record id="project_project_4" model="project.project">
|
||||
<record id="project.project_project_4" model="project.project">
|
||||
<field name="use_issues" eval="True"/>
|
||||
</record>
|
||||
<record id="project_project_5" model="project.project">
|
||||
<record id="project.project_project_5" model="project.project">
|
||||
<field name="use_issues" eval="True"/>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ openerp.web_linkedin = function(instance) {
|
|||
var tag = document.createElement('script');
|
||||
tag.type = 'text/javascript';
|
||||
tag.src = "http://platform.linkedin.com/in.js";
|
||||
tag.innerHTML = 'api_key : ' + self.api_key + '\nauthorize : true';
|
||||
tag.innerHTML = 'api_key : ' + self.api_key + '\nauthorize : true\nscope: r_network r_contactinfo';
|
||||
document.getElementsByTagName('head')[0].appendChild(tag);
|
||||
self.linkedin_added = true;
|
||||
$(tag).load(function() {
|
||||
|
@ -107,7 +107,7 @@ openerp.web_linkedin = function(instance) {
|
|||
}
|
||||
to_change.website = entity.websiteUrl;
|
||||
to_change.phone = false;
|
||||
_.each(entity.locations.values || [], function(el) {
|
||||
_.each((entity.locations || {}).values || [], function(el) {
|
||||
to_change.phone = el.contactInfo.phone1;
|
||||
});
|
||||
var children_def = $.Deferred();
|
||||
|
|
|
@ -54,12 +54,8 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
|
|||
},
|
||||
add: function (sc) {
|
||||
var self = this;
|
||||
this.dataset.create(sc, function (out) {
|
||||
self.trigger('display', {
|
||||
name : sc.name,
|
||||
id : out.result,
|
||||
res_id : sc.res_id
|
||||
});
|
||||
this.dataset.create(sc).then(function(out){
|
||||
self.trigger('load');
|
||||
});
|
||||
},
|
||||
display: function(sc) {
|
||||
|
|
Loading…
Reference in New Issue