Odoo 8 - 默认字段值

时间:2017-01-17 15:59:39

标签: odoo-8

在销售订单表格中,我希望为客户销售编号指定一个特定字段。默认情况下,此字段应填写按下记录按钮后生成的Odoo销售号码。但如果手动指定了值,我不想复制Odoo销售号。

所以这是我目前的代码:

<field name="pricelist_id" position="after">
    <field name="customer_sale_number" readonly="0" />
</field>

-

@api.one
@api.depends('name')
def compute_default_customer_sale_number(self):
    if self.customer_sale_number == '/' or self.customer_sale_number is False:
        self.customer_sale_number = self.name

customer_sale_number = fields.Char('Customer reference', compute='compute_default_customer_sale_number', store=True)

此代码有效,但如果手动指定了值,则会被Odoo销售号覆盖。

我的错误在哪里?

1 个答案:

答案 0 :(得分:0)

您可以通过替换以下代码来尝试解决问题。

>>> version = '55.2.2883.95'
>>> (chunks[0] << 40) + (chunks[1] << 32) + (chunks[2] << 16) + chunks[3]
60481918402655

由于

相关问题