diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py
index 57f16473b82..0508a7cadfe 100644
--- a/addons/account/account_invoice.py
+++ b/addons/account/account_invoice.py
@@ -185,6 +185,7 @@ class account_invoice(osv.osv):
_columns = {
'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}),
+ 'supplier_invoice_number': fields.char('Supplier Invoice Number', size=64, help="The reference of this invoice as provided by the supplier.", readonly=True, states={'draft':[('readonly',False)]}),
'type': fields.selection([
('out_invoice','Customer Invoice'),
('in_invoice','Supplier Invoice'),
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index 1f0ce38a017..5ed373456f3 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -168,12 +168,15 @@
context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"
domain="[('supplier', '=', True)]"/>
-
-
-
@@ -445,7 +448,7 @@
account.invoice
-
+
diff --git a/addons/email_template/wizard/mail_compose_message_view.xml b/addons/email_template/wizard/mail_compose_message_view.xml
index a33135ca098..05d0e8dffa1 100644
--- a/addons/email_template/wizard/mail_compose_message_view.xml
+++ b/addons/email_template/wizard/mail_compose_message_view.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py
index 0c32ba27d6f..cedc0e004dd 100644
--- a/addons/mail/__openerp__.py
+++ b/addons/mail/__openerp__.py
@@ -89,6 +89,7 @@ Main Features
'static/lib/jquery.expander/jquery.expander.js',
'static/src/js/mail.js',
'static/src/js/mail_followers.js',
+ 'static/src/js/mail_uploader.js',
],
'qweb': [
'static/src/xml/mail.xml',
diff --git a/addons/mail/mail_message_view.xml b/addons/mail/mail_message_view.xml
index 4677beee511..efd1c581fe5 100644
--- a/addons/mail/mail_message_view.xml
+++ b/addons/mail/mail_message_view.xml
@@ -63,6 +63,9 @@
+
diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py
index 04da686b49d..af4818bcbcd 100644
--- a/addons/mail/mail_thread.py
+++ b/addons/mail/mail_thread.py
@@ -703,7 +703,7 @@ class mail_thread(osv.AbstractModel):
if attachments:
ir_attachment = self.pool.get('ir.attachment')
mail_message = self.pool.get('mail.message')
- attachment_ids = ir_attachment.search(cr, SUPERUSER_ID, [('res_model', '=', 'mail.message'), ('res_id', '=', 0), ('create_uid', '=', uid), ('id', 'in', attachments)], context=context)
+ attachment_ids = ir_attachment.search(cr, SUPERUSER_ID, [('res_model', '=', 'mail.compose.message'), ('res_id', '=', 0), ('create_uid', '=', uid), ('id', 'in', attachments)], context=context)
if attachment_ids:
ir_attachment.write(cr, SUPERUSER_ID, attachment_ids, {'res_model': self._name, 'res_id': thread_id}, context=context)
mail_message.write(cr, SUPERUSER_ID, [new_message_id], {'attachment_ids': [(6, 0, [pid for pid in attachment_ids])]}, context=context)
diff --git a/addons/mail/mail_thread_view.xml b/addons/mail/mail_thread_view.xml
index 5ef5e14b846..d674814e1be 100644
--- a/addons/mail/mail_thread_view.xml
+++ b/addons/mail/mail_thread_view.xml
@@ -39,7 +39,7 @@
-
diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css
index c4d1b6e2c28..36c56b161bd 100644
--- a/addons/mail/static/src/css/mail.css
+++ b/addons/mail/static/src/css/mail.css
@@ -181,6 +181,9 @@
.openerp .oe_mail .oe_msg_attachments .oe_attachment:nth-child(even){
background: #F4F5FA;
}
+.openerp .oe_mail .oe_msg_images {
+ display: block;
+}
.openerp .oe_mail .oe_msg_footer button{
display: inline;
height: 24px;
diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js
index 888af67857a..1adcbc4ad4c 100644
--- a/addons/mail/static/src/js/mail.js
+++ b/addons/mail/static/src/js/mail.js
@@ -175,7 +175,6 @@ openerp.mail = function(session) {
} else {
this.$render_compact.hide();
}
-
this.bind_events();
},
@@ -198,7 +197,6 @@ openerp.mail = function(session) {
/* when a user click on the upload button, send file read on_attachment_loaded
*/
on_attachment_change: function (event) {
- console.log('attach');
event.stopPropagation();
var self = this;
var $target = $(event.target);
@@ -276,26 +274,6 @@ openerp.mail = function(session) {
}
},
- /* to avoid having unsorted file on the server.
- we will show the users files of the first message post
- TDE note: unnecessary call to server I think
- */
- // set_free_attachments: function(){
- // var self=this;
- // this.parent_thread.ds_message.call('user_free_attachment').then(function(attachments){
- // this.attachment_ids=[];
- // for(var i in attachments){
- // self.attachment_ids[i]={
- // 'id': attachments[i].id,
- // 'name': attachments[i].name,
- // 'filename': attachments[i].filename,
- // 'url': mail.ChatterUtils.get_attachment_url(self.session, attachments[i])
- // };
- // }
- // self.display_attachments();
- // });
- // },
-
bind_events: function() {
var self = this;
@@ -319,10 +297,6 @@ openerp.mail = function(session) {
},
on_compose_fullmail: function(){
- var attachments=[];
- for(var i in this.attachment_ids){
- attachments.push(this.attachment_ids[i].id);
- }
/* TDE note: I think this is not necessary, because
* 1/ post on a document: followers added server-side in _notify
* 2/ reply to a message: mail.compose.message should add the previous partners
@@ -341,15 +315,20 @@ openerp.mail = function(session) {
target: 'new',
context: {
'default_model': this.context.default_model,
+ 'default_res_model': this.context.default_model,
'default_res_id': this.context.default_res_id,
'default_content_subtype': 'html',
- 'default_ancestor_id': this.id,
+ 'default_parent_id': this.id,
'default_body': mail.ChatterUtils.get_text2html(this.$render_expandable ? (this.$render_expandable.find('textarea').val() || '') : ''),
- 'default_attachment_ids': attachments,
+ 'default_attachment_ids': this.attachment_ids,
'default_partner_ids': partner_ids
},
};
this.do_action(action);
+
+ if(this.$render_expandable) {
+ this.on_cancel();
+ }
},
on_cancel: function(event){
@@ -366,7 +345,6 @@ openerp.mail = function(session) {
/*post a message and fetch the message*/
on_message_post: function (body) {
- console.log('post');
var self = this;
if (! body) {
@@ -392,7 +370,7 @@ openerp.mail = function(session) {
false,
'comment',
'mail.mt_comment',
- this.context.default_ancestor_id,
+ this.context.default_parent_id,
attachments,
this.parent_thread.context
]).then(function(records){
@@ -484,7 +462,7 @@ openerp.mail = function(session) {
this.context = _.extend({
default_model: 'mail.thread',
default_res_id: 0,
- default_ancestor_id: false }, options.context || {});
+ default_parent_id: false }, options.context || {});
// data of this expandable message
this.id = datasets.id || -1,
@@ -622,7 +600,7 @@ openerp.mail = function(session) {
this.context = _.extend({
default_model: 'mail.thread',
default_res_id: 0,
- default_ancestor_id: false }, options.context || {});
+ default_parent_id: false }, options.context || {});
// record options
this.options = options.options;
@@ -659,17 +637,39 @@ openerp.mail = function(session) {
for (var l in this.attachment_ids) {
var attach = this.attachment_ids[l];
attach['url'] = mail.ChatterUtils.get_attachment_url(this.session, attach);
+
+ if((attach.filename || attach.name).match(/[.](jpg|jpg|gif|png|tif|svg)$/i)) {
+ attach.is_image = true;
+
+ }
+ if((attach.filename || attach.name).match(/[.](pdf|doc|docx|xls|xlsx|ppt|pptx|psd|tiff|dxf|svg)$/i)) {
+ attach.is_document = true;
+ attach.url_escape = encodeURIComponent(attach.url);
+ }
}
+
},
start: function() {
this._super.apply(this, arguments);
this.expender();
this.$el.hide().fadeIn(750);
+ this.resize_img();
this.bind_events();
this.create_thread();
},
+ resize_img: function() {
+ this.$("img").load(function() {
+ var h = $(this).height();
+ var w = $(this).width();
+ if( h > 100 || w >100 ) {
+ var ratio = 100 / (h > w ? h : w);
+ $(this).attr("width", parseInt( w*ratio )).attr("height", parseInt( h*ratio ));
+ }
+ });
+ },
+
/**
* Bind events in the widget. Each event is slightly described
* in the function. */
@@ -729,7 +729,7 @@ openerp.mail = function(session) {
'context':{
'default_model': this.model,
'default_res_id': this.res_id,
- 'default_ancestor_id': this.id
+ 'default_parent_id': this.id
},
'options': this.options
}
@@ -931,7 +931,7 @@ openerp.mail = function(session) {
this.context = _.extend({
default_model: 'mail.thread',
default_res_id: 0,
- default_ancestor_id: false }, options.context || {});
+ default_parent_id: false }, options.context || {});
this.options = options.options;
this.options._parents = (options.options._parents != undefined ? options.options._parents : []).concat( [this] );
@@ -1150,7 +1150,7 @@ openerp.mail = function(session) {
// CHM note : option for sending in flat mode by server
var nb_indented_thread = this.options.display_indented_thread > this.thread_level ? this.options.display_indented_thread - this.thread_level : 0;
- return this.ds_message.call('message_read', [ids, fetch_domain, message_loaded_ids, nb_indented_thread, fetch_context, this.context.default_ancestor_id || undefined]
+ return this.ds_message.call('message_read', [ids, fetch_domain, message_loaded_ids, nb_indented_thread, fetch_context, this.context.default_parent_id || undefined]
).then(this.proxy('switch_new_message'));
},
@@ -1169,7 +1169,7 @@ openerp.mail = function(session) {
'context': {
'default_model': data.model || self.context.default_model,
'default_res_id': data.res_id || self.context.default_res_id,
- 'default_ancestor_id': self.id },
+ 'default_parent_id': self.id },
});
} else {
var message = new mail.ThreadMessage(self, _.extend(data, {'thread_level': data.thread_level ? data.thread_level : self.thread_level}), {
@@ -1177,7 +1177,7 @@ openerp.mail = function(session) {
'context': {
'default_model': data.model,
'default_res_id': data.res_id,
- 'default_ancestor_id': data.id },
+ 'default_parent_id': data.id },
'options': _.extend(self.options, data.options)
});
}
@@ -1282,7 +1282,6 @@ openerp.mail = function(session) {
*/
switch_new_message: function(records) {
var self=this;
- console.log(records);
_(records).each(function(record){
var thread = self.browse_thread({
'id': record.ancestor_id,
@@ -1371,7 +1370,7 @@ openerp.mail = function(session) {
'context': {
'default_model': message.model || this.context.default_model,
'default_res_id': message.res_id || this.context.default_res_id,
- 'default_ancestor_id': this.id },
+ 'default_parent_id': this.id },
});
// add object on array and DOM
@@ -1706,7 +1705,11 @@ openerp.mail = function(session) {
action_from: 'mail.ThreadComposeMessage',
views: [[false, 'form']],
target: 'new',
- context: this.options.context,
+ context: _.extend(this.options.context, {
+ 'default_model': this.context.default_model,
+ 'default_res_id': this.context.default_res_id,
+ 'default_content_subtype': 'html',
+ }),
};
session.client.action_manager.do_action(action);
},
diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml
index e1e272f1dd4..96a3f578663 100644
--- a/addons/mail/static/src/xml/mail.xml
+++ b/addons/mail/static/src/xml/mail.xml
@@ -57,7 +57,7 @@
/web/binary/upload_attachment
-
+
@@ -70,8 +70,8 @@
Template used to display attachments in a mail.message
-->
-
-
+
+
@@ -79,15 +79,32 @@
-
-
-
+
+
+
+
+
[
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/mail/wizard/mail_compose_message_view.xml b/addons/mail/wizard/mail_compose_message_view.xml
index 255954e31c1..1f00ed419a2 100644
--- a/addons/mail/wizard/mail_compose_message_view.xml
+++ b/addons/mail/wizard/mail_compose_message_view.xml
@@ -14,22 +14,16 @@
- />
+ on_change="onchange_partner_ids(partner_ids)" required="1"/>
+
-
-
-
-
-
-
-
-
+
+