[MERGE] Latest trunk.
bzr revid: vta@openerp.com-20121121135805-8f6u8q5zywbqw3nu
This commit is contained in:
commit
f079e012ac
|
@ -408,6 +408,7 @@ class account_invoice(osv.osv):
|
||||||
'default_use_template': bool(template_id),
|
'default_use_template': bool(template_id),
|
||||||
'default_template_id': template_id,
|
'default_template_id': template_id,
|
||||||
'default_composition_mode': 'comment',
|
'default_composition_mode': 'comment',
|
||||||
|
'mark_invoice_as_sent': True,
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
|
@ -1730,8 +1731,6 @@ class account_invoice_tax(osv.osv):
|
||||||
})
|
})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
account_invoice_tax()
|
|
||||||
|
|
||||||
|
|
||||||
class res_partner(osv.osv):
|
class res_partner(osv.osv):
|
||||||
""" Inherits partner and adds invoice information in the partner form """
|
""" Inherits partner and adds invoice information in the partner form """
|
||||||
|
@ -1745,16 +1744,14 @@ class res_partner(osv.osv):
|
||||||
default.update({'invoice_ids' : []})
|
default.update({'invoice_ids' : []})
|
||||||
return super(res_partner, self).copy(cr, uid, id, default, context)
|
return super(res_partner, self).copy(cr, uid, id, default, context)
|
||||||
|
|
||||||
res_partner()
|
|
||||||
|
|
||||||
class mail_message(osv.osv):
|
class mail_compose_message(osv.osv):
|
||||||
_name = 'mail.message'
|
_inherit = 'mail.compose.message'
|
||||||
_inherit = 'mail.message'
|
|
||||||
|
|
||||||
def _postprocess_sent_message(self, cr, uid, message, context=None):
|
def send_mail(self, cr, uid, ids, context=None):
|
||||||
if message.model == 'account.invoice':
|
context = context or {}
|
||||||
self.pool.get('account.invoice').write(cr, uid, [message.res_id], {'sent':True}, context=context)
|
if context.get('default_model') == 'account.invoice' and context.get('default_res_id') and context.get('mark_invoice_as_sent'):
|
||||||
return super(mail_message, self)._postprocess_sent_message(cr, uid, message=message, context=context)
|
self.pool.get('account.invoice').write(cr, uid, [context['default_res_id']], {'sent': True}, context=context)
|
||||||
|
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
|
||||||
|
|
||||||
mail_message()
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
|
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
|
||||||
|
|
||||||
<p>A new invoice is available for ${object.partner_id.name}: </p>
|
<p>A new invoice is available for you: </p>
|
||||||
|
|
||||||
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
|
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
|
||||||
<strong>REFERENCES</strong><br />
|
<strong>REFERENCES</strong><br />
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
comp_name = quote(object.company_id.name)
|
comp_name = quote(object.company_id.name)
|
||||||
inv_number = quote(object.number)
|
inv_number = quote(object.number)
|
||||||
paypal_account = quote(object.company_id.paypal_account)
|
paypal_account = quote(object.company_id.paypal_account)
|
||||||
inv_amount = quote(str(object.amount_total))
|
inv_amount = quote(str(object.residual))
|
||||||
cur_name = quote(object.currency_id.name)
|
cur_name = quote(object.currency_id.name)
|
||||||
paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s&" \
|
paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s&" \
|
||||||
"invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
|
"invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -59,6 +59,12 @@ class mail_message(osv.Model):
|
||||||
_message_record_name_length = 18
|
_message_record_name_length = 18
|
||||||
_message_read_more_limit = 1024
|
_message_read_more_limit = 1024
|
||||||
|
|
||||||
|
def default_get(self, cr, uid, fields, context=None):
|
||||||
|
# protection for `default_type` values leaking from menu action context (e.g. for invoices)
|
||||||
|
if context and context.get('default_type') and context.get('default_type') not in self._columns['type'].selection:
|
||||||
|
context = dict(context, default_type=None)
|
||||||
|
return super(mail_message, self).default_get(cr, uid, fields, context=context)
|
||||||
|
|
||||||
def _shorten_name(self, name):
|
def _shorten_name(self, name):
|
||||||
if len(name) <= (self._message_record_name_length + 3):
|
if len(name) <= (self._message_record_name_length + 3):
|
||||||
return name
|
return name
|
||||||
|
|
|
@ -7,39 +7,6 @@ openerp.mail = function (session) {
|
||||||
openerp_mail_followers(session, mail); // import mail_followers.js
|
openerp_mail_followers(session, mail); // import mail_followers.js
|
||||||
openerp_FieldMany2ManyTagsEmail(session); // import manyy2many_tags_email.js
|
openerp_FieldMany2ManyTagsEmail(session); // import manyy2many_tags_email.js
|
||||||
|
|
||||||
/**
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
* FormView
|
|
||||||
* ------------------------------------------------------------
|
|
||||||
*
|
|
||||||
* Override of formview do_action method, to catch all return action about
|
|
||||||
* mail.compose.message. The purpose is to bind 'Send by e-mail' buttons.
|
|
||||||
*/
|
|
||||||
|
|
||||||
session.web.FormView = session.web.FormView.extend({
|
|
||||||
do_action: function (action) {
|
|
||||||
if (action.res_model == 'mail.compose.message') {
|
|
||||||
/* hack for stop context propagation of wrong value
|
|
||||||
* delete this hack when a global method to clean context is create
|
|
||||||
*/
|
|
||||||
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_body', 'active_id', 'lang', 'bin_raw', 'tz',
|
|
||||||
'active_model', 'edi_web_url_view', 'active_ids',
|
|
||||||
'default_attachment_ids']
|
|
||||||
for (var key in action.context) {
|
|
||||||
if (_.indexOf(context_keys, key) == -1) {
|
|
||||||
action.context[key] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* end hack */
|
|
||||||
}
|
|
||||||
return this._super.apply(this, arguments);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ------------------------------------------------------------
|
* ------------------------------------------------------------
|
||||||
* ChatterUtils
|
* ChatterUtils
|
||||||
|
|
|
@ -36,22 +36,22 @@ openerp_mail_followers = function(session, mail) {
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
// use actual_mode property on view to know if the view is in create mode anymore
|
// use actual_mode property on view to know if the view is in create mode anymore
|
||||||
this.view.on("change:actual_mode", this, this._check_visibility);
|
this.view.on("change:actual_mode", this, this.on_check_visibility_mode);
|
||||||
this._check_visibility();
|
this.on_check_visibility_mode();
|
||||||
this.reinit();
|
this.reinit();
|
||||||
this.bind_events();
|
this.bind_events();
|
||||||
this._super();
|
this._super();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
on_check_visibility_mode: function () {
|
||||||
|
this.set({"force_invisible": this.view.get("actual_mode") == "create"});
|
||||||
|
},
|
||||||
|
|
||||||
set_value: function(_value) {
|
set_value: function(_value) {
|
||||||
this.value = _value;
|
this.value = _value;
|
||||||
this._super(_value);
|
this._super(_value);
|
||||||
},
|
},
|
||||||
|
|
||||||
_check_visibility: function() {
|
|
||||||
this.$el.toggle(this.view.get("actual_mode") !== "create");
|
|
||||||
},
|
|
||||||
|
|
||||||
reinit: function() {
|
reinit: function() {
|
||||||
this.message_is_follower == undefined;
|
this.message_is_follower == undefined;
|
||||||
this.display_buttons();
|
this.display_buttons();
|
||||||
|
|
|
@ -43,7 +43,7 @@ class acquirer(osv.Model):
|
||||||
'visible': fields.boolean('Visible', help="Make this payment acquirer available in portal forms (Customer invoices, etc.)"),
|
'visible': fields.boolean('Visible', help="Make this payment acquirer available in portal forms (Customer invoices, etc.)"),
|
||||||
}
|
}
|
||||||
|
|
||||||
_default = {
|
_defaults = {
|
||||||
'visible': True,
|
'visible': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from osv import osv
|
from openerp.osv import osv
|
||||||
import tools
|
from openerp.tools import append_content_to_html
|
||||||
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
class mail_mail(osv.Model):
|
class mail_mail(osv.Model):
|
||||||
""" Update of mail_mail class, to add the signin URL to notifications. """
|
""" Update of mail_mail class, to add the signin URL to notifications. """
|
||||||
|
@ -36,5 +37,6 @@ class mail_mail(osv.Model):
|
||||||
if partner:
|
if partner:
|
||||||
context = dict(context or {}, signup_valid=True)
|
context = dict(context or {}, signup_valid=True)
|
||||||
partner = self.pool.get('res.partner').browse(cr, uid, partner.id, context)
|
partner = self.pool.get('res.partner').browse(cr, uid, partner.id, context)
|
||||||
body = tools.append_content_to_html(body, ("<div><p>Log in our portal at: %s</p></div>" % partner.signup_url), plaintext=False)
|
text = _("""Access your personal documents through <a href="%s">our Customer Portal</a>""") % partner.signup_url
|
||||||
|
body = append_content_to_html(body, ("<div><p>%s</p></div>" % text), plaintext=False)
|
||||||
return body
|
return body
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
%>
|
%>
|
||||||
% if signup_url:
|
% if signup_url:
|
||||||
<p>
|
<p>
|
||||||
You can access this document and pay online via our Customers Portal:
|
You can access this document and pay online via our Customer Portal:
|
||||||
</p>
|
</p>
|
||||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
||||||
href="${signup_url}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a>
|
href="${signup_url}">View ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'}</a>
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
|
|
||||||
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
|
<p>Hello${object.partner_id.name and ' ' or ''}${object.partner_id.name or ''},</p>
|
||||||
|
|
||||||
<p>A new invoice is available for ${object.partner_id.name}: </p>
|
<p>A new invoice is available for you: </p>
|
||||||
|
|
||||||
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
|
<p style="border-left: 1px solid #8e0000; margin-left: 30px;">
|
||||||
<strong>REFERENCES</strong><br />
|
<strong>REFERENCES</strong><br />
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
%>
|
%>
|
||||||
% if signup_url:
|
% if signup_url:
|
||||||
<p>
|
<p>
|
||||||
You can access the invoice document and pay online via our Customers Portal:
|
You can access the invoice document and pay online via our Customer Portal:
|
||||||
</p>
|
</p>
|
||||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #DDD; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
||||||
href="${signup_url}">View Invoice</a>
|
href="${signup_url}">View Invoice</a>
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
comp_name = quote(object.company_id.name)
|
comp_name = quote(object.company_id.name)
|
||||||
inv_number = quote(object.number)
|
inv_number = quote(object.number)
|
||||||
paypal_account = quote(object.company_id.paypal_account)
|
paypal_account = quote(object.company_id.paypal_account)
|
||||||
inv_amount = quote(str(object.amount_residual))
|
inv_amount = quote(str(object.residual))
|
||||||
cur_name = quote(object.currency_id.name)
|
cur_name = quote(object.currency_id.name)
|
||||||
paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s&" \
|
paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=%s&item_name=%s%%20Invoice%%20%s&" \
|
||||||
"invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
|
"invoice=%s&amount=%s&currency_code=%s&button_subtype=services&no_note=1&bn=OpenERP_Invoice_PayNow_%s" % \
|
||||||
|
|
|
@ -1028,17 +1028,14 @@ class sale_order_line(osv.osv):
|
||||||
raise osv.except_osv(_('Invalid Action!'), _('Cannot delete a sales order line which is in state \'%s\'.') %(rec.state,))
|
raise osv.except_osv(_('Invalid Action!'), _('Cannot delete a sales order line which is in state \'%s\'.') %(rec.state,))
|
||||||
return super(sale_order_line, self).unlink(cr, uid, ids, context=context)
|
return super(sale_order_line, self).unlink(cr, uid, ids, context=context)
|
||||||
|
|
||||||
sale_order_line()
|
|
||||||
|
|
||||||
class mail_compose_message(osv.osv):
|
class mail_compose_message(osv.osv):
|
||||||
_inherit = 'mail.compose.message'
|
_inherit = 'mail.compose.message'
|
||||||
def send_mail(self, cr, uid, ids, context=None):
|
def send_mail(self, cr, uid, ids, context=None):
|
||||||
context = context or {}
|
context = context or {}
|
||||||
if context.get('mark_so_as_sent', False) and context.get('default_res_id', False):
|
if context.get('default_model') == 'sale.order' and context.get('default_res_id') and context.get('mark_so_as_sent'):
|
||||||
wf_service = netsvc.LocalService("workflow")
|
wf_service = netsvc.LocalService("workflow")
|
||||||
wf_service.trg_validate(uid, 'sale.order', context.get('default_res_id', False), 'quotation_sent', cr)
|
wf_service.trg_validate(uid, 'sale.order', context['default_res_id'], 'quotation_sent', cr)
|
||||||
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
|
return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context)
|
||||||
|
|
||||||
mail_compose_message()
|
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
Loading…
Reference in New Issue