Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
3921 Visualizações

I'm trying to create a custom customer statement report. I've inherited res_partner and have created a method to return an invoice contact as a res.partner object but can get it to display in the QWEb report. How do you call this correctly so I can insert a correctly formated address?

Model:

class Res_Partner(models.Model):
    _inherit = 'res.partner'

@api.one
@api.returns('res.partner')
def _get_postal_address(self):

partner_obj = self.env['res.partner']
add_ids = self.address_get(adr_pref=['invoice']) or {}
add_id = add_ids['invoice']
return partner_obj.browse(add_id)

XML:


<address t-field="_get_postal_address()" t-field-options="{&quot;widget&quot;: &quot;contact&quot;, &quot;fields&quot;: [&quot;address&quot;, &quot;name&quot;], &quot;no_marker&quot;: true}"/>
...


I've tried t-esc and t-raw. And also tried creating a new field on res_partner but I either does not fire the method or if it does if creates an error.

For testing purposes I've made sure the record has an contact of type invoice.


Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
2
mar. 19
4277
1
mar. 15
12246
1
jul. 25
1488
0
jul. 25
163
1
jun. 25
1857