Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4358 มุมมอง

I have 2 fields of the type Char and i want to join them to one field. I get an Internal Server Error. Can someone tell me what is wring ?

Code:

from odoo import api, fields, models


class Tarief(models.Model):
_name = 'insurance.tarief'

name = fields.Char(compute='_compute_name', store="True")
code = fields.Char(string="Code")
omschrijving = fields.Char(string="Omschrijving Verrichting")
soort_tarief = fields.Selection([
('particulier tarieven','Particulier Tarieven'),
('szf tarieven','SZF Tarieven'),
('bzsr','BZSR')
],string="Soort Tarief")
categorie = fields.Many2one("insurance.categorie", string="Categorie")
tarief = fields.Float(string="Tarief")

@api.depends('code','omschrijving')
def _compute_name(self):
for record in self:
record.name = record.code + record.omschrijving


อวตาร
ละทิ้ง

See Customization Tips: https://goo.gl/8HgnCF

คำตอบที่ดีที่สุด

Hi,

Try 

record.name = str(record.code)+str(record.omschrijving)
อวตาร
ละทิ้ง