[MERGE] forward port of branch 9.0 up to 3108a49

This commit is contained in:
Christophe Simonis
2016-04-26 14:11:20 +02:00
10 changed files with 22 additions and 10 deletions
@@ -17,8 +17,9 @@ class AccountInvoice(models.Model):
result = super(AccountInvoice, self).action_move_create()
for inv in self:
if inv.number:
if self.env['account.asset.asset'].sudo().search([('code', '=', inv.number)]):
raise Warning(_('You already have assets with the reference %s.\nPlease delete these assets before creating new ones for this invoice.') % (inv.number,))
asset_ids = self.env['account.asset.asset'].sudo().search([('invoice_id', '=', inv.id), ('company_id', '=', inv.company_id.id)])
if asset_ids:
asset_ids.write({'active': False})
inv.invoice_line_ids.asset_create()
return result
@@ -556,6 +556,7 @@
<field name="view_mode">kanban,tree,form</field>
<field name="view_id" ref="mail.view_document_file_kanban"/>
<field name="domain">[('res_model','=','hr.applicant')]</field>
<field name="context">{'create': False}</field>
<field name="help" type="html">
<p>
Search through resumes and motivation letters.
+8 -2
View File
@@ -741,7 +741,13 @@ class Message(models.Model):
ON channel_partner.channel_id = channel.id AND channel_partner.partner_id = (%%s)
WHERE m.id = ANY (%%s)""" % self._table, (self.env.user.partner_id.id, self.env.user.partner_id.id, self.ids,))
for mid, rmod, rid, author_id, parent_id, partner_id, channel_id in self._cr.fetchall():
message_values[mid] = {'model': rmod, 'res_id': rid, 'author_id': author_id, 'parent_id': parent_id, 'partner_id': partner_id, 'channel_id': channel_id}
message_values[mid] = {
'model': rmod,
'res_id': rid,
'author_id': author_id,
'parent_id': parent_id,
'notified': any((message_values[mid].get('notified'), partner_id, channel_id))
}
else:
self._cr.execute("""SELECT DISTINCT id, model, res_id, author_id, parent_id FROM "%s" WHERE id = ANY (%%s)""" % self._table, (self.ids,))
for mid, rmod, rid, author_id, parent_id in self._cr.fetchall():
@@ -780,7 +786,7 @@ class Message(models.Model):
other_ids = set(self.ids).difference(set(author_ids), set(notified_ids))
model_record_ids = _generate_model_record_ids(message_values, other_ids)
if operation in ['read', 'write']:
notified_ids = [mid for mid, message in message_values.iteritems() if message.get('partner_id') or message.get('channel_id')]
notified_ids = [mid for mid, message in message_values.iteritems() if message.get('notified')]
elif operation == 'create':
for doc_model, doc_ids in model_record_ids.items():
followers = self.env['mail.followers'].sudo().search([
+1 -1
View File
@@ -18,7 +18,7 @@ class crm_team(osv.Model):
res = dict.fromkeys(ids, 0)
domain = [
('team_id', 'in', ids),
('state', '=', 'manual'),
('invoice_status', '=', 'to invoice'),
]
amounts = obj.read_group(cr, uid, domain, ['amount_total', 'team_id'], ['team_id'], context=context)
for rec in amounts:
+1 -1
View File
@@ -15,7 +15,7 @@ class CrmTeam(models.Model):
def _get_default_team_id(self, user_id=None):
if not user_id:
user_id = self.env.uid
team_id = self.env['crm.team'].search(
team_id = self.env['crm.team'].sudo().search(
['|', ('user_id', '=', user_id), ('member_ids', 'in', [user_id])],
limit=1)
if not team_id and 'default_team_id' in self.env.context:
+1 -1
View File
@@ -44,7 +44,7 @@
</div>
<div class="form-group">
<div class="col-md-offset-3 col-sm-offset-4 col-sm-8 col-md-7">
<button class="btn btn-primary btn-lg o_website_form_send">Send</button>
<span class="btn btn-primary btn-lg o_website_form_send">Send</span>
<span id="o_website_form_result"></span>
</div>
</div>
@@ -47,6 +47,7 @@ odoo.define('website_form.animation', function (require) {
send: function(e) {
e.preventDefault(); // Prevent the default submit behavior
this.$target.find('.o_website_form_send').off(); // Prevent users from crazy clicking
var self = this;
@@ -211,6 +212,10 @@ odoo.define('website_form.animation', function (require) {
},
update_status: function(status) {
var self = this;
if (status != 'success') { // Restore send button behavior if result is an error
this.$target.find('.o_website_form_send').on('click',function(e) {self.send(e);});
}
this.$target.find('#o_website_form_result').replaceWith(qweb.render("website_form.status_" + status))
},
});
@@ -195,7 +195,7 @@
</div>
<div class="form-group">
<div class="col-md-offset-3 col-sm-offset-4 col-sm-8 col-md-7">
<button class="btn btn-primary btn-lg o_website_form_send">Submit</button>
<span class="btn btn-primary btn-lg o_website_form_send">Submit</span>
<span id="o_website_form_result"></span>
</div>
</div>
@@ -1,3 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_issues,project_issue,project_issue.model_project_issue,base.group_portal,1,0,0,0
access_case_section,crm_team,sales_team.model_crm_team,base.group_portal,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_issues project_issue project_issue.model_project_issue base.group_portal 1 0 0 0
access_case_section crm_team sales_team.model_crm_team base.group_portal 1 0 0 0
+1 -1
View File
@@ -300,7 +300,7 @@ class ir_http(osv.AbstractModel):
mimetype = obj.mimetype
elif filename:
mimetype = mimetypes.guess_type(filename)[0]
elif getattr(env[model]._fields[field], 'attachment', False):
if not mimetype and getattr(env[model]._fields[field], 'attachment', False):
# for binary fields, fetch the ir_attachement for mimetype check
attach_mimetype = env['ir.attachment'].search_read(domain=[('res_model', '=', model), ('res_id', '=', id), ('res_field', '=', field)], fields=['mimetype'], limit=1)
mimetype = attach_mimetype and attach_mimetype[0]['mimetype']