[MERGE] from chm
bzr revid: fva@openerp.com-20121024152429-js4f1w6t4v4fz1zq
This commit is contained in:
commit
5eac688ef0
|
@ -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'),
|
||||
|
|
|
@ -168,12 +168,15 @@
|
|||
context="{'default_customer': 0, 'search_default_supplier': 1, 'default_supplier': 1}"
|
||||
domain="[('supplier', '=', True)]"/>
|
||||
<field name="fiscal_position" widget="selection"/>
|
||||
<field name="origin"/>
|
||||
<label for="reference_type"/>
|
||||
<div>
|
||||
<group>
|
||||
<field name="origin"/>
|
||||
<field name="supplier_invoice_number"/>
|
||||
</group>
|
||||
<label for="reference_type"/>
|
||||
<div>
|
||||
<field name="reference_type" class="oe_inline oe_edit_only"/>
|
||||
<field name="reference" class="oe_inline"/>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date_invoice"/>
|
||||
|
@ -445,7 +448,7 @@
|
|||
<field name="model">account.invoice</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Invoice">
|
||||
<field name="number" string="Invoice" filter_domain="['|', ('number','ilike',self),('origin','ilike',self)]"/>
|
||||
<field name="number" string="Invoice" filter_domain="['|','|', ('number','ilike',self), ('origin','ilike',self), ('supplier_invoice_number', 'ilike', self)]"/>
|
||||
<filter name="draft" icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Invoices"/>
|
||||
<filter name="proforma" icon="terp-gtk-media-pause" string="Proforma" domain="[('state','=','proforma2')]" help="Proforma Invoices" groups="account.group_proforma_invoices"/>
|
||||
<filter name="invoices" icon="terp-dolar" string="Invoices" domain="[('state','not in',['draft','cancel'])]" help="Proforma/Open/Paid Invoices"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<field name="inherit_id" ref="mail.email_compose_message_wizard_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//form/notebook" position="after">
|
||||
<xpath expr="//form/group" position="after">
|
||||
<group attrs="{'invisible':[('use_template','=',False)]}">
|
||||
<field name="use_template" invisible="1"
|
||||
on_change="onchange_use_template(use_template, template_id, composition_mode, model, res_id, context)"/>
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -63,6 +63,9 @@
|
|||
<filter string="Comments"
|
||||
name="comments" help="Comments"
|
||||
domain="[('type', '=', 'comment')]"/>
|
||||
<filter string="Has attachments"
|
||||
name="attachments"
|
||||
domain="[('attachment_ids', '!=', False)]"/>
|
||||
<filter string="Notifications"
|
||||
name="notifications" help="Notifications"
|
||||
domain="[('type', '=', 'notification')]"/>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<!-- MENU -->
|
||||
|
||||
<!-- Top menu item -->
|
||||
<menuitem name="Mails"
|
||||
<menuitem name="Emails"
|
||||
id="mail.mail_feeds_main"
|
||||
groups="base.group_user"
|
||||
sequence="10"/>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
},
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
<t t-call="HiddenInputFile">
|
||||
<t t-set="fileupload_id" t-value="widget.fileupload_id"/>
|
||||
<t t-set="fileupload_action">/web/binary/upload_attachment</t>
|
||||
<input type="hidden" name="model" value="mail.message"/>
|
||||
<input type="hidden" name="model" value="mail.compose.message"/>
|
||||
<input type="hidden" name="id" value="0"/>
|
||||
<input type="hidden" name="session_id" t-att-value="widget.session.session_id"/>
|
||||
</t>
|
||||
|
@ -70,8 +70,8 @@
|
|||
Template used to display attachments in a mail.message
|
||||
-->
|
||||
<t t-name="mail.thread.message.attachments">
|
||||
<div t-attf-class="oe_msg_attachments #{widget.attachment_ids[0]?'':'oe_hidden'}">
|
||||
<t t-foreach="widget.attachment_ids" t-as="attachment">
|
||||
<span t-attf-class="oe_msg_attachments">
|
||||
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="!attachment.is_image and !attachment.is_document">
|
||||
<div class="oe_attachment">
|
||||
<span t-if="(attachment.upload or attachment.percent_loaded<100)" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}" t-attf-name="{attachment.name || attachment.filename}">
|
||||
<div class="oe_upload_in_process">
|
||||
|
@ -79,15 +79,32 @@
|
|||
</div>
|
||||
<t t-raw="attachment.name || attachment.filename"/>
|
||||
</span>
|
||||
<a t-if="(!attachment.upload or attachment.percent_loaded>=100)" t-att-href="attachment.url" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}">
|
||||
<t t-raw="attachment.name || attachment.filename"/>
|
||||
</a>
|
||||
<t t-if="(!attachment.upload or attachment.percent_loaded>=100)">
|
||||
<a t-att-href="attachment.url" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}">
|
||||
<t t-raw="attachment.name || attachment.filename"/>
|
||||
</a>
|
||||
</t>
|
||||
<t t-if="(widget.show_delete_attachment and (!attachment.upload or attachment.percent_loaded>=100))">
|
||||
<a class="oe_right oe_mail_attachment_delete oe_e" title="Delete this attachment" t-attf-data-id="{attachment.id}">[</a>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</span>
|
||||
<span t-attf-class="oe_msg_images">
|
||||
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="attachment.is_image">
|
||||
<a t-att-href="attachment.url" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}">
|
||||
<img t-if="attachment.is_image" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}" t-att-src="attachment.url"/>
|
||||
</a>
|
||||
</t>
|
||||
</span>
|
||||
<span t-attf-class="oe_msg_document">
|
||||
<t t-foreach="widget.attachment_ids" t-as="attachment" t-if="attachment.is_document">
|
||||
<a t-att-href="attachment.url" t-attf-title="{(attachment.name || attachment.filename) + (attachment.date?' \n('+attachment.date+')':'' )}">
|
||||
<t t-raw="attachment.name || attachment.filename"/>
|
||||
</a>
|
||||
<iframe t-attf-src="http://docs.google.com/viewer?url=#{ attachment.url_escape }&embedded=true" width="600" height="400" style="border: none;"></iframe>
|
||||
</t>
|
||||
</span>
|
||||
</t>
|
||||
|
||||
<t t-name="mail.thread.message.private">
|
||||
|
|
|
@ -14,22 +14,16 @@
|
|||
<field name="parent_id" invisible="1"/>
|
||||
<field name="content_subtype" invisible="1"/>
|
||||
<!-- visible wizard -->
|
||||
<field name="subject" placeholder="Subject..."
|
||||
attrs="{'invisible':[('content_subtype', '=', 'plain')]}"/>/>
|
||||
<field name="partner_ids" widget="many2many_tags" placeholder="Add contacts to notify..."
|
||||
context="{'force_email':True}"
|
||||
on_change="onchange_partner_ids(partner_ids)"/>
|
||||
on_change="onchange_partner_ids(partner_ids)" required="1"/>
|
||||
<field name="subject" placeholder="Subject..."
|
||||
attrs="{'invisible':[('content_subtype', '=', 'plain')]}"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Body">
|
||||
<field name="body" nolabel="1"/>
|
||||
</page>
|
||||
<page string="Attachments">
|
||||
<field name="attachment_ids" colspan="4" nolabel="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<field name="body"/>
|
||||
<field name="attachment_ids" widget="one2many_binary" blockui="0"/>
|
||||
<footer>
|
||||
<button string="Send" name="send_mail" type="object" class="oe_highlight" />
|
||||
<button string="Send" name="send_mail" type="object" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
|
|
Loading…
Reference in New Issue