Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
1 Beantwoorden
325 Weergaven

Hello

When I use the auto complete function on vendor bills to "call" a purchase order, I'd like to see fields form my PO on my bill. For example, I'd like to see the purchase user on the screen on my bill, as well as the description of the PO.

Is there a way to do it?

Thanks

Avatar
Annuleer
Auteur

Thanks for your time.

In the meantime, My solution was found from my integrator

Thanks

Beste antwoord

Hi,

Please refer to the code below:


Python:


from odoo import models, fields

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

purchase_user_id = fields.Many2one(
related='purchase_id.user_id',
string='Purchase User',
store=True
)

purchase_description = fields.Text(
related='purchase_id.notes',
string='PO Description',
store=True
)

XML:

<record id="view_move_form_inherit_purchase_info" model="ir.ui.view">
<field name="name">account.move.form.purchase.info</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_date']" position="after">
<field name="purchase_user_id"/>
<field name="purchase_description"/>
</xpath>
</field>
</record>



Hope it helps.

Avatar
Annuleer