From 71f65bab5e140cf8ba2f3e64e209b7b33bf35b71 Mon Sep 17 00:00:00 2001 From: marination Date: Mon, 3 Mar 2025 16:24:22 +0100 Subject: [PATCH] fix: Linters --- .../selling/doctype/quotation/quotation.py | 3 +- .../doctype/sales_order/sales_order.py | 37 ++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 7924f648c08..3fef12aea7f 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -19,6 +19,8 @@ class Quotation(SellingController): from typing import TYPE_CHECKING if TYPE_CHECKING: + from frappe.types import DF + from erpnext.accounts.doctype.payment_schedule.payment_schedule import PaymentSchedule from erpnext.accounts.doctype.pricing_rule_detail.pricing_rule_detail import PricingRuleDetail from erpnext.accounts.doctype.sales_taxes_and_charges.sales_taxes_and_charges import ( @@ -30,7 +32,6 @@ class Quotation(SellingController): QuotationLostReasonDetail, ) from erpnext.stock.doctype.packed_item.packed_item import PackedItem - from frappe.types import DF additional_discount_percentage: DF.Float address_display: DF.TextEditor | None diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 1445d5ba474..219e679f3e3 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -57,13 +57,16 @@ class SalesOrder(SellingController): from typing import TYPE_CHECKING if TYPE_CHECKING: + from frappe.types import DF + from erpnext.accounts.doctype.payment_schedule.payment_schedule import PaymentSchedule from erpnext.accounts.doctype.pricing_rule_detail.pricing_rule_detail import PricingRuleDetail - from erpnext.accounts.doctype.sales_taxes_and_charges.sales_taxes_and_charges import SalesTaxesandCharges + from erpnext.accounts.doctype.sales_taxes_and_charges.sales_taxes_and_charges import ( + SalesTaxesandCharges, + ) from erpnext.selling.doctype.sales_order_item.sales_order_item import SalesOrderItem from erpnext.selling.doctype.sales_team.sales_team import SalesTeam from erpnext.stock.doctype.packed_item.packed_item import PackedItem - from frappe.types import DF additional_discount_percentage: DF.Float address_display: DF.TextEditor | None @@ -101,7 +104,9 @@ class SalesOrder(SellingController): customer_group: DF.Link | None customer_name: DF.Data | None delivery_date: DF.Date | None - delivery_status: DF.Literal["Not Delivered", "Fully Delivered", "Partly Delivered", "Closed", "Not Applicable"] + delivery_status: DF.Literal[ + "Not Delivered", "Fully Delivered", "Partly Delivered", "Closed", "Not Applicable" + ] disable_rounded_total: DF.Check discount_amount: DF.Currency dispatch_address: DF.TextEditor | None @@ -152,7 +157,18 @@ class SalesOrder(SellingController): shipping_address_name: DF.Link | None shipping_rule: DF.Link | None skip_delivery_note: DF.Check - status: DF.Literal["", "Draft", "On Hold", "To Pay", "To Deliver and Bill", "To Bill", "To Deliver", "Completed", "Cancelled", "Closed"] + status: DF.Literal[ + "", + "Draft", + "On Hold", + "To Pay", + "To Deliver and Bill", + "To Bill", + "To Deliver", + "Completed", + "Cancelled", + "Closed", + ] tax_category: DF.Link | None tax_id: DF.Data | None taxes: DF.Table[SalesTaxesandCharges] @@ -1143,9 +1159,7 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): target.cost_center = cost_center # has_unit_price_items = 0 is accepted as the qty uncertain for some items - has_unit_price_items = frappe.db.get_value( - "Sales Order", source_name, "has_unit_price_items" - ) + has_unit_price_items = frappe.db.get_value("Sales Order", source_name, "has_unit_price_items") doclist = get_mapped_doc( "Sales Order", source_name, @@ -1167,12 +1181,9 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False): }, "postprocess": update_item, "condition": lambda doc: ( - doc.qty - and ( - doc.base_amount == 0 - or abs(doc.billed_amt) < abs(doc.amount) - ) - ) or has_unit_price_items, + doc.qty and (doc.base_amount == 0 or abs(doc.billed_amt) < abs(doc.amount)) + ) + or has_unit_price_items, }, "Sales Taxes and Charges": { "doctype": "Sales Taxes and Charges",