From 4288e9c6b01bfa596f07e8064a7a553629fcf713 Mon Sep 17 00:00:00 2001 From: Sergi Almacellas Abellana Date: Mon, 24 Feb 2025 10:29:45 +0100 Subject: [PATCH] Do not set the unit price of the purchased lines from the request to zero Since 65be15fb7d8a its possible to set empty unit price Closes #13886 --- modules/purchase_request/purchase_request.py | 4 ---- modules/purchase_request/tests/scenario_purchase_request.rst | 1 - 2 files changed, 5 deletions(-) diff --git a/modules/purchase_request/purchase_request.py b/modules/purchase_request/purchase_request.py index 2adeb3b76a..f3750cdd16 100644 --- a/modules/purchase_request/purchase_request.py +++ b/modules/purchase_request/purchase_request.py @@ -1,7 +1,6 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. import datetime -from decimal import Decimal from functools import partial from itertools import groupby @@ -10,7 +9,6 @@ from trytond.model import Index, ModelSQL, ModelView, fields from trytond.model.exceptions import AccessError from trytond.modules.company.model import ( employee_field, reset_employee, set_employee) -from trytond.modules.product import round_price from trytond.pool import Pool from trytond.pyson import Bool, Eval, If from trytond.tools import firstline, sortable_values @@ -494,8 +492,6 @@ class CreatePurchase(Wizard): for f, v in key: setattr(line, f, v) line.on_change_quantity() - if line.unit_price is None: - line.unit_price = round_price(Decimal(0)) return line @classmethod diff --git a/modules/purchase_request/tests/scenario_purchase_request.rst b/modules/purchase_request/tests/scenario_purchase_request.rst index 9b80aac9bc..7c5bdf768a 100644 --- a/modules/purchase_request/tests/scenario_purchase_request.rst +++ b/modules/purchase_request/tests/scenario_purchase_request.rst @@ -266,7 +266,6 @@ Create the purchase without product:: 1.0 >>> pr.purchase_line.unit >>> pr.purchase_line.unit_price - Decimal('0.0000') It's not possible to delete a purchase linked to a purchase_request::