简体   繁体   中英

How do i transfer a value from transient object to a non transient object in openerp 6

class stock_transfer(osv.osv):
    _inherit="stock.transfer"
    _columns={
        'psd_allow_logo':fields.boolean('Alow Logo'),

    }
stock_transfer()

class indent_report(osv.osv_memory):
    _inherit = "indent.report"
    _columns = {
        'psd_allow_logo':fields.boolean('Alow Logo'),
        }

    def write(self, cr, uid, ids, psd_allow_logo, context = None):
       res = super(indent_report, self).write(cr, uid, ids, values, context = active_ids)
       if 'psd_allow_logo' in values:
            for res in self.browse(cr, uid, ids, context = active_ids):
              self.pool.get('stock.transfer').write(cr, uid, [res.stock_transfer_id.id], {'psd_allow_logo': values['psd_allow_logo'],}, context = active_ids) 
            return res
 #  if rec.psd_allow_logo:
         #      self.pool.get('stock.transfer').write(cr, uid, ids, {'psd_allow_logo' : True}, context=context)
            # else:
         #      self.pool.get('stock.transfer').write(cr, uid, ids, {'psd_allow_logo' : False}, context=context)

indent_report()

I am trying to change change the stock_transfer.psd_allow_logo when changed in indent_report.psd_allow_logo but the write isn't working & i have even tried

    self.pool.get('stock.transfer').write(cr,uid,active_ids[0],{'psd_allow_logo':rec.psd_allow_logo})

将其添加到indent.report解决了该问题,我丢失了active_ids

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM