From e7d627e08733454ae9570b151f836b89551ca28d Mon Sep 17 00:00:00 2001 From: Corentin Forler <8860073-cforler_dokos@users.noreply.gitlab.com> Date: Thu, 7 Mar 2024 18:17:33 +0100 Subject: [PATCH 1/2] fix(booking): Append taxes to quotation when making it from item booking list --- .../venue/doctype/item_booking/item_booking.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/erpnext/venue/doctype/item_booking/item_booking.py b/erpnext/venue/doctype/item_booking/item_booking.py index e3a1151b732..540fd05ef86 100644 --- a/erpnext/venue/doctype/item_booking/item_booking.py +++ b/erpnext/venue/doctype/item_booking/item_booking.py @@ -48,6 +48,8 @@ from erpnext.venue.utils import get_linked_customers if TYPE_CHECKING: from typing import Callable, TypeVar + from erpnext.selling.doctype.quotation.quotation import Quotation + class schedule_line_t(TypedDict): start_time: str end_time: str @@ -1482,9 +1484,7 @@ def clear_draft_bookings(): @frappe.whitelist() def make_quotation(source_name, target_doc=None): def set_missing_values(source, target): - from erpnext.controllers.accounts_controller import get_default_taxes_and_charges - - quotation = frappe.get_doc(target) + quotation: "Quotation" = frappe.get_doc(target) quotation.order_type = "Maintenance" company_currency = frappe.get_cached_value("Company", quotation.company, "default_currency") @@ -1517,14 +1517,12 @@ def make_quotation(source_name, target_doc=None): }, ) - # get default taxes - taxes = get_default_taxes_and_charges( - "Sales Taxes and Charges Template", company=quotation.company - ) - if taxes.get("taxes"): - quotation.update(taxes) - quotation.run_method("set_missing_values") + + quotation.set("taxes", []) + quotation.append_taxes_from_master() + quotation.append_taxes_from_item_tax_template() + quotation.run_method("calculate_taxes_and_totals") doclist = get_mapped_doc( -- GitLab From ece33758cadadce5ba0929c9ffa03e04f93eb1d2 Mon Sep 17 00:00:00 2001 From: Charles-Henri Decultot Date: Thu, 7 Mar 2024 21:18:06 +0100 Subject: [PATCH 2/2] fix: replace by single method --- erpnext/venue/doctype/item_booking/item_booking.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/venue/doctype/item_booking/item_booking.py b/erpnext/venue/doctype/item_booking/item_booking.py index 540fd05ef86..4e0fb95b190 100644 --- a/erpnext/venue/doctype/item_booking/item_booking.py +++ b/erpnext/venue/doctype/item_booking/item_booking.py @@ -1518,11 +1518,7 @@ def make_quotation(source_name, target_doc=None): ) quotation.run_method("set_missing_values") - - quotation.set("taxes", []) - quotation.append_taxes_from_master() - quotation.append_taxes_from_item_tax_template() - + quotation.run_method("set_other_charges") quotation.run_method("calculate_taxes_and_totals") doclist = get_mapped_doc( -- GitLab