如何在 odoo 中存储 company_dependent 字段?
How to store company_dependent field in odoo?
我想存储 standard_price 字段 prodct.product table 以在 sql 查询中使用此字段值。
代码在这里:
# -*- coding: utf-8 -*-
from odoo import fields, models
from odoo.addons import decimal_precision as dp
class Product(models.Model):
_inherit = "product.product"
standard_price = fields.Float(
'Cost', company_dependent=True,
digits=dp.get_precision('Product Price'),
groups="base.group_user",store=True,
help = "Cost used for stock valuation in standard price and as a first price to set in average/fifo. "
"Also used as a base price for pricelists. "
"Expressed in the default unit of measure of the product.")
您不能在数据库中存储 company_dependent 字段。因为当公司发生变化时,company_depedent 字段值也会发生变化。
该字段数据存储在odoo中的ir.property对象中,在odoo中名称为Company Properties。
我想存储 standard_price 字段 prodct.product table 以在 sql 查询中使用此字段值。
代码在这里:
# -*- coding: utf-8 -*-
from odoo import fields, models
from odoo.addons import decimal_precision as dp
class Product(models.Model):
_inherit = "product.product"
standard_price = fields.Float(
'Cost', company_dependent=True,
digits=dp.get_precision('Product Price'),
groups="base.group_user",store=True,
help = "Cost used for stock valuation in standard price and as a first price to set in average/fifo. "
"Also used as a base price for pricelists. "
"Expressed in the default unit of measure of the product.")
您不能在数据库中存储 company_dependent 字段。因为当公司发生变化时,company_depedent 字段值也会发生变化。
该字段数据存储在odoo中的ir.property对象中,在odoo中名称为Company Properties。