summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrien Dieudonne <adr@odoo.com>2017-07-19 15:21:59 +0200
committerAdrien Dieudonne <adr@odoo.com>2017-07-24 09:32:49 +0200
commita47d2d88d028d5a959650c9c8f62809340179fda (patch)
tree157783e1facaa82446c5e8b11e769fb9528fc19e
parent666b59484201004e2cd8890a9c09b6dcf023a725 (diff)
[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
-rw-r--r--addons/account/views/account_invoice_view.xml4
-rw-r--r--addons/account/views/account_view.xml8
-rw-r--r--addons/account/views/product_view.xml4
-rw-r--r--addons/account_voucher/views/account_voucher_views.xml4
-rw-r--r--addons/delivery/views/delivery_view.xml4
-rw-r--r--addons/hr_expense/views/hr_expense_views.xml4
-rw-r--r--addons/mass_mailing/views/mass_mailing_views.xml2
-rw-r--r--addons/membership/views/product_views.xml2
-rw-r--r--addons/mrp/views/mrp_bom_views.xml2
-rw-r--r--addons/mrp_repair/views/mrp_repair_views.xml8
-rw-r--r--addons/point_of_sale/views/pos_order_view.xml8
-rw-r--r--addons/purchase/views/purchase_views.xml6
-rw-r--r--addons/sale/views/sale_views.xml4
-rw-r--r--addons/stock/views/product_views.xml2
-rw-r--r--addons/web/static/src/js/services/data_manager.js2
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js22
-rw-r--r--addons/website_customer/views/res_partner_views.xml2
17 files changed, 50 insertions, 38 deletions
diff --git a/addons/account/views/account_invoice_view.xml b/addons/account/views/account_invoice_view.xml
index d22030ce7c4..2160872d84a 100644
--- a/addons/account/views/account_invoice_view.xml
+++ b/addons/account/views/account_invoice_view.xml
@@ -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"/>
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml
index 8a23e35a578..134ce6f5e04 100644
--- a/addons/account/views/account_view.xml
+++ b/addons/account/views/account_view.xml
@@ -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>
diff --git a/addons/account/views/product_view.xml b/addons/account/views/product_view.xml
index 6543d318260..5dc56426ed3 100644
--- a/addons/account/views/product_view.xml
+++ b/addons/account/views/product_view.xml
@@ -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"/>
diff --git a/addons/account_voucher/views/account_voucher_views.xml b/addons/account_voucher/views/account_voucher_views.xml
index ea279a24be2..ced7d16a4ef 100644
--- a/addons/account_voucher/views/account_voucher_views.xml
+++ b/addons/account_voucher/views/account_voucher_views.xml
@@ -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"/>
diff --git a/addons/delivery/views/delivery_view.xml b/addons/delivery/views/delivery_view.xml
index 2bc610a97e8..0148319cb26 100644
--- a/addons/delivery/views/delivery_view.xml
+++ b/addons/delivery/views/delivery_view.xml
@@ -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>
diff --git a/addons/hr_expense/views/hr_expense_views.xml b/addons/hr_expense/views/hr_expense_views.xml
index 7ede7d1efb7..baa339238a2 100644
--- a/addons/hr_expense/views/hr_expense_views.xml
+++ b/addons/hr_expense/views/hr_expense_views.xml
@@ -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>
diff --git a/addons/mass_mailing/views/mass_mailing_views.xml b/addons/mass_mailing/views/mass_mailing_views.xml
index 757b09ebfe6..7050b36a2bf 100644
--- a/addons/mass_mailing/views/mass_mailing_views.xml
+++ b/addons/mass_mailing/views/mass_mailing_views.xml
@@ -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>
diff --git a/addons/membership/views/product_views.xml b/addons/membership/views/product_views.xml
index e1509fce416..9651e2aa381 100644
--- a/addons/membership/views/product_views.xml
+++ b/addons/membership/views/product_views.xml
@@ -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"/>
diff --git a/addons/mrp/views/mrp_bom_views.xml b/addons/mrp/views/mrp_bom_views.xml
index 91d97018310..d4b839c69f1 100644
--- a/addons/mrp/views/mrp_bom_views.xml
+++ b/addons/mrp/views/mrp_bom_views.xml
@@ -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>
diff --git a/addons/mrp_repair/views/mrp_repair_views.xml b/addons/mrp_repair/views/mrp_repair_views.xml
index 9a4cd6d75b2..505f2d3abec 100644
--- a/addons/mrp_repair/views/mrp_repair_views.xml
+++ b/addons/mrp_repair/views/mrp_repair_views.xml
@@ -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>
diff --git a/addons/point_of_sale/views/pos_order_view.xml b/addons/point_of_sale/views/pos_order_view.xml
index 517c3b91a85..4c7698b5cac 100644
--- a/addons/point_of_sale/views/pos_order_view.xml
+++ b/addons/point_of_sale/views/pos_order_view.xml
@@ -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>
diff --git a/addons/purchase/views/purchase_views.xml b/addons/purchase/views/purchase_views.xml
index 701a2fb3a61..1cb8c567135 100644
--- a/addons/purchase/views/purchase_views.xml
+++ b/addons/purchase/views/purchase_views.xml
@@ -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>
diff --git a/addons/sale/views/sale_views.xml b/addons/sale/views/sale_views.xml
index 6cf32a9ba5b..d1b603fe750 100644
--- a/addons/sale/views/sale_views.xml
+++ b/addons/sale/views/sale_views.xml
@@ -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', '&gt;', 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', '&gt;', 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', '&gt;', 0)]}"/>
<field name="discount" groups="sale.group_discount_per_so_line"/>
<field name="price_subtotal" widget="monetary" groups="sale.group_show_price_subtotal"/>
diff --git a/addons/stock/views/product_views.xml b/addons/stock/views/product_views.xml
index af51d41212f..89524b980c8 100644
--- a/addons/stock/views/product_views.xml
+++ b/addons/stock/views/product_views.xml
@@ -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'])]}"/>
diff --git a/addons/web/static/src/js/services/data_manager.js b/addons/web/static/src/js/services/data_manager.js
index c1e69a72ce3..999a9d8df01 100644
--- a/addons/web/static/src/js/services/data_manager.js
+++ b/addons/web/static/src/js/services/data_manager.js
@@ -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 {};
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index 1a7badd353f..30b6acc2c40 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -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();
});
diff --git a/addons/website_customer/views/res_partner_views.xml b/addons/website_customer/views/res_partner_views.xml
index a756453c4f6..69c59989879 100644
--- a/addons/website_customer/views/res_partner_views.xml
+++ b/addons/website_customer/views/res_partner_views.xml
@@ -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>