[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.
This commit is contained in:
committed by
William Henrotin
parent
cae7c71635
commit
ca707502a6
@@ -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': ['&', ('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"
|
||||
|
||||
Reference in New Issue
Block a user