summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2015-12-08 15:17:06 +0100
committerChristophe Simonis <chs@odoo.com>2015-12-08 15:17:06 +0100
commit521b90a8dabf84d85e705175198f5b52ba97d7a9 (patch)
treed6b603bee4237a0a851fd2823db7bc04cd0c91cb /addons
parenta98d1f51d884cb71be30448fd715da153907ef76 (diff)
parent12d799623cf7ae33ce7eab9770bb8448180de0f0 (diff)
[MERGE] forward port of branch saas-6 up to 12d7996
Diffstat (limited to 'addons')
-rw-r--r--addons/account/models/account_invoice.py15
-rw-r--r--addons/auth_oauth/controllers/main.py1
-rw-r--r--addons/base_action_rule/base_action_rule.py8
-rw-r--r--addons/event/models/event.py4
-rw-r--r--addons/mass_mailing/wizard/test_mailing.py2
-rw-r--r--addons/point_of_sale/static/src/js/models.js3
-rw-r--r--addons/web/static/src/js/views/form_view.js2
-rw-r--r--addons/web/static/src/js/views/pivot_view.js2
-rw-r--r--addons/website_sale/static/src/js/website_sale.js15
9 files changed, 32 insertions, 20 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py
index 70de4987b46..4da04633d7a 100644
--- a/addons/account/models/account_invoice.py
+++ b/addons/account/models/account_invoice.py
@@ -1083,12 +1083,19 @@ class AccountInvoiceLine(models.Model):
return accounts['expense']
def _set_taxes(self):
- """ Used in on_change to set taxes """
+ """ Used in on_change to set taxes and price."""
if self.invoice_id.type in ('out_invoice', 'out_refund'):
taxes = self.product_id.taxes_id or self.account_id.tax_ids
else:
taxes = self.product_id.supplier_taxes_id or self.account_id.tax_ids
- self.invoice_line_tax_ids = self.invoice_id.fiscal_position_id.map_tax(taxes)
+ self.invoice_line_tax_ids = fp_taxes = self.invoice_id.fiscal_position_id.map_tax(taxes)
+
+ fix_price = self.env['account.tax']._fix_tax_included_price
+ if type in ('in_invoice', 'in_refund'):
+ if not self.price_unit or self.price_unit == self.product_id.standard_price:
+ self.price_unit = fix_price(self.product_id.standard_price, taxes, fp_taxes.ids)
+ else:
+ self.price_unit = fix_price(self.product_id.lst_price, taxes, fp_taxes.ids)
@api.onchange('product_id')
def _onchange_product_id(self):
@@ -1126,11 +1133,9 @@ class AccountInvoiceLine(models.Model):
self._set_taxes()
if type in ('in_invoice', 'in_refund'):
- self.price_unit = self.price_unit or product.standard_price
if product.description_purchase:
self.name += '\n' + product.description_purchase
else:
- self.price_unit = product.lst_price
if product.description_sale:
self.name += '\n' + product.description_sale
@@ -1140,8 +1145,6 @@ class AccountInvoiceLine(models.Model):
if company and currency:
if company.currency_id != currency:
- if type in ('in_invoice', 'in_refund'):
- self.price_unit = product.standard_price
self.price_unit = self.price_unit * currency.with_context(dict(self._context or {}, date=self.invoice_id.date_invoice)).rate
if self.uom_id and self.uom_id.id != product.uom_id.id:
diff --git a/addons/auth_oauth/controllers/main.py b/addons/auth_oauth/controllers/main.py
index f8adba4c0a2..b7c1f13cf6b 100644
--- a/addons/auth_oauth/controllers/main.py
+++ b/addons/auth_oauth/controllers/main.py
@@ -57,7 +57,6 @@ class OAuthLogin(Home):
return_url = request.httprequest.url_root + 'auth_oauth/signin'
state = self.get_state(provider)
params = dict(
- debug=request.debug,
response_type='token',
client_id=provider['client_id'],
redirect_uri=return_url,
diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py
index 3201d9b9381..9d5c76e4130 100644
--- a/addons/base_action_rule/base_action_rule.py
+++ b/addons/base_action_rule/base_action_rule.py
@@ -218,12 +218,12 @@ class base_action_rule(osv.osv):
def make_create():
""" Instanciate a create method that processes action rules. """
@openerp.api.model
- def create(self, vals):
+ def create(self, vals, **kw):
# retrieve the action rules to possibly execute
actions = self.env['base.action.rule']._get_actions(self, ['on_create', 'on_create_or_write'])
# call original method
- record = create.origin(self.with_env(actions.env), vals)
+ record = create.origin(self.with_env(actions.env), vals, **kw)
# check postconditions, and execute actions on the records that satisfy them
for action in actions.with_context(old_values=None):
@@ -240,7 +240,7 @@ class base_action_rule(osv.osv):
# catch updates made by field recomputations.
#
@openerp.api.multi
- def _write(self, vals):
+ def _write(self, vals, **kw):
# retrieve the action rules to possibly execute
actions = self.env['base.action.rule']._get_actions(self, ['on_write', 'on_create_or_write'])
records = self.with_env(actions.env)
@@ -255,7 +255,7 @@ class base_action_rule(osv.osv):
}
# call original method
- _write.origin(records, vals)
+ _write.origin(records, vals, **kw)
# check postconditions, and execute actions on the records that satisfy them
for action in actions.with_context(old_values=old_values):
diff --git a/addons/event/models/event.py b/addons/event/models/event.py
index efcd791e9e3..c14ce0e51cc 100644
--- a/addons/event/models/event.py
+++ b/addons/event/models/event.py
@@ -185,7 +185,9 @@ class event_event(models.Model):
def name_get(self):
result = []
for event in self:
- dates = [dt.split(' ')[0] for dt in [event.date_begin, event.date_end] if dt]
+ date_begin = fields.Datetime.from_string(event.date_begin)
+ date_end = fields.Datetime.from_string(event.date_end)
+ dates = [fields.Date.to_string(fields.Datetime.context_timestamp(event, dt)) for dt in [date_begin, date_end] if dt]
dates = sorted(set(dates))
result.append((event.id, '%s (%s)' % (event.name, ' - '.join(dates))))
return result
diff --git a/addons/mass_mailing/wizard/test_mailing.py b/addons/mass_mailing/wizard/test_mailing.py
index c0601ea29d5..b86f4ea32a0 100644
--- a/addons/mass_mailing/wizard/test_mailing.py
+++ b/addons/mass_mailing/wizard/test_mailing.py
@@ -25,6 +25,8 @@ class TestMassMailing(osv.TransientModel):
test_emails = tools.email_split(wizard.email_to)
mail_ids = []
for test_mail in test_emails:
+ # Convert links in absolute URLs before the application of the shortener
+ self.pool['mail.mass_mailing'].write(cr, uid, [mailing.id], {'body_html': self.pool['mail.template']._replace_local_links(cr, uid, mailing.body_html, context)}, context=context)
mail_values = {
'email_from': mailing.email_from,
'reply_to': mailing.reply_to,
diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js
index 37fcc4e023c..e3423dd419a 100644
--- a/addons/point_of_sale/static/src/js/models.js
+++ b/addons/point_of_sale/static/src/js/models.js
@@ -1259,9 +1259,8 @@ exports.Orderline = Backbone.Model.extend({
return round_pr(this.get_unit_price() * this.get_quantity() * (1 - this.get_discount()/100), rounding);
},
get_display_price: function(){
- return this.get_base_price();
if (this.pos.config.iface_tax_included) {
- return this.get_all_prices().priceWithTax;
+ return this.get_price_with_tax();
} else {
return this.get_base_price();
}
diff --git a/addons/web/static/src/js/views/form_view.js b/addons/web/static/src/js/views/form_view.js
index b24eab43d62..fa2a8ef8ab5 100644
--- a/addons/web/static/src/js/views/form_view.js
+++ b/addons/web/static/src/js/views/form_view.js
@@ -400,7 +400,7 @@ var FormView = View.extend(common.FieldManagerMixin, {
var keys = _.keys(this.fields_view.fields);
if (keys.length) {
return this.dataset.default_get(keys).then(function(r) {
- self.trigger('load_record', r);
+ self.trigger('load_record', _.clone(r));
});
}
return self.trigger('load_record', {});
diff --git a/addons/web/static/src/js/views/pivot_view.js b/addons/web/static/src/js/views/pivot_view.js
index 72f1ac4bf1d..deb2c16870f 100644
--- a/addons/web/static/src/js/views/pivot_view.js
+++ b/addons/web/static/src/js/views/pivot_view.js
@@ -574,7 +574,7 @@ var PivotView = View.extend({
i, j, cell, $row, $cell;
var groupby_labels = _.map(this.main_col.groupbys, function (gb) {
- return self.groupable_fields[gb.split(':')[0]].string;
+ return self.fields[gb.split(':')[0]].string;
});
for (i = 0; i < headers.length; i++) {
diff --git a/addons/website_sale/static/src/js/website_sale.js b/addons/website_sale/static/src/js/website_sale.js
index e6849d6e77b..c844adce2fc 100644
--- a/addons/website_sale/static/src/js/website_sale.js
+++ b/addons/website_sale/static/src/js/website_sale.js
@@ -102,7 +102,10 @@ $('.oe_website_sale').each(function () {
$(oe_website_sale).on("change", 'input[name="add_qty"]', function (event) {
var product_ids = [];
var product_dom = $(".js_add_cart_variants[data-attribute_value_ids]").first();
- product_dom.data("attribute_value_ids").forEach(function(entry) {
+ if (!product_dom.length) {
+ return;
+ }
+ _.each(product_dom.data("attribute_value_ids"), function(entry) {
product_ids.push(entry);});
var qty = $(event.target).closest('form').find('input[name="add_qty"]').val();
@@ -132,7 +135,7 @@ $('.oe_website_sale').each(function () {
};
})();
- $(oe_website_sale).on("change", ".oe_cart input.js_quantity", function () {
+ $(oe_website_sale).on("change", ".oe_cart input.js_quantity[data-product-id]", function () {
var $input = $(this);
if ($input.data('update_change')) {
return;
@@ -202,11 +205,15 @@ $('.oe_website_sale').each(function () {
ev.preventDefault();
var $link = $(ev.currentTarget);
var $input = $link.parent().find("input");
+ var product_id = +$input.closest('*:has(input[name="product_id"])').find('input[name="product_id"]').val();
var min = parseFloat($input.data("min") || 0);
var max = parseFloat($input.data("max") || Infinity);
var quantity = ($link.has(".fa-minus").length ? -1 : 1) + parseFloat($input.val(),10);
- $input.val(quantity > min ? (quantity < max ? quantity : max) : min);
- $('input[name="'+$input.attr("name")+'"]').val(quantity > min ? (quantity < max ? quantity : max) : min);
+ // if they are more of one input for this product (eg: option modal)
+ $('input[name="'+$input.attr("name")+'"]').add($input).filter(function () {
+ var $prod = $(this).closest('*:has(input[name="product_id"])');
+ return !$prod.length || +$prod.find('input[name="product_id"]').val() === product_id;
+ }).val(quantity > min ? (quantity < max ? quantity : max) : min);
$input.change();
return false;
});