2017-10-10 95 views
1

在Many2one字段中我想查看发票名称和发票ammount_total如何添加此?Many2one字段中的两个值odoo 9

customer_invoice = fields.Many2one('account.invoice', 'Customer Inv', select=True) 

现在打开customer_invoice字段后,我查看例如。 INV/2017/0001,INV/2017/0002我想要INV/2017/0001 100€,INV/2017/0002 200€

是否有可能?

+0

您必须添加一个'name_get'梅索德发票类 –

+0

这梅索德更改默认名称 –

回答

1

这梅索德更改默认名称,只是将其添加在发票类

@api.multi 
def name_get(self): 
    result = [] 
    for record in self: 
     name = record.name 
     if record.ammount_total : 
      name = record.name + ' ' + str(record.ammount_total) 
     result.append((record.id, name)) 
    return result 
+0

TNX的帮助,但我不在发票类中的更改是否可以仅在我的自定义模块中的字段模块中更改? – Pointer

+0

Theb把它放在你的自定义类中,在'inherit account.invoice'下面 –

+0

在我的例子中不起作用... https://postimg.org/image/24w9a0ga17/ – Pointer