Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
849 Переглядів

Hi everyone, I have two fields related to the 'res.partner' that bring me the "child_ids" of the contacts that are invoice addresses and shipping addresses. The field works perfectly but as these addresses do not have a name as such, they only have data in the fields 'street', 'street2', 'country_id', 'state_id', 'city', and 'zip' when selecting an option they all appear as "Azure Interior - Billing Address" and "Azure Interior - Shipping Address" in this example. I need that when I select the options it shows me the information of the field 'street', 'street2' and 'city' concatenated or only the information in the field 'street' of res.partner. I attach my code and a screenshot so you can see it better:


from odoo import models, fields, api

class direcciones(models.Model):
_inherit = 'account.move'

direccion_factura = fields.Many2one('res.partner', string='Direccion de Facturacion', domain="['&','&',('is_company','=',False),('parent_id','=',partner_id),('type','=','invoice')]")

direccion_envio = fields.Many2one('res.partner', string='Direccion de Envio', domain="['&','&',('is_company','=',False),('parent_id','=',partner_id),('type','=','delivery')]")




Аватар
Відмінити
Найкраща відповідь

Hi,


In such cases odoo provides a default function ie,name_get().By using this function you can the information of the field 'street', 'street2' and 'city'..for reference you can refer our following blogs to know more about name_get()


https://www.cybrosys.com/blog/how-to-use-of-name-get-function-in-odoo


And also you can go through our youtube video


https://www.youtube.com/watch?v=kHq6nUwEGjM



Hope it helps

Аватар
Відмінити
Найкраща відповідь

A solution is to pass a context with the field in the QWEB XML.

The context value can then read extended in the "name_get" function on the res.partener where you can return the value in the format you need.

have a look at this for more details...  Link

I think this might also be doable via wedget

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
0
жовт. 23
1167
4
трав. 25
1628
0
груд. 24
743
ODOO.sh Вирішено
2
жовт. 24
12181
1
вер. 24
1150