[MERGE] forward port branch 9.0 up to 9ba5698

This commit is contained in:
Christophe Simonis
2016-09-28 12:59:25 +02:00
12 changed files with 41 additions and 45 deletions
+4 -3
View File
@@ -39,7 +39,7 @@ class AccountInvoice(models.Model):
_order = "date_invoice desc, number desc, id desc" _order = "date_invoice desc, number desc, id desc"
@api.one @api.one
@api.depends('invoice_line_ids.price_subtotal', 'tax_line_ids.amount', 'currency_id', 'company_id') @api.depends('invoice_line_ids.price_subtotal', 'tax_line_ids.amount', 'currency_id', 'company_id', 'date_invoice')
def _compute_amount(self): def _compute_amount(self):
self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line_ids) self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line_ids)
self.amount_tax = sum(line.amount for line in self.tax_line_ids) self.amount_tax = sum(line.amount for line in self.tax_line_ids)
@@ -47,8 +47,9 @@ class AccountInvoice(models.Model):
amount_total_company_signed = self.amount_total amount_total_company_signed = self.amount_total
amount_untaxed_signed = self.amount_untaxed amount_untaxed_signed = self.amount_untaxed
if self.currency_id and self.currency_id != self.company_id.currency_id: if self.currency_id and self.currency_id != self.company_id.currency_id:
amount_total_company_signed = self.currency_id.compute(self.amount_total, self.company_id.currency_id) currency_id = self.currency_id.with_context(date=self.date_invoice)
amount_untaxed_signed = self.currency_id.compute(self.amount_untaxed, self.company_id.currency_id) amount_total_company_signed = currency_id.compute(self.amount_total, self.company_id.currency_id)
amount_untaxed_signed = currency_id.compute(self.amount_untaxed, self.company_id.currency_id)
sign = self.type in ['in_refund', 'out_refund'] and -1 or 1 sign = self.type in ['in_refund', 'out_refund'] and -1 or 1
self.amount_total_company_signed = amount_total_company_signed * sign self.amount_total_company_signed = amount_total_company_signed * sign
self.amount_total_signed = self.amount_total * sign self.amount_total_signed = self.amount_total * sign
+5 -1
View File
@@ -1063,6 +1063,7 @@ class calendar_event(osv.Model):
attendees[att.partner_id.id] = True attendees[att.partner_id.id] = True
new_attendees = [] new_attendees = []
new_att_partner_ids = [] new_att_partner_ids = []
attendees_to_mail = []
for partner in event.partner_ids: for partner in event.partner_ids:
if partner.id in attendees: if partner.id in attendees:
continue continue
@@ -1084,7 +1085,7 @@ class calendar_event(osv.Model):
if not current_user.email or current_user.email != partner.email: if not current_user.email or current_user.email != partner.email:
mail_from = current_user.email or tools.config.get('email_from', False) mail_from = current_user.email or tools.config.get('email_from', False)
if not context.get('no_email'): if not context.get('no_email'):
self.pool['calendar.attendee']._send_mail_to_attendees(cr, uid, att_id, email_from=mail_from, context=context) attendees_to_mail.append((att_id, mail_from, partner.name))
if new_attendees: if new_attendees:
self.write(cr, uid, [event.id], {'attendee_ids': [(4, att) for att in new_attendees]}, context=context) self.write(cr, uid, [event.id], {'attendee_ids': [(4, att) for att in new_attendees]}, context=context)
@@ -1104,6 +1105,9 @@ class calendar_event(osv.Model):
if attendee_ids_to_remove: if attendee_ids_to_remove:
self.pool['calendar.attendee'].unlink(cr, uid, attendee_ids_to_remove, context) self.pool['calendar.attendee'].unlink(cr, uid, attendee_ids_to_remove, context)
for att_id, mail_from, partner_name in attendees_to_mail:
self.pool['calendar.attendee']._send_mail_to_attendees(cr, uid, att_id, email_from=mail_from, context=context)
res[event.id] = { res[event.id] = {
'new_attendee_ids': new_attendees, 'new_attendee_ids': new_attendees,
'old_attendee_ids': all_attendee_ids, 'old_attendee_ids': all_attendee_ids,
+1 -1
View File
@@ -295,7 +295,7 @@ class HrExpense(models.Model):
# Calculate tax lines and adjust base line # Calculate tax lines and adjust base line
taxes = expense.tax_ids.compute_all(expense.unit_amount, expense.currency_id, expense.quantity, expense.product_id) taxes = expense.tax_ids.compute_all(expense.unit_amount, expense.currency_id, expense.quantity, expense.product_id)
account_move[-1]['price'] = taxes['total_excluded'] account_move[-1]['price'] = taxes['total_excluded']
account_move[-1]['tax_ids'] = expense.tax_ids.id account_move[-1]['tax_ids'] = expense.tax_ids.ids
for tax in taxes['taxes']: for tax in taxes['taxes']:
account_move.append({ account_move.append({
'type': 'tax', 'type': 'tax',
-8
View File
@@ -299,10 +299,6 @@ class hr_holidays(osv.osv):
the date_from. the date_from.
Also update the number_of_days. Also update the number_of_days.
""" """
# date_to has to be greater than date_from
if (date_from and date_to) and (date_from > date_to):
raise UserError(_('The start date must be anterior to the end date.'))
result = {'value': {}} result = {'value': {}}
# No date_to set so far: automatically compute one 8 hours later # No date_to set so far: automatically compute one 8 hours later
@@ -323,10 +319,6 @@ class hr_holidays(osv.osv):
""" """
Update the number_of_days. Update the number_of_days.
""" """
# date_to has to be greater than date_from
if (date_from and date_to) and (date_from > date_to):
raise UserError(_('The start date must be anterior to the end date.'))
result = {'value': {}} result = {'value': {}}
# Compute and update the number of days # Compute and update the number of days
+1 -1
View File
@@ -494,7 +494,7 @@ class MailTemplate(models.Model):
) )
# Add report in attachments: generate once for all template_res_ids # Add report in attachments: generate once for all template_res_ids
if template.report_template and not 'report_template_in_attachment' in self.env.context: if template.report_template:
for res_id in template_res_ids: for res_id in template_res_ids:
attachments = [] attachments = []
report_name = self.render_template(template.report_name, template.model, res_id) report_name = self.render_template(template.report_name, template.model, res_id)
+1 -22
View File
@@ -192,7 +192,7 @@ class MailComposer(models.TransientModel):
@api.multi @api.multi
def send_mail_action(self): def send_mail_action(self):
# TDE/ ??? # TDE/ ???
return self.with_context(report_template_in_attachment=True).send_mail() return self.send_mail()
@api.multi @api.multi
def send_mail(self, auto_commit=False): def send_mail(self, auto_commit=False):
@@ -358,20 +358,6 @@ class MailComposer(models.TransientModel):
if template.user_signature and 'body_html' in values: if template.user_signature and 'body_html' in values:
signature = self.env.user.signature signature = self.env.user.signature
values['body_html'] = tools.append_content_to_html(values['body_html'], signature, plaintext=False) values['body_html'] = tools.append_content_to_html(values['body_html'], signature, plaintext=False)
if template.report_template:
attachment = self.env['ir.attachment']
attach = self.generate_attachment_from_report(template_id, res_id)
for attach_fname, attach_datas in attach[res_id].pop('attachments', []):
data_attach = {
'name': attach_fname,
'datas': attach_datas,
'datas_fname': attach_fname,
'res_model': 'mail.compose.message',
'res_id': 0,
'type': 'binary',
}
values.setdefault('attachment_ids', list()).append(attachment.create(data_attach).id)
elif template_id: elif template_id:
values = self.generate_email_for_composer(template_id, [res_id])[res_id] values = self.generate_email_for_composer(template_id, [res_id])[res_id]
# transform attachments into attachment_ids; not attached to the document because this will # transform attachments into attachment_ids; not attached to the document because this will
@@ -402,13 +388,6 @@ class MailComposer(models.TransientModel):
return {'value': values} return {'value': values}
@api.multi
def generate_attachment_from_report(self, template_id, res_id):
fields = ['attachment_ids']
result = self.env['mail.template'].with_context(tpl_partners_only=True).browse(template_id).generate_email([res_id], fields=fields)
return result
@api.multi @api.multi
def save_as_template(self): def save_as_template(self):
""" hit save as template button: current form value will be a new """ hit save as template button: current form value will be a new
+3 -2
View File
@@ -175,9 +175,10 @@ odoo.define('website.website', function (require) {
}); });
/* ----- PUBLISHING STUFF ---- */ /* ----- PUBLISHING STUFF ---- */
$(document).on('click', '.js_publish_management .js_publish_btn', function () { $(document).on('click', '.js_publish_management .js_publish_btn', function (e) {
e.preventDefault();
var $data = $(this).parents(".js_publish_management:first"); var $data = $(this).parents(".js_publish_management:first");
var self=this;
ajax.jsonRpc($data.data('controller') || '/website/publish', 'call', {'id': +$data.data('id'), 'object': $data.data('object')}) ajax.jsonRpc($data.data('controller') || '/website/publish', 'call', {'id': +$data.data('id'), 'object': $data.data('object')})
.then(function (result) { .then(function (result) {
$data.toggleClass("css_unpublished css_published"); $data.toggleClass("css_unpublished css_published");
@@ -102,8 +102,12 @@ odoo.define('website_blog.editor', function (require) {
editor.on('saved', self, function (event, img) { editor.on('saved', self, function (event, img) {
var url = self.$image.attr('src'); var url = self.$image.attr('src');
self.$cover.css({"background-image": url ? 'url(' + url + ')' : "", 'min-height': $(window).height()-this.$cover.offset().top}); self.$cover.css({"background-image": url ? 'url(' + url + ')' : "", 'min-height': $(window).height()-this.$cover.offset().top});
self.$target.addClass('o_dirty cover cover_full'); if (!self.$target.hasClass("cover")) {
var $li = self.$el.find("[data-cover_class]").first();
self.cover_class(type, $li.data("cover_class"), $li);
}
self.set_active(); self.set_active();
self.$target.addClass("o_dirty");
}); });
}, },
cover_class : function(type, value, $li) { cover_class : function(type, value, $li) {
@@ -359,6 +359,7 @@
min-height: 100px; min-height: 100px;
position: relative; position: relative;
padding-bottom: 5px; padding-bottom: 5px;
padding-left: 180px;
} }
.oe_product.oe_list .oe_product_image { .oe_product.oe_list .oe_product_image {
top: 0; top: 0;
@@ -370,9 +371,10 @@
.oe_product.oe_list section { .oe_product.oe_list section {
position: relative; position: relative;
border: 0; border: 0;
top: 0; top: auto;
bottom: auto; bottom: auto;
left: 180px; left: auto;
right: auto;
background: transparent; background: transparent;
} }
} }
@@ -306,6 +306,7 @@
min-height: 100px min-height: 100px
position: relative position: relative
padding-bottom: 5px padding-bottom: 5px
padding-left: 180px
.oe_product_image .oe_product_image
top: 0 top: 0
bottom: 0 bottom: 0
@@ -315,9 +316,10 @@
section section
position: relative position: relative
border: 0 border: 0
top: 0 top: auto
bottom: auto bottom: auto
left: 180px left: auto
right: auto
background: transparent background: transparent
.oe_website_sale .row .row .col-md-12 .oe_website_sale .row .row .col-md-12
+11
View File
@@ -0,0 +1,11 @@
United Kingdom, 2016-08-09
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Michael Brown mbrown@fensystems.co.uk https://github.com/mcb30
+2 -2
View File
@@ -61,11 +61,11 @@ refer to :ref:`setup/enterprise` (except for :ref:`setup/install/source`).
If you wish to access the Enterprise installers/source code, you can: If you wish to access the Enterprise installers/source code, you can:
* Go to the Download_ page and log in with your customer credentials * Go to the Download_ page and log in with your customer credentials
* Download the source on GitHub using git_ * Download the source on GitHub using git_(available to partners only)
.. note:: If you do not have access to our Enterprise repository, you can request .. note:: If you do not have access to our Enterprise repository, you can request
it be e-mailing your sales representative or our online support with it be e-mailing your sales representative or our online support with
your subscription number and GitHub username. your subscription number and GitHub username. (available to partners only)
.. warning:: Enterprise deb and rpm packages do not have repositories, so automatic .. warning:: Enterprise deb and rpm packages do not have repositories, so automatic
update will not work. Reinstalling the latest package version will be needed update will not work. Reinstalling the latest package version will be needed