[MERGE] forward port branch 9.0 up to 82bde85030

This commit is contained in:
Christophe Simonis
2017-11-30 10:55:32 +01:00
8 changed files with 56 additions and 7 deletions
+1 -1
View File
@@ -508,7 +508,7 @@ exports.PosModel = Backbone.Model.extend({
.then(function(){ load_model(index + 1); },
function(err){ loaded.reject(err); });
}catch(err){
console.error(err.stack);
console.error(err.message, err.stack);
loaded.reject(err);
}
},function(err){
+2 -3
View File
@@ -369,8 +369,8 @@ class WebsiteSale(http.Controller):
def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
request.website.sale_get_order(force_create=1)._cart_update(
product_id=int(product_id),
add_qty=float(add_qty),
set_qty=float(set_qty),
add_qty=add_qty,
set_qty=set_qty,
attributes=self._filter_attributes(**kw),
)
return request.redirect("/shop/cart")
@@ -384,7 +384,6 @@ class WebsiteSale(http.Controller):
if order.state != 'draft':
request.website.sale_reset()
return {}
value = order._cart_update(product_id=product_id, line_id=line_id, add_qty=add_qty, set_qty=set_qty)
if not order.cart_quantity:
request.website.sale_reset()
+11
View File
@@ -113,6 +113,17 @@ class SaleOrder(models.Model):
""" Add or set product quantity, add_qty can be negative """
self.ensure_one()
SaleOrderLineSudo = self.env['sale.order.line'].sudo()
try:
if add_qty:
add_qty = float(add_qty)
except ValueError:
add_qty = 1
try:
if set_qty:
set_qty = float(set_qty)
except ValueError:
set_qty = 0
quantity = 0
order_line = False
if self.state != 'draft':
@@ -133,6 +133,9 @@ odoo.define('website_sale.website_sale', function (require) {
return;
}
var value = parseInt($input.val() || 0, 10);
if (isNaN(value)) {
value = 1;
}
var $dom = $(this).closest('tr');
//var default_price = parseFloat($dom.find('.text-danger > span.oe_currency_value').text());
var $dom_optional = $dom.nextUntil(':not(.optional_product.info)');
@@ -151,7 +154,11 @@ odoo.define('website_sale.website_sale', function (require) {
'set_qty': value
}).then(function (data) {
$input.data('update_change', false);
if (value !== parseInt($input.val() || 0, 10)) {
var check_value = parseInt($input.val() || 0, 10);
if (isNaN(check_value)) {
check_value = 1;
}
if (value !== check_value) {
$input.trigger('change');
return;
}
@@ -33,8 +33,8 @@ class WebsiteSaleOptions(WebsiteSale):
if add_qty or set_qty:
value = order._cart_update(
product_id=int(product_id),
add_qty=int(add_qty),
set_qty=int(set_qty),
add_qty=add_qty,
set_qty=set_qty,
attributes=attributes,
optional_product_ids=optional_product_ids
)
+20
View File
@@ -0,0 +1,20 @@
Russia, 2017-11-25
IT-Projects LLC agrees to the terms of the Odoo Corporate Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Ivan Yelizariev https://github.com/yelizariev
List of contributors:
Ivan Yelizariev yelizariev@it-projects.info https://github.com/yelizariev
Ildar Nasyrov nasyrov@it-projects.info https://github.com/iledarn
Ilmir Karamov karamov@it-projects.info https://github.com/ilmir-k
Dinar Gabbasov gabbasov@it-projects.info https://github.com/GabbasovDinar
Artyom Losev losev@it-projects.info https://github.com/ArtyomLosev
Alexandr Kolushov kolushov@it-projects.info https://github.com/KolushovAlexandr
+11
View File
@@ -0,0 +1,11 @@
South Africa, 2017-11-25
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,
Andre de Kock adekock11@gmail.com https://github.com/adekock11
@@ -266,6 +266,7 @@
<field name="name">ZAR</field>
<field name="symbol">R</field>
<field name="rounding">0.01</field>
<field name="position">before</field>
<field name="active" eval="False"/>
</record>