功能字段 odoo 类型 float , new api

functional field odoo type float , new api

我正在尝试对一个字段进行操作 *,我已经尝试过功能字段但它没有用,现在我正在尝试这个@api.depends api,行吗与 odoo 8 一起工作?还是不行

class fleuret(osv.Model):           
    _inherit = "mrp.bom.line"
    _columns = {
                'unit_price' : fields.float(string='unit price', related='product_id.lst_price', store=True, readonly=True),
                'amount' : fields.Float(string='price ',store=True, readonly=True,digits=dp.get_precision('Account'),compute='_compute_price'),
                }
    @api.one       
    @api.depends('product_qty')
    def _compute_price(self):
        self.amount =(unit_price * self.product_qty)
from openerp import models,fields,api
import openerp.addons.decimal_precision as dp

class fleuret(models.Model)
    _inherit = "mrp.bom.line"

    @api.one       
    @api.depends('product_qty')
    def _compute_price(self):
        self.amount =(self.unit_price * self.product_qty)

    unit_price = fields.Float(string='unit price', related='product_id.lst_price', store=True, readonly=True)
    amount = fields.Float(string='price',store=True,digits=dp.get_precision('Account'),compute='_compute_price')
from openerp import models, fields, api
import openerp.addons.decimal_precision as dp

class fleuret(models.Model)
    _inherit = "mrp.bom.line"


    unit_price = fields.Float(
        string='unit price', related='product_id.lst_price',
        store=True, readonly=True)
    amount = fields.Float(
        string='price', store=True, digits=dp.get_precision('Account'),
        compute='_compute_price')

    @api.multi
    @api.depends('product_qty', 'unit_price')
    def _compute_price(self):
        for r in self:
            r.amount = r.unit_price * r.product_qty
from openerp.osv import osv, fields
from openerp import models,api, _
import openerp.addons.decimal_precision as dp
class fleuret(osv.Model):           
    _inherit = "mrp.bom.line"
    _columns = {
                'unit_price' : fields.float(string='unit price', related='product_id.lst_price', store=True, readonly=True),
                'units_price' : fields.float(string='price ',store=True, readonly=True,digits=dp.get_precision('Account'),compute='_compute_price'),
                }
    @api.one       
    @api.depends('product_qty')
    def _compute_price(self):
        self.units_price = (self.unit_price * self.product_qty)