mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-08-17 16:54:42 -05:00
[PATCH] Upstream patch - 11102023
This commit is contained in:
@@ -18,7 +18,7 @@ class UoM(models.Model):
|
||||
'uom.product_uom_hour': 'HUR',
|
||||
'uom.product_uom_ton': 'TNE',
|
||||
'uom.product_uom_meter': 'MTR',
|
||||
'uom.product_uom_km': 'KTM',
|
||||
'uom.product_uom_km': 'KMT',
|
||||
'uom.product_uom_cm': 'CMT',
|
||||
'uom.product_uom_litre': 'LTR',
|
||||
'uom.product_uom_lb': 'LBR',
|
||||
|
||||
@@ -21,7 +21,7 @@ UOM_TO_UNECE_CODE = {
|
||||
'uom.product_uom_hour': 'HUR',
|
||||
'uom.product_uom_ton': 'TNE',
|
||||
'uom.product_uom_meter': 'MTR',
|
||||
'uom.product_uom_km': 'KTM',
|
||||
'uom.product_uom_km': 'KMT',
|
||||
'uom.product_uom_cm': 'CMT',
|
||||
'uom.product_uom_litre': 'LTR',
|
||||
'uom.product_uom_cubic_meter': 'MTQ',
|
||||
|
||||
@@ -87,8 +87,7 @@ class GeoCoder(models.AbstractModel):
|
||||
return None
|
||||
url = 'https://nominatim.openstreetmap.org/search'
|
||||
try:
|
||||
headers = {'User-Agent': self.env['ir.config_parameter'].sudo().get_param('base_geolocalize.user_agent',
|
||||
'Flectra (http://www.flectrahq.com/contactus)')}
|
||||
headers = {'User-Agent': 'Flectra (http://www.flectrahq.com/contactus)'}
|
||||
response = requests.get(url, headers=headers, params={'format': 'json', 'q': addr})
|
||||
_logger.info('openstreetmap nominatim service called')
|
||||
if response.status_code != 200:
|
||||
|
||||
@@ -840,6 +840,8 @@ class HolidaysRequest(models.Model):
|
||||
default['request_date_from'] = default.get('date_from')
|
||||
default['request_date_to'] = default.get('date_to')
|
||||
return super().copy_data(default)
|
||||
elif self.state in {"cancel", "refuse"}: # No overlap constraint in these cases
|
||||
return super().copy_data(default)
|
||||
raise UserError(_('A time off cannot be duplicated.'))
|
||||
|
||||
def _get_mail_redirect_suggested_company(self):
|
||||
|
||||
@@ -5,7 +5,6 @@ var widgetRegistry = require('web.widget_registry');
|
||||
var Widget = require('web.Widget');
|
||||
|
||||
var core = require('web.core');
|
||||
var rpc = require('web.rpc');
|
||||
|
||||
var QWeb = core.qweb;
|
||||
|
||||
@@ -38,7 +37,7 @@ var IAPBuyMoreCreditsWidget = Widget.extend({
|
||||
//--------------------------------------------------------------------------
|
||||
_getLink: function () {
|
||||
var self = this;
|
||||
return rpc.query({
|
||||
return this._rpc({
|
||||
model: 'iap.account',
|
||||
method: 'get_credits_url',
|
||||
args: [this.service_name],
|
||||
|
||||
@@ -139,7 +139,7 @@ flectra.define('web.pager_tests', function (require) {
|
||||
});
|
||||
|
||||
QUnit.test('pager disabling', async function (assert) {
|
||||
assert.expect(9);
|
||||
assert.expect(10);
|
||||
|
||||
const reloadPromise = testUtils.makeTestPromise();
|
||||
const pager = await createComponent(Pager, {
|
||||
@@ -162,9 +162,9 @@ flectra.define('web.pager_tests', function (require) {
|
||||
});
|
||||
const pagerButtons = pager.el.querySelectorAll('button');
|
||||
|
||||
// Click twice
|
||||
await cpHelpers.pagerNext(pager);
|
||||
// Click and check button is disabled
|
||||
await cpHelpers.pagerNext(pager);
|
||||
assert.ok(pager.el.querySelector('button.o_pager_next').disabled);
|
||||
// Try to edit the pager value
|
||||
await testUtils.dom.click(pager.el.querySelector('.o_pager_value'));
|
||||
|
||||
|
||||
@@ -1979,8 +1979,7 @@ QUnit.module('fields', {}, function () {
|
||||
await testUtils.dom.click(form.$('.o_external_button'));
|
||||
await testUtils.dom.click($('button:contains("Just do it !")'));
|
||||
assert.verifySteps(['action']);
|
||||
await testUtils.dom.click($('button:contains("Just don\'t do it !")'));
|
||||
assert.verifySteps([]); // the second button is disabled, it can't be clicked
|
||||
assert.ok($('button:contains("Just don\'t do it !")').get(0).disabled);
|
||||
|
||||
await testUtils.dom.click($('.modal .btn-secondary:contains(Discard)'));
|
||||
await testUtils.dom.click(form.$('.o_external_button'));
|
||||
|
||||
@@ -5921,7 +5921,6 @@ QUnit.module('fields', {}, function () {
|
||||
// click all buttons
|
||||
await testUtils.dom.click(form.$(btn1Disabled));
|
||||
await testUtils.dom.click(form.$(btn1Warn));
|
||||
await testUtils.dom.click(form.$(btn2Disabled));
|
||||
await testUtils.dom.click(form.$(btn2Warn));
|
||||
|
||||
// save the form
|
||||
|
||||
@@ -116,6 +116,9 @@ flectra.define('web.test_utils_dom', function (require) {
|
||||
if (typeof el === 'string') {
|
||||
el = $(el);
|
||||
}
|
||||
if (el.disabled || (el instanceof jQuery && el.get(0).disabled)) {
|
||||
throw new Error("Can't click on a disabled button");
|
||||
}
|
||||
if (_isEventTarget(el)) {
|
||||
// EventTarget
|
||||
matches = [el];
|
||||
|
||||
@@ -7388,7 +7388,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
|
||||
QUnit.test('multiple clicks on save should reload only once', async function (assert) {
|
||||
assert.expect(4);
|
||||
assert.expect(5);
|
||||
|
||||
var def = testUtils.makeTestPromise();
|
||||
|
||||
@@ -7420,7 +7420,7 @@ QUnit.module('Views', {
|
||||
await testUtils.form.clickEdit(form);
|
||||
await testUtils.fields.editInput(form.$('input[name="foo"]'), "test");
|
||||
await testUtils.form.clickSave(form);
|
||||
await testUtils.form.clickSave(form);
|
||||
assert.ok(form.$buttons.find('.o_form_button_save').get(0).disabled);
|
||||
|
||||
def.resolve();
|
||||
await testUtils.nextTick();
|
||||
|
||||
@@ -7310,7 +7310,7 @@ QUnit.module('Views', {
|
||||
});
|
||||
|
||||
QUnit.test('multiple clicks on Add do not create invalid rows', async function (assert) {
|
||||
assert.expect(2);
|
||||
assert.expect(3);
|
||||
|
||||
this.data.foo.onchanges = {
|
||||
m2o: function () {},
|
||||
@@ -7336,9 +7336,9 @@ QUnit.module('Views', {
|
||||
assert.containsN(list, '.o_data_row', 4,
|
||||
"should contain 4 records");
|
||||
|
||||
// click on Add twice, and delay the onchange
|
||||
testUtils.dom.click(list.$buttons.find('.o_list_button_add'));
|
||||
// click on Add and delay the onchange (check that the button is correctly disabled)
|
||||
testUtils.dom.click(list.$buttons.find('.o_list_button_add'));
|
||||
assert.ok(list.$buttons.find('.o_list_button_add').get(0).disabled);
|
||||
|
||||
prom.resolve();
|
||||
await testUtils.nextTick();
|
||||
|
||||
Reference in New Issue
Block a user