خرید بک لینک

Vote count: 0

My aim is to create a CRM-Lead extension module in Odoo. My modules aim is to add certain more fields to the Lead section in The CRM Odoo module. I created a module code which is working fine but one problem is that I have a field named percentage in it, which should calculate like amount * 100 & store in database. So for that I used compute attribute in Model. But its is not calculating the value... I will provide my code below :-

from openerp import models, fields, api

class legacy_sales(models.Model):
    _inherit='crm.lead'

    legacy_description = fields.Text(string="Comments")
    legacy_amount = fields.Float(string="Amount")
    legacy_startdate = fields.Date(string="StartDate")
    legacy_percentage = fields.Float(compute='_compute_percentage',store=True)

    @api.depends('legacy_amount')
    def _compute_percentage(self):
        self.legacy_percentage = self.legacy_amount * 100


legacy_sales()  

Here legacy_percentage is not storing calculated value in database.. please give advice:-

asked 53 secs ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 16 اسفند 1394 ساعت: 17:17

صفحه بندی