diff options
| author | Arnold Moyaux <arm@odoo.com> | 2019-11-06 13:55:18 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-11-07 16:18:13 +0000 |
| commit | d8355a0087a61d6ea61bfc7963f9d329c01cd535 (patch) | |
| tree | 7daf405f02a6bbbe34bebf53767ab0c45b1c6b7b /addons | |
| parent | a67d6eff4543e015b0cc99637a7281eeb5d5cd46 (diff) | |
[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 odoo/odoo#39980
Task: 2120211
X-original-commit: 7d69f01477a2d5dd93974737978d7af11cfc8b6d
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/purchase_requisition/models/purchase_requisition.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/purchase_requisition/models/purchase_requisition.py b/addons/purchase_requisition/models/purchase_requisition.py index 6d962b391d5..b3ab2a7f8fa 100644 --- a/addons/purchase_requisition/models/purchase_requisition.py +++ b/addons/purchase_requisition/models/purchase_requisition.py @@ -201,7 +201,9 @@ class PurchaseRequisitionLine(models.Model): 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']}) |
