Skip to Content
Menu
This question has been flagged
1 Reply
1331 Views

Hi All,

I am after some guidance on adding some python code to the following automated scheduled action for 1 product which gets manufactured at the same time every day to save time. 


Avatar
Discard
Best Answer
You can create schedule action which excute following method every day. 

model.create_mo()

you may refer below code for your reference where you have to provide product browse record and other required values accordingly.

def create_mo(self):
bom_id = self.env['mrp.bom']._bom_find(
product_tmpl=self.product_id.product_tmpl_id,
product=self.product_id)
mrpobj = self.env['mrp.production']
default_values = mrpobj.default_get(list(mrpobj.fields_get()))
default_values.update({
'product_id': self.product_id.id,
'product_uom_id': self.product_id.uom_id.id,
'product_qty': self.product_uom_qty,
'bom_id': bom_id.id or False,
})
mo_id = self.env['mrp.production'].create(default_values)
mo_id._onchange_move_finished_product()

Thanks & Regards,



CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat 380015
    

Avatar
Discard
Related Posts Replies Views Activity
0
May 24
326
1
Mar 24
291
1
Jun 24
653
1
Jan 24
409
1
Oct 22
1110