[MERGE] forward port branch 11.0 up to 9b602ae648
This commit is contained in:
@@ -394,7 +394,8 @@ var NumpadWidget = PosBaseWidget.extend({
|
||||
this.$el.find('.mode-button').click(_.bind(this.clickChangeMode, this));
|
||||
},
|
||||
applyAccessRights: function() {
|
||||
var has_price_control_rights = !this.pos.config.restrict_price_control || this.pos.get_cashier().role == 'manager';
|
||||
var cashier = this.pos.get('cashier') || this.pos.get_cashier();
|
||||
var has_price_control_rights = !this.pos.config.restrict_price_control || cashier.role == 'manager';
|
||||
this.$el.find('.mode-button[data-mode="price"]')
|
||||
.toggleClass('disabled-mode', !has_price_control_rights)
|
||||
.prop('disabled', !has_price_control_rights);
|
||||
|
||||
@@ -491,7 +491,7 @@ var DomainSelector = DomainTree.extend({
|
||||
}
|
||||
var parsedDomain = this._parseDomain(domain);
|
||||
if (parsedDomain) {
|
||||
return this._redraw(domain);
|
||||
return this._redraw(parsedDomain);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -4594,6 +4594,43 @@ QUnit.module('basic_fields', {
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('domain field can be reset with a new domain (from onchange)', function (assert) {
|
||||
assert.expect(2);
|
||||
|
||||
this.data.partner.records[0].foo = '[]';
|
||||
this.data.partner.onchanges = {
|
||||
display_name: function (obj) {
|
||||
obj.foo = '[["id", "=", 1]]';
|
||||
},
|
||||
};
|
||||
|
||||
var form = createView({
|
||||
View: FormView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch:
|
||||
'<form>' +
|
||||
'<field name="display_name"/>' +
|
||||
'<field name="foo" widget="domain" options="{\'model\': \'partner\'}"/>' +
|
||||
'</form>',
|
||||
res_id: 1,
|
||||
viewOptions: {
|
||||
mode: 'edit',
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(form.$('.o_domain_show_selection_button').text().trim(), '5 record(s)',
|
||||
"the domain being empty, there should be 5 records");
|
||||
|
||||
// update display_name to trigger the onchange and reset foo
|
||||
form.$('.o_field_widget[name=display_name]').val('new value').trigger('input');
|
||||
|
||||
assert.equal(form.$('.o_domain_show_selection_button').text().trim(), '1 record(s)',
|
||||
"the domain has changed, there should be only 1 record");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('domain field: handle false domain as []', function (assert) {
|
||||
assert.expect(3);
|
||||
|
||||
|
||||
@@ -905,6 +905,12 @@ actual arch.
|
||||
'datetime',
|
||||
'relativedelta',
|
||||
'current_date',
|
||||
'abs',
|
||||
'len',
|
||||
'bool',
|
||||
'float',
|
||||
'str',
|
||||
'unicode',
|
||||
}
|
||||
|
||||
def get_attrs_field_names(self, arch, model, editable):
|
||||
|
||||
Reference in New Issue
Block a user