many2many fileds are both are same values?
<p>I have this code:</p>

<p>In .py file:</p>

<pre><code>class newsaleorderline(models.Model):
    _inherit='sale.order.line'

    supply_tax_id = fields.Many2many('account.tax',string='Supply Taxes',domain=['|', ('active', '=', False), ('active', '=', True)])         
    labour_tax_id = fields.Many2many('account.tax',string='Labour Taxes',domain=['|', ('active', '=', False), ('active', '=', True)])
</code></pre>

<p>in .xml file:</p>

<pre><code>&lt;field name="supply_tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]" attrs="{'readonly': [('qty_invoiced', '&amp;gt;', 0)]}"/&gt;
&lt;field name="labour_tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]" attrs="{'readonly': [('qty_invoiced', '&amp;gt;', 0)]}"/&gt;
</code></pre>

<p>while i trying to change <code>supply_tax_id</code> it changes, but after save <code>supply_tax_id</code>,<code>labour_tax_id</code> both are same. I don't know how it's inter connected. I want <code>supply_tax_id</code> and <code>labour_tax_id</code> should be different values and fields should come from <code>account.tax</code>.</p>

<p>Pls help me to find this solution to problem. Thanks all for the suggestion.</p>

<p>Odoo is generating relational tables in your database. You can give table names by yourself on field definition:</p>

<pre class="lang-py prettyprint-override"><code>class MyModel(models.Model):
    _name = "my.model"

    my_m2m_field = fields.Many2Many(
        comodel_name="another.model", # required
        relation="my_model_another_model_rel", # optional
        column1="my_model_id", # optional
        column2="another_model_id", # optional
        string="Another Records" # optional
    )
</code></pre>

<p>Your example isn't using the <code>relation</code> parameter on field definition, so Odoo is generating a name by itself. It's using both model (table) names for it and adds an "_rel" on the end of the name:</p>

<p><code>sale_order_line_account_tax_rel</code></p>

<p>Problem here: You're using same both models on two different Many2Many fields, which will end up in one relational table. So on using the fields, both fields will represent the same data in client.</p>

<p><strong>Solution</strong>: Use the parameter <code>relation</code> and define two different names for the relation tables.</p>

python postgresql openerp