Odoo Ayuda


1 Respuesta

Niyas Raphy India

--Niyas Raphy--
| 7 7 11
Wayanad, Kerala, India
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to connect :  niyasraphyk@gmail.com

LinkedIn: https://www.linkedin.com/in/niyasraphy/
Whatsapp : +917736136763
Happy to help :)

Niyas Raphy India
11/1/18 0:28


self.copy is enough for taking a copy of the current record. On clicking the button a new record , which is duplicate of current record will be created.


7 Comentarios
Manish Kumar Bohra India
11/1/18 0:32

If i want to open duplicate sale order on other other model, then what should i do?

I have customer id(sale order id) on that model.

Niyas Raphy India
11/1/18 0:46

Didn't understand, are you looking to take copy of the sale order from other model ?

Manish Kumar Bohra India
11/1/18 0:51


Niyas Raphy India
11/1/18 1:13

try something like this , self.env['model_name'].search([('id', '=', 5)]).copy()

Manish Kumar Bohra India
11/1/18 1:21

Thanks @Niyas,

self.env['operation.process'].search([('id', '=',self.pro_customer_id)]).copy()

Then i getting :

ValueError: Expected singleton: operation.process()

Niyas Raphy India
11/1/18 2:05

try this, self.env['operation.process'].search([('id', '=',self.pro_customer_id)], limit=1).copy()

this will return only one record, for your case we are getting multiple results in search either you have to use ensure_one or iterate the record over the for loop

Manish Kumar Bohra India
11/1/18 2:14

Hello @Niyas,

still getting this error

File "/opt/odoo10/odoo/odoo/models.py", line 4388, in copy


File "/opt/odoo10/odoo/odoo/models.py", line 4822, in ensure_one

raise ValueError("Expected singleton: %s" % self)

ValueError: Expected singleton: operation.process()

for code:-


def dup_line(self):

print "Copyyyyyyyyyyyyyyy"

self.env['operation.process'].search([('id', '=',self.pro_customer_id)], limit=1).copy()

Realizar una pregunta
Keep Informed
1 seguidor(es)
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