Skip to Content
Menu
This question has been flagged
1 Reply
409 Views

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
Discard
Author

Thanks for your time.

In the meantime, My solution was found from my integrator

Thanks

Best Answer

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
Discard