[FIX] *: wrong color_field attribute for m2m_tags
This fix previous commit a29f7f671b.
(1) Some objects have no color field.
(2) There was an issue when two many2many tags were instantiated:
If the first one had the 'color_field' attribute the second one
had it too even if this attribute weren't specified.
Now, it's fixed in data_manager
This commit is contained in:
@@ -273,7 +273,7 @@
|
||||
<field name="uom_id" groups="product.group_uom"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="discount" groups="base.group_no_one"/>
|
||||
<field name="invoice_line_tax_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" context="{'type':parent.type}"
|
||||
<field name="invoice_line_tax_ids" widget="many2many_tags" options="{'no_create': True}" context="{'type':parent.type}"
|
||||
domain="[('type_tax_use','=','purchase'),('company_id', '=', parent.company_id)]"/>
|
||||
<field name="price_subtotal"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
@@ -409,7 +409,7 @@
|
||||
<field name="uom_id" groups="product.group_uom"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="discount" groups="base.group_no_one"/>
|
||||
<field name="invoice_line_tax_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" context="{'type':parent.type}"
|
||||
<field name="invoice_line_tax_ids" widget="many2many_tags" options="{'no_create': True}" context="{'type':parent.type}"
|
||||
domain="[('type_tax_use','=','sale'),('company_id', '=', parent.company_id)]"/>
|
||||
<field name="price_subtotal"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
|
||||
@@ -261,8 +261,8 @@
|
||||
<group>
|
||||
<group string="Control-Access" groups="base.group_no_one">
|
||||
<div class="text-muted" colspan="2">Keep empty for no control</div>
|
||||
<field name="type_control_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="account_control_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="type_control_ids" widget="many2many_tags"/>
|
||||
<field name="account_control_ids" widget="many2many_tags"/>
|
||||
</group>
|
||||
<group string="Miscellaneous">
|
||||
<field name="inbound_payment_method_ids" widget="many2many_checkboxes" attrs="{'invisible': [('type', 'not in', ['bank', 'cash'])]}"/>
|
||||
@@ -1892,8 +1892,8 @@
|
||||
<field name="name"/>
|
||||
<field name="attribute_value_ids" widget="many2many_tags" groups="product.group_product_variant"/>
|
||||
<field name="lst_price"/>
|
||||
<field name="taxes_id" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="supplier_taxes_id" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="taxes_id" widget="many2many_tags"/>
|
||||
<field name="supplier_taxes_id" widget="many2many_tags"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
<field name="property_account_income_id"
|
||||
domain="[('internal_type','=','other'),('deprecated','=',False)]"
|
||||
groups="account.group_account_user"/>
|
||||
<field name="taxes_id" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="taxes_id" widget="many2many_tags"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="property_account_expense_id"
|
||||
domain="[('internal_type','=','other'),('deprecated','=',False)]"
|
||||
groups="account.group_account_user"/>
|
||||
<field name="supplier_taxes_id" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="supplier_taxes_id" widget="many2many_tags"/>
|
||||
</group>
|
||||
</group>
|
||||
<group name="accounting"/>
|
||||
|
||||
@@ -253,7 +253,7 @@
|
||||
<field name="account_analytic_id" domain="[('company_id', '=', parent.company_id)]" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="quantity"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="tax_ids" widget="many2many_tags" options="{'color_field': 'color'}" domain="[('type_tax_use','=','sale')]"/>
|
||||
<field name="tax_ids" widget="many2many_tags" domain="[('type_tax_use','=','sale')]"/>
|
||||
<field name="price_subtotal"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
@@ -369,7 +369,7 @@
|
||||
<field name="account_analytic_id" domain="[('company_id', '=', parent.company_id)]" groups="analytic.group_analytic_accounting"/>
|
||||
<field name="quantity"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="tax_ids" widget="many2many_tags" options="{'color_field': 'color'}" domain="[('type_tax_use','=','purchase')]"/>
|
||||
<field name="tax_ids" widget="many2many_tags" domain="[('type_tax_use','=','purchase')]"/>
|
||||
<field name="price_subtotal"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
|
||||
@@ -107,8 +107,8 @@
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
<field name="country_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="state_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="country_ids" widget="many2many_tags"/>
|
||||
<field name="state_ids" widget="many2many_tags"/>
|
||||
</group>
|
||||
<group></group>
|
||||
<group>
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
</group>
|
||||
<group string="Accounting">
|
||||
<field name="property_account_expense_id"/>
|
||||
<field name="supplier_taxes_id" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="supplier_taxes_id" widget="many2many_tags"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
@@ -464,7 +464,7 @@
|
||||
<field name="message_unread" invisible="1"/>
|
||||
<field name="attachment_number" string=" "/>
|
||||
<button name="action_get_attachment_view" string="View Attachments" type="object" icon="fa-paperclip"/>
|
||||
<field name="tax_ids" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="tax_ids" widget="many2many_tags"/>
|
||||
<field name="total_amount" sum="Total Amount" widget="monetary"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -355,7 +355,7 @@
|
||||
context="{'search_default_not_opt_out':1}"/>
|
||||
<div attrs="{'invisible': [('mailing_model', '!=', 'mail.mass_mailing.list')]}">
|
||||
<label for="contact_list_ids" string="Select mailing lists:" class="oe_edit_only"/>
|
||||
<field name="contact_list_ids" widget="many2many_tags" options="{'color_field': 'color'}"
|
||||
<field name="contact_list_ids" widget="many2many_tags"
|
||||
placeholder="Select mailing lists..." class="oe_inline"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<field name="list_price" string="Membership Fee"/>
|
||||
<field
|
||||
name="property_account_income_id"/>
|
||||
<field name="taxes_id" widget="many2many_tags" options="{'color_field': 'color'}" string="Taxes"/>
|
||||
<field name="taxes_id" widget="many2many_tags" string="Taxes"/>
|
||||
</group>
|
||||
</group>
|
||||
<label for="description"/>
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<button name="action_see_attachments" type="object" icon="fa-file" attrs="{'invisible': [('has_attachments', '=', True)]}"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom_id" options="{'no_open':True,'no_create':True}" groups="product.group_uom"/>
|
||||
<field name="attribute_value_ids" widget="many2many_tags" options="{'color_field': 'color', 'no_create': True}" domain="[('product_ids.product_tmpl_id', '=', parent.product_tmpl_id)]" groups="product.group_product_variant"/>
|
||||
<field name="attribute_value_ids" widget="many2many_tags" options="{'no_create': True}" domain="[('product_ids.product_tmpl_id', '=', parent.product_tmpl_id)]" groups="product.group_product_variant"/>
|
||||
<field name="operation_id" groups="mrp.group_mrp_routings" domain="[('routing_id', '=', parent.routing_id)]" options="{'no_quick_create':True,'no_create_edit':True}"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
</div>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="tax_id" widget="many2many_tags" options="{'color_field': 'color'}" domain="[('type_tax_use','=','sale')]"/>
|
||||
<field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale')]"/>
|
||||
<field name="invoiced" invisible="1"/>
|
||||
<field name="price_subtotal" widget="monetary" invisible="1"/>
|
||||
</group>
|
||||
@@ -117,7 +117,7 @@
|
||||
<field name="product_uom_qty" string="Quantity"/>
|
||||
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="tax_id" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="tax_id" widget="many2many_tags"/>
|
||||
<field name="price_subtotal" widget="monetary"/>
|
||||
</tree>
|
||||
</field>
|
||||
@@ -146,7 +146,7 @@
|
||||
<field name="product_uom" groups="product.group_uom"/>
|
||||
</div>
|
||||
<field name="price_unit"/>
|
||||
<field widget="many2many_tags" options="{'color_field': 'color'}" name="tax_id" domain="[('type_tax_use','=','sale')]"/>
|
||||
<field widget="many2many_tags" name="tax_id" domain="[('type_tax_use','=','sale')]"/>
|
||||
<field name="price_subtotal" widget="monetary" invisible="1"/>
|
||||
</group>
|
||||
</form>
|
||||
@@ -156,7 +156,7 @@
|
||||
<field name="product_uom_qty" string="Quantity"/>
|
||||
<field name="product_uom" string="Unit of Measure" groups="product.group_uom"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="tax_id" domain="[('type_tax_use', '=', 'sale')]" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="tax_id" domain="[('type_tax_use', '=', 'sale')]" widget="many2many_tags"/>
|
||||
<field name="price_subtotal" widget="monetary"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
<field name="qty"/>
|
||||
<field name="price_unit" widget="monetary"/>
|
||||
<field name="discount" widget="monetary"/>
|
||||
<field name="tax_ids_after_fiscal_position" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="tax_ids" widget="many2many_tags" options="{'color_field': 'color'}" invisible="1"/>
|
||||
<field name="tax_ids_after_fiscal_position" widget="many2many_tags"/>
|
||||
<field name="tax_ids" widget="many2many_tags" invisible="1"/>
|
||||
<field name="price_subtotal" widget="monetary"/>
|
||||
<field name="price_subtotal_incl" widget="monetary"/>
|
||||
</tree>
|
||||
@@ -50,8 +50,8 @@
|
||||
<field name="price_unit" widget="monetary"/>
|
||||
<field name="price_subtotal" invisible="1" widget="monetary"/>
|
||||
<field name="price_subtotal_incl" invisible="1" widget="monetary"/>
|
||||
<field name="tax_ids_after_fiscal_position" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="tax_ids" widget="many2many_tags" options="{'color_field': 'color'}" invisible="1"/>
|
||||
<field name="tax_ids_after_fiscal_position" widget="many2many_tags"/>
|
||||
<field name="tax_ids" widget="many2many_tags" invisible="1"/>
|
||||
<field name="notice"/>
|
||||
</group>
|
||||
</form>
|
||||
|
||||
@@ -224,7 +224,7 @@
|
||||
<field name="qty_invoiced" invisible="not context.get('show_purchase', False)"/>
|
||||
<field name="product_uom" groups="product.group_uom" attrs="{'readonly': [('state', 'in', ('purchase', 'done', 'cancel'))]}"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="taxes_id" widget="many2many_tags" options="{'color_field': 'color'}" domain="[('type_tax_use','=','purchase')]" context="{'default_type_tax_use': 'purchase'}"/>
|
||||
<field name="taxes_id" widget="many2many_tags" domain="[('type_tax_use','=','purchase')]" context="{'default_type_tax_use': 'purchase'}"/>
|
||||
<field name="price_subtotal" widget="monetary"/>
|
||||
</tree>
|
||||
<form string="Purchase Order Line">
|
||||
@@ -242,7 +242,7 @@
|
||||
<field name="price_unit"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="taxes_id" widget="many2many_tags" options="{'color_field': 'color'}" domain="[('type_tax_use', '=', 'purchase')]"/>
|
||||
<field name="taxes_id" widget="many2many_tags" domain="[('type_tax_use', '=', 'purchase')]"/>
|
||||
<field name="date_planned" widget="date"/>
|
||||
<field name="account_analytic_id" colspan="2" groups="purchase.group_analytic_accounting"/>
|
||||
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
|
||||
@@ -609,7 +609,7 @@
|
||||
<field name="property_account_expense_id" domain="[('deprecated','=',False)]" attrs="{'readonly': [('purchase_ok', '=', 0)]}" groups="account.group_account_user"/>
|
||||
</field>
|
||||
<field name='supplier_taxes_id' position="replace" >
|
||||
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags" options="{'color_field': 'color'}" attrs="{'readonly':[('purchase_ok','=',0)]}"/>
|
||||
<field name="supplier_taxes_id" colspan="2" widget="many2many_tags" attrs="{'readonly':[('purchase_ok','=',0)]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -237,7 +237,7 @@
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
<field name="tax_id" widget="many2many_tags" options="{'color_field': 'color'}" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"
|
||||
<field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"
|
||||
attrs="{'readonly': [('qty_invoiced', '>', 0)]}"/>
|
||||
<label for="customer_lead"/>
|
||||
<div>
|
||||
@@ -281,7 +281,7 @@
|
||||
<field name="analytic_tag_ids" groups="analytic.group_analytic_accounting" widget="many2many_tags" options="{'color_field': 'color'}"/>
|
||||
<field name="price_unit"
|
||||
attrs="{'readonly': [('qty_invoiced', '>', 0)]}"/>
|
||||
<field name="tax_id" widget="many2many_tags" options="{'color_field': 'color'}" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"
|
||||
<field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"
|
||||
attrs="{'readonly': [('qty_invoiced', '>', 0)]}"/>
|
||||
<field name="discount" groups="sale.group_discount_per_so_line"/>
|
||||
<field name="price_subtotal" widget="monetary" groups="sale.group_show_price_subtotal"/>
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
<group name="inventory">
|
||||
<group>
|
||||
<field name="route_ids" widget="many2many_checkboxes" attrs="{'invisible':[('type', 'in', ['service', 'digital'])]}"/>
|
||||
<field name="route_from_categ_ids" widget="many2many_tags" options="{'color_field': 'color'}" readonly="1" attrs="{'invisible':[('route_from_categ_ids', '=', [])]}"/>
|
||||
<field name="route_from_categ_ids" widget="many2many_tags" readonly="1" attrs="{'invisible':[('route_from_categ_ids', '=', [])]}"/>
|
||||
</group>
|
||||
<group name="group_lots_and_weight">
|
||||
<label for="weight" attrs="{'invisible':[('type', 'not in', ['product', 'consu'])]}"/>
|
||||
|
||||
@@ -349,7 +349,7 @@ return core.Class.extend({
|
||||
}
|
||||
if (attrs.Widget.prototype.fieldsToFetch) {
|
||||
attrs.viewType = 'default';
|
||||
attrs.relatedFields = attrs.Widget.prototype.fieldsToFetch;
|
||||
attrs.relatedFields = _.extend({}, attrs.Widget.prototype.fieldsToFetch);
|
||||
attrs.fieldsInfo = {
|
||||
default: _.mapObject(attrs.Widget.prototype.fieldsToFetch, function () {
|
||||
return {};
|
||||
|
||||
@@ -6156,32 +6156,44 @@ QUnit.module('relational_fields', {
|
||||
|
||||
QUnit.module('FieldMany2ManyTags');
|
||||
|
||||
QUnit.test('fieldmany2many tags without color', function (assert) {
|
||||
assert.expect(4);
|
||||
QUnit.test('fieldmany2many tags with and without color', function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
this.data.partner.fields.partner_ids = {string: "Partner", type: "many2many", relation: 'partner'};
|
||||
var form = createView({
|
||||
View: FormView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
arch:'<form string="Partners">' +
|
||||
'<field name="partner_ids" widget="many2many_tags" options="{\'color_field\': \'color\'}"/>' +
|
||||
'<field name="timmy" widget="many2many_tags"/>' +
|
||||
'</form>',
|
||||
mockRPC: function (route, args) {
|
||||
if (args.method ==='read' && args.model === 'partner_type') {
|
||||
assert.deepEqual(args.args , [[12], ['display_name']], "should not read any color field");
|
||||
} else if (args.method ==='read' && args.model === 'partner') {
|
||||
assert.deepEqual(args.args , [[1], ['display_name', 'color']], "should read color field");
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
});
|
||||
var $input = form.$('.o_field_many2manytags input');
|
||||
|
||||
// add a tag on field partner_ids
|
||||
var $input = form.$('.o_field_many2manytags[name="partner_ids"] input');
|
||||
$input.click(); // opens the dropdown
|
||||
$input.autocomplete('widget').find('li:first()').click(); // adds a tag
|
||||
|
||||
// add a tag on field timmy
|
||||
$input = form.$('.o_field_many2manytags[name="timmy"] input');
|
||||
$input.click(); // opens the dropdown
|
||||
assert.strictEqual($input.autocomplete('widget').find('li').length, 3,
|
||||
"autocomplete dropdown should have 3 entries (2 values + 'Search and Edit...')");
|
||||
$input.autocomplete('widget').find('li:first()').click(); // adds a tag
|
||||
assert.strictEqual(form.$('.o_field_many2manytags > span').length, 1,
|
||||
assert.strictEqual(form.$('.o_field_many2manytags[name="timmy"] > span').length, 1,
|
||||
"should contain 1 tag");
|
||||
assert.ok(form.$('.o_field_many2manytags > span:contains("gold")').length,
|
||||
assert.ok(form.$('.o_field_many2manytags[name="timmy"] > span:contains("gold")').length,
|
||||
"should contain newly added tag 'gold'");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='company_id']" position="after">
|
||||
<field name="website_tag_ids" widget="many2many_tags" options="{'color_field': 'color'}" string="Website Tags"/>
|
||||
<field name="website_tag_ids" widget="many2many_tags" string="Website Tags"/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user