Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
4 Trả lời
4829 Lượt xem

@api.model
    def get_default(self):
        res = self.env['account.payment.term'].search([('name','=','45 Net Days')])
        return res.id or False
    payment_term_id = fields.Many2one('account.payment.term', 'Payment Terms',default=get_default)

how to display the '45 Net Days' in the payment_term_id stable while creating the default term is not being displayed properly how to solve this

Thanks In advance...

Ảnh đại diện
Huỷ bỏ
Tác giả

I am getting the value but in the field 'payment_term_id' the value '45 Net days' is not displaying when create button is clicked it is not stable

Tác giả

my field value is getting invisible its not properly setting into the field

kindly help



thanks

Câu trả lời hay nhất

hello,

To a many2one field dont return id return the record , try this

return self.env['account.payment.term'].search([('name','=','45 Net Days')])

Ảnh đại diện
Huỷ bỏ