Odoo Help

4 Answers

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
| 7 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 




ERP Harbor Consulting Services

Website: http://www.erpharbor.com
Sudhir Arya (ERP Harbor Consulting Services)
1/10/19, 1:07 AM

Better to create a new field for m2m and then move the data from m2o to m2m using script.


my_m2m_ids = fields.Many2many(......)

# Script code to move the m2o data to m2m
def move_m2o_to_m2m(self):
for rec in self.search([('my_m2o_field_id', '!=', False)]): # Search all the records that have value in m2o field
rec.write({'my_m2m_ids': [(6, 0, [rec.my_m2o_field_id.id])]}) # Move data from m2o to m2m

This way you can move all the data for an object from m2o to m2m field.

1/10/19, 6:53 AM

from openerp import models, fields, api,_

import openerp.addons.decimal_precision as dp

from math import *

class traceur(models.Model):

     _inherit = ['account.analytic.account']  

     traceur_ids = fields.One2many('contrat_traceur', 'contract_id', 'Traceurs')

     contrat_traceur_ids = fields.Many2many('contrat_traceur')


     # Script code to move the m2o data to m2m


def convert_o2m(self):

        for rec in self.search([('traceur_ids', '!=', False)]):

         rec.write({'contrat_traceur_ids': [(6, 0, [rec.traceur_ids.id])]})



    def compute_tva(self):


IndentationError: unexpected indent

Sudhir Arya (ERP Harbor Consulting Services)
1/11/19, 6:15 AM

def convert_o2m(self):

This should be exactly align with the @api.multi

In python everything is indented by 1 tab (4 spaces) instead of braces.

1/11/19, 6:20 AM

please i need to print the date of a field one2many but still they display empty content

contrat_traceur_ids = fields.One2many('contrat_traceur', 'contract_id', 'Traceurs')

in template Qweb :

<t t-foreach="o.contrat_traceur_ids" t-as="t">

<td class="text-center"><span t-field="t.name"/></td>

<td class="text-center"><span t-field="t.num_appel"/></td>

<td class="text-center"><span t-field="t.activation_tt_date"/></td>

<td class="text-center"><span t-field="t.application"/></td>


thank you

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now