How to create vendor preview in purchase order as in customer preview.
This question has been flagged
Hi,
1. Create Xml file (purchase_order_views.xml)
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Inherit Form View to Modify it -->
<record id="view_inherit_purchase_
<field name="name">purchase.order.
<field name="model">purchase.order</
<field name="inherit_id" ref="purchase.purchase_order_
<field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_
<button name="action_preview_purchase_
type="object"
class="oe_stat_button"
icon="fa-globe icon">
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Vendor</
<span class="o_stat_text">Preview</
</div>
</button>
</xpath>
</field>
</record>
</odoo>
2. Create a Python file(purchase_order)
class PurchaseOrder(models.Model):
_inherit = 'purchase.order'
def action_preview_purchase_order(self):
self.ensure_one()
return {
'type': 'ir.actions.act_url',
'target': 'self',
'url': self.get_portal_url(),
}
Hope it helps
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up