如何购买编程设置

时间:2017-11-02 18:09:57

标签: openerp odoo-10 odoo-view

如果点击激活自动安装的模块,如何在购买设置视图中编程单选按钮?

class PurchaseConfig(models.TransientModel):
    _inherit = 'purchase.config.settings'

    groupe_purchase_grouping = fields.Selection([
        (0, 'Active'),
        (1, 'Desactive')
    ], "Purchase grouping")

我可以安装的模块

class ProcurementOrder(models.Model):
    _inherit = 'procurement.order'

    def _make_po_get_domain(self, partner):
        res = super(ProcurementOrder, self)._make_po_get_domain(partner)
        resr = list()
        supplier = []
        for r in res:
            if r[0] == "partner_id":
                l = ("partner_id", "=", False)
                resr.append(l)
                continue
            resr.append(r)
        resr = tuple(resr)
        return resr

2 个答案:

答案 0 :(得分:0)

试试这个:

在.py

groupe_purchase_grouping = fields.Selection([
        (0, 'Active'),
        (1, 'Desactive')
    ], "Purchase grouping")

用于单选按钮 在xml中定义:

<filed name ="groupe_purchase_grouping" widget ="radio"/>

我希望它可以帮到你

答案 1 :(得分:0)

您必须在字段名称中提及moduel前缀your_module_name,如下所示:

class PurchaseConfig(models.TransientModel):
    _inherit = 'purchase.config.settings'

    module_groupe_purchase_grouping = fields.Selection([
        (0, 'Active'),
        (1, 'Desactive')
      ], "Purchase grouping")

我认为groupe_purchase_grouping是您的模块名称