Skip to content
Permalink
Browse files

[FIX] purchase_requistion: call for tender zero lines

Usecase to reproduce:
- Create a purchase requistion with type Call For Tender
- Update a line and set the price to zero.

UserError 'You cannot confirm the blanket order without price.' raised.
It happens because the write don't process the same check than create
and don't check if the purchase_requistion is a blanket order or a call
for tender. It also doens't check the current state of the
purchase_requisition.

closes #39969

Task: 2120211
X-original-commit: 7d69f01
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
  • Loading branch information...
amoyaux authored and fw-bot committed Nov 6, 2019
1 parent ada2f74 commit aee19fd87d33ed449f3530fb8bfe5cd82497a6d8
Showing with 3 additions and 1 deletion.
  1. +3 −1 addons/purchase_requisition/models/purchase_requisition.py
@@ -203,7 +203,9 @@ def create(self,vals):
def write(self, vals):
res = super(PurchaseRequisitionLine, self).write(vals)
if 'price_unit' in vals:
if vals['price_unit'] <= 0.0:
if vals['price_unit'] <= 0.0 and any(
requisition.state not in ['draft', 'cancel', 'done'] and
requisition.is_quantity_copy == 'none' for requisition in self.mapped('requisition_id')):
raise UserError(_('You cannot confirm the blanket order without price.'))
# If the price is updated, we have to update the related SupplierInfo
self.supplier_info_ids.write({'price': vals['price_unit']})

0 comments on commit aee19fd

Please sign in to comment.
You can’t perform that action at this time.