Odoo Help

Welcome!

This community 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.

0

Write problem [Closed]

By
Dr Obx
on 10/8/15, 6:08 AM 334 views

The Question has been closed for reason: not relevant or out dated

by
Dr Obx
on 10/08/2015 10:12:37

Guys, I my definition once I click on the "MOVE" button product should be taken off stock then state changed to 'done' and boolean field 'settled' changed to 'true'

but it doesn't work.

<pre>
 def stock_move(self, cr, uid, ids, context=None):
 current_obj = self.browse(cr, uid, ids[0])
 product_to_move = current_obj.product_id.id
 source_location = current_obj.location_id.id
 destination_location = current_obj.location_dest_id.id
 quantity_to_move = current_obj.quantitymove_id = self.pool.get('stock.move').create(cr, uid, {'product_id': product_to_move,'location_id': source_location, 'location_dest_id': destination_location,'product_uom_qty': quantity_to_move, 'invoice_state': 'none','date_expected': datetime.now(), 'product_uom':current_obj.product_uom.id,'name': current_obj.product_id.name}) self.pool.get('stock.move').action_done(cr, uid, move_id, context=context)
# if I add this line =>
self.write({'order_state': 'done', 'settled': True})
# i'm getting an error  required 4 given 2 and don't know what to do with it
return True
</pre>


2

Baiju

--Baiju--
3154
| 5 4 8
Kochi, India
--Baiju--
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

Baiju
On 10/8/15, 6:32 AM

HI,

You are using old api, so write method should be :-

self.write(cr, uid, ids, {'order_state': 'done', 'settled': True}, context=context)


Hope this help.

Works beautifully :) Thank you Baiju :)

Dr Obx
on 10/8/15, 9:33 AM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 10/8/15, 6:08 AM
Seen: 334 times
Last updated: 10/8/15, 10:12 AM