Odoo Help

3

0
2 Answers
2
Avatar

Pawan Kumar Sharma

--Pawan Kumar Sharma--
SunArc Technologies
8478
| 6 2 7
Bikaner, India
--Pawan Kumar Sharma--


Pawan Kumar Sharma
21/02/18, 04:51

Hello Manish,

def action_assign_button(self):

active_ids = self._context.get('active_id')

res = self.env['weight.calculator'].browse(active_ids)

# Table-1

batch_obj = res.weight_cal_machine

for b_obj in batch_obj:

if b_obj.select_pet == True: # select_pet = boolean field

# Record update in Table-1

b_obj.write({'batch_number': self.batch_no.batch_no})

record_obj = b_obj.env['batch.num'].search([])

for record in record_obj:

if record.batch_no == b_obj.batch_number:

batch_history = {'batch_obj': self.batch_no.id,

'process_opt': b_obj.process_opt.id,

'pet_load': res.sum, }

# Record create in Table-2

create_batch_history = self.env['batch.record'].create(batch_history)

print "batch_obj::::::::::::::;last", b_obj, b_obj.select_pet

if record.batch_obj_1:

print "Lastttttttt", record.batch_obj_1

b_obj.unlink()

return

You can change your code according to above. It may help you.

Thanks.

3 Comments
Manish Kumar Bohra
21/02/18, 04:56

Thanks @Pawan it's working...

Manish Kumar Bohra
21/02/18, 04:57

But can you tell me what is role of return in this case .. ?

SunArc Technologies, Pawan Kumar Sharma
21/02/18, 05:07

When condition fulfil then return value

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.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now