Full Code:
from odoo import fields, models, api
class ExtraWeight(models.Model):
_name = 'courier.extra.weights'
_description = 'Charge setting for Extra Weight'
_rec_name = 'combination'
extra_weight = fields.Float(string='Next (KG)', required=True, translate=True)
extra_charge = fields.Float(string='Charge for next Weight (TK)', required=True, translate=True)
max_weight = fields.Float(string='Max Wight (KG)', required=True, translate=True)
combination = fields.Char('Combination', compute='_compute_fields_combination')
@api.depends('extra_weight', 'extra_charge')
def _compute_fields_combination(self):
for record in self:
record.combination = 'Extra Increment:' + str(record.extra_weight) + '(KG) Rate' + str(record.extra_charge) + '(TK) Max:'+str(record.max_weight)+'(KG)'
I want to set 'Extra Increment:' + str(record.extra_weight) + '(KG) Rate' + str(record.extra_charge) + '(TK) Max:'+str(record.max_weight)+'(KG)'
to combination
. But I am getting the following error:
COALESCE types text and double precision cannot be matched
LINE 1: ...CE("courier_extra_weights__extra_weight"."value", "courier_e..
Your code looks good to me. It seems Char
is not suitable as per your output length. Replace field type from Char
to Text