Odoo Help

0

0
2 Answers
0
Avatar

michel Guénard

--michel Guénard--

1088
| 5 5 10
VIROFLAY, فرنسا
--michel Guénard--

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

michel Guénard
3‏/3‏/2019 5: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

--Niyas Raphy--
15188
| 7 6 11
Calicut, الهند
--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

Happy to help :)

Niyas Raphy
3‏/3‏/2019 7: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

Ask a Question
Writer
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.

Register
Odoo Training Center

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

Test it now