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

_name = "confirm.auction"    

product_id = fields.Char("Product",readonly= True)

customer_auc_id = fields.Many2one("res.user","Customer", readonly = True)

date_bid = fields.Date("Bid Date", readonly = True)

amt_bid = fields.Float("Bid Amount", readonly = True)

conf_auc_id = fields.Many2one("auction","Auction")

---------------------------------------------------------------------------------------------------------

_name = "bid"

 auc_id = fields.Char("Auction Id", readonly = True)

product_id = fields.Char("Product",readonly= True)

amount_auc = fields.Float("Amount")

state= fields.Selection([('publish','Publish'), ('cancel','Cancel'), ('done','Done') ],'Status',readonly=True,copy=False,select=True,default='draft')



@api.one

def bid_confirm(self):

    date = time.strftime("%Y-%m-%d") 

    auc = self.env['auction'].search([('auction_id','=',self.auc_id)])

     res = self.env['confirm.auction'].create({

                 'conf_auc_id':auc.id,

                 'product_id':self.product_id,

                 'customer_auc_id.id':self.write_uid.id,

                 'date_bid':date,

                 'amt_bid':self.amount_auc

    })


and if i remove id [ 'customer_auc_id':self.write_uid.id,  ]  so it is assign [  _unknown ,1 ]

i want to store customer name in m2o field customer_auc_id but it's not assigning correctly.

how to solve this issue?

Avatar
Discard
Best Answer

Hi,

I think you've a typo in the res.users name "you writing it : res.user" without 's'.

So try:

customer_auc_id = fields.Many2one("res.users","Customer", readonly = True)

and use:

'customer_auc_id': self.write_uid.id


Hope this could helps

Avatar
Discard
Author

Hi Ahmad,

i also try this but problem is it's print value is [ _unknown ,1 ]

did you restarted and upgrade your module, if yes could you please paste your final code ?

Author

_name = "confirm.auction"

customer_auc_id = fields.Many2one("res.user","Customer", readonly = True)

_name = "bid"

@api.one

def bid_confirm(self):

date = time.strftime("%Y-%m-%d")

auc = self.env['auction'].search([('auction_id','=',self.auc_id)])

res = self.env['confirm.auction'].create({

'conf_auc_id':auc.id,

'product_id':self.product_id.id,

'customer_auc_id':self.write_uid.id,

'date_bid':date,

'amt_bid':self.amount_auc

})

Author

It's print

[DPP] Early payment discount _unknown,1 11/25/2016 900.00

Man, You're still writing res.user it is res.users not res.user

Author

ohk. Thanks...dear