Odoo Aide

0

0
2 Réponses
0
Avatar

michel Guénard France

--michel Guénard--

1093
| 5 5 10
VIROFLAY, France
--michel Guénard--

VP operations & finance Social entrepreneur Certified Public Accountant Past Chief internal auditor

michel Guénard France
03/03/2019 17:07

Thanks Niyas Raphy

I understand that your coding allows to

a) filter the contacts according to the search condition

    (but I don't know how to write the condition itself (search['name', 'ilike', 'biblio'] creates an error)

and b) replaces the field 'category_id' with ' ' )

This means that if 2 or more categories are attached to the contact, they will all be erased: Is this correct?

I need to erase only one known category, leaving the others if any.

How to achieve this? (I have hundreds of contacts to clean!

0
Avatar

Niyas Raphy Inde

--Niyas Raphy--
25449
| 7 7 11
Wayanad, Kerala, Inde
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

Twitter:https://twitter.com/niyasraphy
LinkedIn: https://www.linkedin.com/in/niyasraphy/
FB:https://www.facebook.com/niyasraphy123
Whatsapp : +917736136763
Happy to help :)

Niyas Raphy Inde
03/03/2019 07:37

Hi,

You can create a scheduled action for it and run it manually using the run manually button, after the use case just remove it. Create a scheduled action which executes the Python code and inside the Python code you can make the partner categories to empty based on the condition in code.


See the sample below,



Code:

partner_rec = env['res.partner'].search([])
# you can filter the unncessary partners using the condition in search
for partner in partner_rec:
  partner.write({'field_name':
''})


Thanks

Poser une question
Writer
Keep Informed
1 Abonné(e)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.

Register
Odoo Training Center

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

Test it now