Skip to content
Snippets Groups Projects
Commit ca707502 authored by dat-odoo's avatar dat-odoo Committed by William Henrotin
Browse files

[FIX] purchase_requisition: vendor name management from purchase agreements.

Purchase orders created from purchase agreement behave differently depending on
the agreement type.
On one hand, if the agreement is a blanket order, the vendor must be set automatically on the
purchase order and be the same as the BO. Changing the vendor is forbidden.
On the other hand, if the agreement is a call for tender, multiple purchase order can be
created with different vendors. It that case, the vendor field must be editable in RfQ states.

This commit is related to task ID 1866975.
parent cae7c716
No related branches found
No related tags found
No related merge requests found
......@@ -291,6 +291,7 @@ class PurchaseOrder(models.Model):
_inherit = "purchase.order"
requisition_id = fields.Many2one('purchase.requisition', string='Purchase Agreement', copy=False)
is_quantity_copy = fields.Selection(related='requisition_id.is_quantity_copy')
@api.onchange('requisition_id')
def _onchange_requisition_id(self):
......
......@@ -79,9 +79,8 @@
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<field name="partner_id" position="replace">
<field name="partner_id" context="{'search_default_supplier':1, 'default_supplier':1, 'default_customer':0}"
domain="[('supplier','=',True)]"
attrs="{'readonly': ['&amp;', ('partner_id', '!=', False), ('requisition_id','!=', False)]}" force_save="1"/>
<field name="is_quantity_copy" invisible="1"/>
<field name="partner_id" context="{'search_default_supplier':1, 'default_supplier':1, 'default_customer':0}" domain="[('supplier','=',True)]" attrs="{'readonly': ['|', ('is_quantity_copy', '=', 'none'), ('state', 'in', ['purchase', 'done', 'cancel'])]}" force_save="1"/>
</field>
<field name="partner_ref" position="after">
<field name="requisition_id"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment