This question has been flagged
3163 Views

Hi All , I Tried To Use Write Method inside Button WorkFlow To Update filed In account.asset.asset Module But no Changes Happened For This Field

And This Is My Code

 def action_done(self, cr, uid, ids, context=None):
        mro_obj = self.pool.get('mro.order')
        for records_lines_time in mro_obj.browse(cr, uid, ids):
            Execution_date = records_lines_time.date_execution
            asset_ids = records_lines_time.asset_id
    assets_obj = self.pool.get('account.asset.asset')
    assets_obj.write(cr,uid,[asset_ids.id],{'last_fixing' : Execution_date},context=context)

    for order in self.browse(cr, uid, ids, context=context):
        self.pool.get('stock.move').action_done(cr, uid, [x.id for x in order.parts_move_lines])
    self.write(cr, uid, ids, {'state': 'done', 'date_execution': time.strftime('%Y-%m-%d %H:%M:%S')})
    return True

Please I Need Help

Thanks A Lot

Avatar
Discard

Debug your code before write method print "asset_id", asset_ids.id If id prints write method update the records.