Skip to content
Permalink
Browse files

[MERGE] forward port branch 11.0 up to d01db48

  • Loading branch information...
KangOl committed May 8, 2019
2 parents 2c68df0 + d01db48 commit 825fee2626c6cd756283b4fa40876cd1d3d5357a
@@ -53,7 +53,7 @@ class StockPicking(models.Model):


@api.one
@api.depends('move_line_ids')
@api.depends('move_line_ids', 'move_line_ids.result_package_id')
def _compute_packages(self):
self.ensure_one()
packs = set()
@@ -63,7 +63,7 @@ def _compute_packages(self):
self.package_ids = list(packs)

@api.one
@api.depends('move_line_ids')
@api.depends('move_line_ids', 'move_line_ids.result_package_id', 'move_line_ids.product_uom_id', 'move_line_ids.qty_done')
def _compute_bulk_weight(self):
weight = 0.0
for move_line in self.move_line_ids:
@@ -92,7 +92,7 @@ def _wrap_low_level_message_around(self, high_level_message):

def _send_and_wait_for_ack(self, packet, serial):
ack = 0
MAX_RETRIES = 1
MAX_RETRIES = 1 # no more than 9

while ack != 0x06 and int(chr(packet[4])) < MAX_RETRIES:
serial.write(packet)
@@ -104,7 +104,7 @@ def _send_and_wait_for_ack(self, packet, serial):
# message so it's safe to do it. Also it would be a pain
# to have to throw this all the way back to js just so it
# can increment the retry counter and then try again.
packet = packet[:4] + str(int(packet[4]) + 1) + packet[5:]
packet[4] += 1

if ack:
ack = ord(ack)
@@ -141,11 +141,11 @@ def _send_to_blackbox(self, packet, response_size, device_path, just_wait_for_ac

if stx == chr(0x02) and etx == chr(0x03) and bcc and self._lrc(response) == ord(bcc):
got_response = True
ser.write(chr(0x06))
ser.write(chr(0x06).encode())
else:
_logger.warning("received ACK but not a valid response, sending NACK...")
sent_nacks += 1
ser.write(chr(0x15))
ser.write(chr(0x15).encode())

if not got_response:
_logger.error("sent " + str(MAX_NACKS) + " NACKS without receiving response, giving up.")
@@ -173,4 +173,9 @@ def request_blackbox(self, high_level_message, response_size):

@http.route('/hw_proxy/request_serial/', type='json', auth='none', cors='*')
def request_serial(self):
return subprocess.check_output("ifconfig eth0 | grep -o 'HWaddr.*' | sed 's/HWaddr \\(.*\\)/\\1/' | sed 's/://g'", shell=True).rstrip()[-7:]
try:
with open('/sys/class/net/eth0/address', 'rb') as f:
return f.read().rstrip().replace(b':', b'')[-7:]
except IOError as e:
_logger.warning("eth0 network interface MAC address could not be found")
return b''
@@ -30,6 +30,18 @@ odoo.define('payment.payment_form', function (require) {
$('[data-toggle="tooltip"]').tooltip();
},

disableButton: function (button) {
$(button).attr('disabled', true);
$(button).children('.fa-lock').removeClass('fa-lock');
$(button).prepend('<span class="o_loader"><i class="fa fa-refresh fa-spin"></i>&nbsp;</span>');
},

enableButton: function (button) {
$(button).attr('disabled', false);
$(button).children('.fa').addClass('fa-lock');
$(button).find('span.o_loader').remove();
},

payEvent: function (ev) {
ev.preventDefault();
var form = this.el;
@@ -84,10 +96,7 @@ odoo.define('payment.payment_form', function (require) {
return;
}

$(button).attr('disabled', true);
$(button).children('.fa-plus-circle').removeClass('fa-plus-circle')
$(button).prepend('<span class="o_loader"><i class="fa fa-refresh fa-spin"></i>&nbsp;</span>');

this.disableButton(button);
var verify_validity = this.$el.find('input[name="verify_validity"]');

if (verify_validity.length>0) {
@@ -122,14 +131,10 @@ odoo.define('payment.payment_form', function (require) {
}
}
// here we remove the 'processing' icon from the 'add a new payment' button
$(button).attr('disabled', false);
$(button).children('.fa').addClass('fa-plus-circle')
$(button).find('span.o_loader').remove();
self.enableButton(button);
}).fail(function (message, data) {
// if the rpc fails, pretty obvious
$(button).attr('disabled', false);
$(button).children('.fa').addClass('fa-plus-circle')
$(button).find('span.o_loader').remove();
self.enableButton(button);

self.displayError(
_t('Server Error'),
@@ -192,6 +197,7 @@ odoo.define('payment.payment_form', function (require) {
}
}
else { // if the user is using an old payment then we just submit the form
this.disableButton(button);
form.submit();
}
}
@@ -904,6 +904,9 @@ exports.PosModel = Backbone.Model.extend({
}}).done(function () {
invoiced.resolve();
done.resolve();
}).fail(function (error) {
invoiced.reject({code:401, message:'Backend Invoice', data:{order: order}});
done.reject();
});
} else {
// The order has been pushed separately in batch when
@@ -113,7 +113,7 @@ var RunningTourActionHelper = core.Class.extend({
$options.prop("selected", false).removeProp("selected");
var $selectedOption = $options.filter(function () { return $(this).val() === text; });
if ($selectedOption.length === 0) {
$selectedOption = $options.filter(function () { return $(this).text() === text; });
$selectedOption = $options.filter(function () { return $(this).text().trim() === text; });
}
$selectedOption.prop("selected", true);
this._click(values);
@@ -16,7 +16,7 @@ odoo.define('website_sale_delivery.checkout', function (require) {
var $amount_untaxed = $('#order_total_untaxed span.oe_currency_value');
var $amount_tax = $('#order_total_taxes span.oe_currency_value');
var $amount_total = $('#order_total span.oe_currency_value');
var $carrier_badge = $('#delivery_carrier input[name="delivery_type"][value=' + result.carrier_id + '] ~ .badge.hidden');
var $carrier_badge = $('#delivery_carrier input[name="delivery_type"][value=' + result.carrier_id + '] ~ .badge:not(.o_delivery_compute)');
var $compute_badge = $('#delivery_carrier input[name="delivery_type"][value=' + result.carrier_id + '] ~ .o_delivery_compute');
var $discount = $('#order_discounted');

@@ -34,9 +34,12 @@
<input t-att-value="delivery.id" t-att-id="'delivery_%i' % delivery.id" type="radio" name="delivery_type" t-att-checked="order.carrier_id and order.carrier_id.id == delivery.id and 'checked' or False" t-att-class="'hidden' if delivery_nb == 1 else ''"/>
<label class="label-optional" t-field="delivery.name" t-att-for="'delivery_%i' % delivery.id"/>
<t t-if="delivery.delivery_type == 'fixed'">
<span t-if="delivery.fixed_price > 0.0" class="badge pull-right"
t-field="delivery.fixed_price" t-options='{"widget": "monetary",
"from_currency": delivery.product_id.company_id.currency_id, "display_currency": website_sale_order.currency_id}'/>
<span t-if="delivery.fixed_price > 0.0" class="badge pull-right">
<t t-set="monetary_options" t-value='{"widget": "monetary",
"from_currency": delivery.product_id.company_id.currency_id, "display_currency": website_sale_order.currency_id}'/>
<t t-if="delivery.free_over" t-esc="delivery.rate_shipment(website_sale_order)['price']" t-options='monetary_options'/>
<t t-else="" t-esc="delivery.fixed_price" t-options='monetary_options'/>
</span>
<span t-else="" class="badge pull-right">Free</span>
</t>
<t t-else="">
@@ -17,7 +17,7 @@ Rafael Blasco rafael.blasco@tecnativa.com https://github.com/rafaelbn
Sergio Teruel sergio.teruel@tecnativa.com https://github.com/sergio-teruel
Carlos Dauden carlos.dauden@tecnativa.com https://github.com/carlosdauden
Jairo Llopis jairo.llopis@tecnativa.com https://github.com/yajo
Vicent Cubells vicent.cubells@tecnativa.com https://github.com/cubells
Luis Montalba luis.montalba@tecnativa.com https://github.com/luismontalba
David Vidal david.vidal@tecnativa.com https://github.com/chienandalu
Cristina Martín cristina.martin@tecnativa.com https://github.com/cristinamartinrod
Cristina Martín cristina.martin@tecnativa.com https://github.com/cristinamartinrod (up to 2019-04-30)
Ernesto Tejeda ernesto.tejeda@tecnativa.com https://github.com/ernestotejeda
Alexandre Díaz alexandre.diaz@tecnativa.com https://github.com/Tardo
@@ -99,7 +99,7 @@ Extra conditional branching directives ``t-elif`` and ``t-else`` are also
available::

<div>
<p t-if="user.birthday == today()">Happy bithday!</p>
<p t-if="user.birthday == today()">Happy birthday!</p>
<p t-elif="user.login == 'root'">Welcome master!</p>
<p t-else="">Welcome!</p>
</div>
@@ -447,7 +447,10 @@ def barcode(self, barcode_type, value, width=600, height=100, humanreadable=0):
)
return barcode.asString('png')
except (ValueError, AttributeError):
raise ValueError("Cannot convert into barcode.")
if barcode_type == 'Code128':
raise ValueError("Cannot convert into barcode.")
else:
return self.barcode('Code128', value, width=width, height=height, humanreadable=humanreadable)

@api.multi
def render_template(self, template, values=None):
@@ -607,11 +607,17 @@ def _prepare_update(self):
for view in views:
view._check_xml()
except Exception:
raise UserError("\n".join([
_("Cannot rename/delete fields that are still present in views:"),
_("Fields: %s") % ", ".join(str(f) for f in fields),
_("View: %s") % view.name,
]))
if not self._context.get(MODULE_UNINSTALL_FLAG):
raise UserError("\n".join([
_("Cannot rename/delete fields that are still present in views:"),
_("Fields: %s") % ", ".join(str(f) for f in fields),
_("View: %s") % view.name,
]))
else:
# uninstall mode
_logger.warn("The following fields were force-deleted to prevent a registry crash "
+ ", ".join(str(f) for f in fields)
+ " the following view might be broken %s" % view.name)
finally:
# the registry has been modified, restore it
self.pool.setup_models(self._cr)

0 comments on commit 825fee2

Please sign in to comment.
You can’t perform that action at this time.