From 77d191217a531976331545ad7b59469cc425f954 Mon Sep 17 00:00:00 2001 From: fproldan Date: Fri, 10 Feb 2023 13:14:07 -0300 Subject: [PATCH] feat: no usar conversion_rate fom ov to si --- erpnext/selling/doctype/sales_order/sales_order.py | 8 +++++++- .../doctype/selling_settings/selling_settings.json | 13 ++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index aa88b48410bd..cab960e8a6fd 100755 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -671,6 +671,12 @@ def update_item(source, target, source_parent): if cost_center: target.cost_center = cost_center + no_copy_conversion_date_from_ov_to_si = cint(frappe.db.get_single_value('Selling Settings', 'no_copy_conversion_date_from_ov_to_si')) + if no_copy_conversion_date_from_ov_to_si: + field_no_map = ["payment_terms_template", "conversion_rate"] + else: + field_no_map = ["payment_terms_template"] + doclist = get_mapped_doc("Sales Order", source_name, { "Sales Order": { "doctype": "Sales Invoice", @@ -678,7 +684,7 @@ def update_item(source, target, source_parent): "party_account_currency": "party_account_currency", "payment_terms_template": "payment_terms_template" }, - "field_no_map": ["payment_terms_template"], + "field_no_map": field_no_map, "validation": { "docstatus": ["=", 1] } diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.json b/erpnext/selling/doctype/selling_settings/selling_settings.json index 21829598d950..0bd970c6cf97 100644 --- a/erpnext/selling/doctype/selling_settings/selling_settings.json +++ b/erpnext/selling/doctype/selling_settings/selling_settings.json @@ -36,7 +36,8 @@ "allow_multiple_items", "allow_against_multiple_purchase_orders", "hide_tax_id", - "approval_required_for_sales_commission_payout" + "approval_required_for_sales_commission_payout", + "no_copy_conversion_date_from_ov_to_si" ], "fields": [ { @@ -235,6 +236,12 @@ "in_list_view": 1, "label": "Tipo de Documento Predeterminado", "options": "Tipo de Documento" + }, + { + "default": "0", + "fieldname": "no_copy_conversion_date_from_ov_to_si", + "fieldtype": "Check", + "label": "No usar el valor de cambio de la Orden de Venta al crear una Factura de Venta" } ], "icon": "fa fa-cog", @@ -242,7 +249,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2021-09-18 23:05:06.139820", + "modified": "2023-02-10 13:11:12.234464", "modified_by": "Administrator", "module": "Selling", "name": "Selling Settings", @@ -261,4 +268,4 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1 -} +} \ No newline at end of file