odoo 10产品货币

2024-10-05 10:14:24 发布

您现在位置:Python中文网/ 问答频道 /正文

原代码:

class name= "product.template"
currency_id = fields.Many2one(
        'res.currency', 'Currency', compute='_compute_currency_id')

我只想从产品模板类继承currency_id。你可以从照片上看到。在

^{pr2}$

如您所见,我刚刚删除了compute函数,它应该可以正常工作而不调用compute函数,但它不工作。仍然调用计算函数。我找不到问题出在哪里。我希望有人能帮助我。在

谢谢。在


Tags: 函数name模板idfields产品restemplate
2条回答

你需要写store=True

class product_price_currency(models.Model):
      _inherit = 'product.template'
      currency_id = fields.Many2one('res.currency', 'Currency', required=True,store=True)

因为在基本模块中,该字段是store=False,并且继承时没有store=True,因此odoo仍在考虑store=False字段。在

这可能对你有帮助。在

你可以试试

class product_price_currency(models.Model):
  _inherit = 'product.template'
  currency_id = fields.Many2one('res.currency', 'Currency', required=True,store=True,readonly=False)

相关问题 更多 >

    热门问题