${res.web_item_name}
${res.brand ? "by " + res.brand : ""}
@@ -241,4 +241,4 @@ erpnext.ProductSearch = class {
this.category_container.html(html);
}
-};
\ No newline at end of file
+};
diff --git a/erpnext/e_commerce/redisearch_utils.py b/erpnext/e_commerce/redisearch_utils.py
index 1f649c7b48..87ca9bd83d 100644
--- a/erpnext/e_commerce/redisearch_utils.py
+++ b/erpnext/e_commerce/redisearch_utils.py
@@ -7,7 +7,9 @@ import frappe
from frappe import _
from frappe.utils.redis_wrapper import RedisWrapper
from redis import ResponseError
-from redisearch import AutoCompleter, Client, IndexDefinition, Suggestion, TagField, TextField
+from redis.commands.search.field import TagField, TextField
+from redis.commands.search.indexDefinition import IndexDefinition
+from redis.commands.search.suggestion import Suggestion
WEBSITE_ITEM_INDEX = "website_items_index"
WEBSITE_ITEM_KEY_PREFIX = "website_item:"
@@ -35,12 +37,9 @@ def is_redisearch_enabled():
def is_search_module_loaded():
try:
cache = frappe.cache()
- out = cache.execute_command("MODULE LIST")
-
- parsed_output = " ".join(
- (" ".join([frappe.as_unicode(s) for s in o if not isinstance(s, int)]) for o in out)
- )
- return "search" in parsed_output
+ for module in cache.module_list():
+ if module.get(b"name") == b"search":
+ return True
except Exception:
return False # handling older redis versions
@@ -58,18 +57,18 @@ def if_redisearch_enabled(function):
def make_key(key):
- return "{0}|{1}".format(frappe.conf.db_name, key).encode("utf-8")
+ return frappe.cache().make_key(key)
@if_redisearch_enabled
def create_website_items_index():
"Creates Index Definition."
- # CREATE index
- client = Client(make_key(WEBSITE_ITEM_INDEX), conn=frappe.cache())
+ redis = frappe.cache()
+ index = redis.ft(WEBSITE_ITEM_INDEX)
try:
- client.drop_index() # drop if already exists
+ index.dropindex() # drop if already exists
except ResponseError:
# will most likely raise a ResponseError if index does not exist
# ignore and create index
@@ -86,9 +85,10 @@ def create_website_items_index():
if "web_item_name" in idx_fields:
idx_fields.remove("web_item_name")
- idx_fields = list(map(to_search_field, idx_fields))
+ idx_fields = [to_search_field(f) for f in idx_fields]
- client.create_index(
+ # TODO: sortable?
+ index.create_index(
[TextField("web_item_name", sortable=True)] + idx_fields,
definition=idx_def,
)
@@ -119,8 +119,8 @@ def insert_item_to_index(website_item_doc):
@if_redisearch_enabled
def insert_to_name_ac(web_name, doc_name):
- ac = AutoCompleter(make_key(WEBSITE_ITEM_NAME_AUTOCOMPLETE), conn=frappe.cache())
- ac.add_suggestions(Suggestion(web_name, payload=doc_name))
+ ac = frappe.cache().ft()
+ ac.sugadd(WEBSITE_ITEM_NAME_AUTOCOMPLETE, Suggestion(web_name, payload=doc_name))
def create_web_item_map(website_item_doc):
@@ -157,9 +157,8 @@ def delete_item_from_index(website_item_doc):
@if_redisearch_enabled
def delete_from_ac_dict(website_item_doc):
"""Removes this items's name from autocomplete dictionary"""
- cache = frappe.cache()
- name_ac = AutoCompleter(make_key(WEBSITE_ITEM_NAME_AUTOCOMPLETE), conn=cache)
- name_ac.delete(website_item_doc.web_item_name)
+ ac = frappe.cache().ft()
+ ac.sugdel(website_item_doc.web_item_name)
@if_redisearch_enabled
@@ -170,8 +169,6 @@ def define_autocomplete_dictionary():
"""
cache = frappe.cache()
- item_ac = AutoCompleter(make_key(WEBSITE_ITEM_NAME_AUTOCOMPLETE), conn=cache)
- item_group_ac = AutoCompleter(make_key(WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE), conn=cache)
# Delete both autocomplete dicts
try:
@@ -180,38 +177,43 @@ def define_autocomplete_dictionary():
except Exception:
raise_redisearch_error()
- create_items_autocomplete_dict(autocompleter=item_ac)
- create_item_groups_autocomplete_dict(autocompleter=item_group_ac)
+ create_items_autocomplete_dict()
+ create_item_groups_autocomplete_dict()
@if_redisearch_enabled
-def create_items_autocomplete_dict(autocompleter):
+def create_items_autocomplete_dict():
"Add items as suggestions in Autocompleter."
+
+ ac = frappe.cache().ft()
items = frappe.get_all(
"Website Item", fields=["web_item_name", "item_group"], filters={"published": 1}
)
-
for item in items:
- autocompleter.add_suggestions(Suggestion(item.web_item_name))
+ ac.sugadd(WEBSITE_ITEM_NAME_AUTOCOMPLETE, Suggestion(item.web_item_name))
@if_redisearch_enabled
-def create_item_groups_autocomplete_dict(autocompleter):
+def create_item_groups_autocomplete_dict():
"Add item groups with weightage as suggestions in Autocompleter."
+
published_item_groups = frappe.get_all(
"Item Group", fields=["name", "route", "weightage"], filters={"show_in_website": 1}
)
if not published_item_groups:
return
+ ac = frappe.cache().ft()
+
for item_group in published_item_groups:
payload = json.dumps({"name": item_group.name, "route": item_group.route})
- autocompleter.add_suggestions(
+ ac.sugadd(
+ WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE,
Suggestion(
string=item_group.name,
score=frappe.utils.flt(item_group.weightage) or 1.0,
payload=payload, # additional info that can be retrieved later
- )
+ ),
)
diff --git a/erpnext/erpnext_integrations/exotel_integration.py b/erpnext/erpnext_integrations/exotel_integration.py
index fd9f74e8c9..fd0f783575 100644
--- a/erpnext/erpnext_integrations/exotel_integration.py
+++ b/erpnext/erpnext_integrations/exotel_integration.py
@@ -26,6 +26,7 @@ def handle_incoming_call(**kwargs):
except Exception as e:
frappe.db.rollback()
exotel_settings.log_error("Error in Exotel incoming call")
+ frappe.db.commit()
@frappe.whitelist(allow_guest=True)
diff --git a/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py b/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
index 6d62aefdca..cac3f1f0f3 100644
--- a/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
+++ b/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py
@@ -236,7 +236,7 @@ def get_term_loans(date, term_loan=None, loan_type=None):
AND l.is_term_loan =1
AND rs.payment_date <= %s
AND rs.is_accrued=0 {0}
- AND rs.interest_amount > 0
+ AND rs.principal_amount > 0
AND l.status = 'Disbursed'
ORDER BY rs.payment_date""".format(
condition
diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
index 29da988ce4..018832c7d7 100644
--- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
+++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py
@@ -735,6 +735,7 @@ def get_amounts(amounts, against_loan, posting_date):
)
amounts["pending_accrual_entries"] = pending_accrual_entries
amounts["unaccrued_interest"] = flt(unaccrued_interest, precision)
+ amounts["written_off_amount"] = flt(against_loan_doc.written_off_amount, precision)
if final_due_date:
amounts["due_date"] = final_due_date
diff --git a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py
index 81464a36c3..25c72d91a7 100644
--- a/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py
+++ b/erpnext/loan_management/doctype/process_loan_interest_accrual/process_loan_interest_accrual.py
@@ -57,7 +57,7 @@ def process_loan_interest_accrual_for_demand_loans(
def process_loan_interest_accrual_for_term_loans(posting_date=None, loan_type=None, loan=None):
- if not term_loan_accrual_pending(posting_date or nowdate()):
+ if not term_loan_accrual_pending(posting_date or nowdate(), loan=loan):
return
loan_process = frappe.new_doc("Process Loan Interest Accrual")
@@ -71,9 +71,12 @@ def process_loan_interest_accrual_for_term_loans(posting_date=None, loan_type=No
return loan_process.name
-def term_loan_accrual_pending(date):
- pending_accrual = frappe.db.get_value(
- "Repayment Schedule", {"payment_date": ("<=", date), "is_accrued": 0}
- )
+def term_loan_accrual_pending(date, loan=None):
+ filters = {"payment_date": ("<=", date), "is_accrued": 0}
+
+ if loan:
+ filters.update({"parent": loan})
+
+ pending_accrual = frappe.db.get_value("Repayment Schedule", filters)
return pending_accrual
diff --git a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
index 09d4429712..3dc6b0f900 100644
--- a/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/erpnext/maintenance/doctype/maintenance_schedule/maintenance_schedule.py
@@ -415,7 +415,7 @@ def make_maintenance_visit(source_name, target_doc=None, item_name=None, s_id=No
},
"Maintenance Schedule Item": {
"doctype": "Maintenance Visit Purpose",
- "condition": lambda doc: doc.item_name == item_name,
+ "condition": lambda doc: doc.item_name == item_name if item_name else True,
"field_map": {"sales_person": "service_person"},
"postprocess": update_serial,
},
diff --git a/erpnext/manufacturing/doctype/production_plan/production_plan.py b/erpnext/manufacturing/doctype/production_plan/production_plan.py
index 2cdf8d3ea9..66d458bf75 100644
--- a/erpnext/manufacturing/doctype/production_plan/production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/production_plan.py
@@ -656,6 +656,8 @@ class ProductionPlan(Document):
row.idx = idx + 1
self.append("sub_assembly_items", row)
+ self.set_default_supplier_for_subcontracting_order()
+
def set_sub_assembly_items_based_on_level(self, row, bom_data, manufacturing_type=None):
"Modify bom_data, set additional details."
for data in bom_data:
@@ -667,6 +669,32 @@ class ProductionPlan(Document):
"Subcontract" if data.is_sub_contracted_item else "In House"
)
+ def set_default_supplier_for_subcontracting_order(self):
+ items = [
+ d.production_item for d in self.sub_assembly_items if d.type_of_manufacturing == "Subcontract"
+ ]
+
+ if not items:
+ return
+
+ default_supplier = frappe._dict(
+ frappe.get_all(
+ "Item Default",
+ fields=["parent", "default_supplier"],
+ filters={"parent": ("in", items), "default_supplier": ("is", "set")},
+ as_list=1,
+ )
+ )
+
+ if not default_supplier:
+ return
+
+ for row in self.sub_assembly_items:
+ if row.type_of_manufacturing != "Subcontract":
+ continue
+
+ row.supplier = default_supplier.get(row.production_item)
+
def combine_subassembly_items(self, sub_assembly_items_store):
"Aggregate if same: Item, Warehouse, Inhouse/Outhouse Manu.g, BOM No."
key_wise_data = {}
diff --git a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
index e2415ad848..1d2d1bd9a8 100644
--- a/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
+++ b/erpnext/manufacturing/doctype/production_plan/test_production_plan.py
@@ -281,6 +281,31 @@ class TestProductionPlan(FrappeTestCase):
pln.reload()
pln.cancel()
+ def test_production_plan_subassembly_default_supplier(self):
+ from erpnext.manufacturing.doctype.bom.test_bom import create_nested_bom
+
+ bom_tree_1 = {"Test Laptop": {"Test Motherboard": {"Test Motherboard Wires": {}}}}
+ bom = create_nested_bom(bom_tree_1, prefix="")
+
+ item_doc = frappe.get_doc("Item", "Test Motherboard")
+ company = "_Test Company"
+
+ item_doc.is_sub_contracted_item = 1
+ for row in item_doc.item_defaults:
+ if row.company == company and not row.default_supplier:
+ row.default_supplier = "_Test Supplier"
+
+ if not item_doc.item_defaults:
+ item_doc.append("item_defaults", {"company": company, "default_supplier": "_Test Supplier"})
+
+ item_doc.save()
+
+ plan = create_production_plan(item_code="Test Laptop", use_multi_level_bom=1, do_not_submit=True)
+ plan.get_sub_assembly_items()
+ plan.set_default_supplier_for_subcontracting_order()
+
+ self.assertEqual(plan.sub_assembly_items[0].supplier, "_Test Supplier")
+
def test_production_plan_combine_subassembly(self):
"""
Test combining Sub assembly items belonging to the same BOM in Prod Plan.
diff --git a/erpnext/manufacturing/doctype/work_order/test_work_order.py b/erpnext/manufacturing/doctype/work_order/test_work_order.py
index b556d9974a..a53c42c5ec 100644
--- a/erpnext/manufacturing/doctype/work_order/test_work_order.py
+++ b/erpnext/manufacturing/doctype/work_order/test_work_order.py
@@ -26,6 +26,8 @@ from erpnext.stock.doctype.stock_entry import test_stock_entry
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
from erpnext.stock.utils import get_bin
+test_dependencies = ["BOM"]
+
class TestWorkOrder(FrappeTestCase):
def setUp(self):
diff --git a/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py b/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py
index 465460f95d..d0dcc55932 100644
--- a/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py
+++ b/erpnext/manufacturing/doctype/work_order/work_order_dashboard.py
@@ -7,6 +7,6 @@ def get_data():
"non_standard_fieldnames": {"Batch": "reference_name"},
"transactions": [
{"label": _("Transactions"), "items": ["Stock Entry", "Job Card", "Pick List"]},
- {"label": _("Reference"), "items": ["Serial No", "Batch"]},
+ {"label": _("Reference"), "items": ["Serial No", "Batch", "Material Request"]},
],
}
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 30868298b6..d780213209 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -312,4 +312,5 @@ erpnext.patches.v13_0.fix_number_and_frequency_for_monthly_depreciation
erpnext.patches.v14_0.remove_hr_and_payroll_modules # 20-07-2022
erpnext.patches.v14_0.fix_crm_no_of_employees
erpnext.patches.v14_0.create_accounting_dimensions_in_subcontracting_doctypes
-erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries
\ No newline at end of file
+erpnext.patches.v14_0.fix_subcontracting_receipt_gl_entries
+erpnext.patches.v14_0.migrate_remarks_from_gl_to_payment_ledger
diff --git a/erpnext/patches/v13_0/add_doctype_to_sla.py b/erpnext/patches/v13_0/add_doctype_to_sla.py
index 5f5974f65d..2d3b0de5b5 100644
--- a/erpnext/patches/v13_0/add_doctype_to_sla.py
+++ b/erpnext/patches/v13_0/add_doctype_to_sla.py
@@ -14,7 +14,8 @@ def execute():
for sla in frappe.get_all("Service Level Agreement"):
agreement = frappe.get_doc("Service Level Agreement", sla.name)
- agreement.document_type = "Issue"
+ agreement.db_set("document_type", "Issue")
+ agreement.reload()
agreement.apply_sla_for_resolution = 1
agreement.append("sla_fulfilled_on", {"status": "Resolved"})
agreement.append("sla_fulfilled_on", {"status": "Closed"})
diff --git a/erpnext/patches/v13_0/delete_old_sales_reports.py b/erpnext/patches/v13_0/delete_old_sales_reports.py
index b31c9d17d7..1b53da755c 100644
--- a/erpnext/patches/v13_0/delete_old_sales_reports.py
+++ b/erpnext/patches/v13_0/delete_old_sales_reports.py
@@ -16,18 +16,18 @@ def execute():
delete_auto_email_reports(report)
check_and_delete_linked_reports(report)
- frappe.delete_doc("Report", report)
+ frappe.delete_doc("Report", report, force=True)
def delete_auto_email_reports(report):
"""Check for one or multiple Auto Email Reports and delete"""
auto_email_reports = frappe.db.get_values("Auto Email Report", {"report": report}, ["name"])
for auto_email_report in auto_email_reports:
- frappe.delete_doc("Auto Email Report", auto_email_report[0])
+ frappe.delete_doc("Auto Email Report", auto_email_report[0], force=True)
def delete_links_from_desktop_icons(report):
"""Check for one or multiple Desktop Icons and delete"""
desktop_icons = frappe.db.get_values("Desktop Icon", {"_report": report}, ["name"])
for desktop_icon in desktop_icons:
- frappe.delete_doc("Desktop Icon", desktop_icon[0])
+ frappe.delete_doc("Desktop Icon", desktop_icon[0], force=True)
diff --git a/erpnext/patches/v14_0/migrate_remarks_from_gl_to_payment_ledger.py b/erpnext/patches/v14_0/migrate_remarks_from_gl_to_payment_ledger.py
new file mode 100644
index 0000000000..062d24b78b
--- /dev/null
+++ b/erpnext/patches/v14_0/migrate_remarks_from_gl_to_payment_ledger.py
@@ -0,0 +1,56 @@
+import frappe
+from frappe import qb
+from frappe.utils import create_batch
+
+
+def execute():
+ if frappe.reload_doc("accounts", "doctype", "payment_ledger_entry"):
+
+ gle = qb.DocType("GL Entry")
+ ple = qb.DocType("Payment Ledger Entry")
+
+ # get ple and their remarks from GL Entry
+ pl_entries = (
+ qb.from_(ple)
+ .left_join(gle)
+ .on(
+ (ple.account == gle.account)
+ & (ple.party_type == gle.party_type)
+ & (ple.party == gle.party)
+ & (ple.voucher_type == gle.voucher_type)
+ & (ple.voucher_no == gle.voucher_no)
+ & (ple.company == gle.company)
+ )
+ .select(
+ ple.company,
+ ple.account,
+ ple.party_type,
+ ple.party,
+ ple.voucher_type,
+ ple.voucher_no,
+ gle.remarks.as_("gle_remarks"),
+ )
+ .where((ple.delinked == 0) & (gle.is_cancelled == 0))
+ .run(as_dict=True)
+ )
+
+ if pl_entries:
+ # split into multiple batches, update and commit for each batch
+ batch_size = 1000
+ for batch in create_batch(pl_entries, batch_size):
+ for entry in batch:
+ query = (
+ qb.update(ple)
+ .set(ple.remarks, entry.gle_remarks)
+ .where(
+ (ple.company == entry.company)
+ & (ple.account == entry.account)
+ & (ple.party_type == entry.party_type)
+ & (ple.party == entry.party)
+ & (ple.voucher_type == entry.voucher_type)
+ & (ple.voucher_no == entry.voucher_no)
+ )
+ )
+ query.run()
+
+ frappe.db.commit()
diff --git a/erpnext/patches/v14_0/update_opportunity_currency_fields.py b/erpnext/patches/v14_0/update_opportunity_currency_fields.py
index 076de52619..b803e9fa2d 100644
--- a/erpnext/patches/v14_0/update_opportunity_currency_fields.py
+++ b/erpnext/patches/v14_0/update_opportunity_currency_fields.py
@@ -1,3 +1,4 @@
+import click
import frappe
from frappe.utils import flt
@@ -16,6 +17,19 @@ def execute():
for opportunity in opportunities:
company_currency = erpnext.get_company_currency(opportunity.company)
+ if opportunity.currency is None or opportunity.currency == "":
+ opportunity.currency = company_currency
+ frappe.db.set_value(
+ "Opportunity",
+ opportunity.name,
+ {"currency": opportunity.currency},
+ update_modified=False,
+ )
+ click.secho(
+ f' Opportunity `{opportunity.name}` has no currency set. Setting it to company currency as default: `{opportunity.currency}`"\n',
+ fg="yellow",
+ )
+
# base total and total will be 0 only since item table did not have amount field earlier
if opportunity.currency != company_currency:
conversion_rate = get_exchange_rate(opportunity.currency, company_currency)
diff --git a/erpnext/projects/doctype/task_type/task_type.json b/erpnext/projects/doctype/task_type/task_type.json
index 3254444a48..b04264e9c7 100644
--- a/erpnext/projects/doctype/task_type/task_type.json
+++ b/erpnext/projects/doctype/task_type/task_type.json
@@ -1,127 +1,70 @@
{
- "allow_copy": 0,
- "allow_events_in_timeline": 0,
- "allow_guest_to_view": 0,
- "allow_import": 0,
- "allow_rename": 0,
+ "actions": [],
"autoname": "Prompt",
- "beta": 0,
"creation": "2019-04-19 15:04:05.317138",
- "custom": 0,
- "docstatus": 0,
"doctype": "DocType",
- "document_type": "",
- "editable_grid": 0,
"engine": "InnoDB",
+ "field_order": [
+ "weight",
+ "description"
+ ],
"fields": [
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fetch_if_empty": 0,
"fieldname": "weight",
"fieldtype": "Float",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Weight",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "label": "Weight"
},
{
- "allow_bulk_edit": 0,
- "allow_in_quick_entry": 0,
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Small Text",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Description",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "translatable": 0,
- "unique": 0
+ "label": "Description"
}
],
- "has_web_view": 0,
- "hide_toolbar": 0,
- "idx": 0,
- "in_create": 0,
- "is_submittable": 0,
- "issingle": 0,
- "istable": 0,
- "max_attachments": 0,
- "modified": "2019-04-19 15:31:48.080164",
+ "links": [],
+ "modified": "2022-08-29 17:46:41.342979",
"modified_by": "Administrator",
"module": "Projects",
"name": "Task Type",
- "name_case": "",
+ "naming_rule": "Set by user",
"owner": "Administrator",
"permissions": [
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
- "if_owner": 0,
- "import": 0,
- "permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
- "set_user_permissions": 0,
"share": 1,
- "submit": 0,
"write": 1
+ },
+ {
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Projects Manager",
+ "share": 1,
+ "write": 1
+ },
+ {
+ "email": 1,
+ "export": 1,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Projects User",
+ "share": 1
}
],
"quick_entry": 1,
- "read_only": 0,
- "show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "ASC",
- "track_changes": 1,
- "track_seen": 0,
- "track_views": 0
+ "states": [],
+ "track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 16b0b4a866..4c3e9dcf0a 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -39,6 +39,12 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
this._calculate_taxes_and_totals();
this.calculate_discount_amount();
+ // # Update grand total as per cash and non trade discount
+ if (this.frm.doc.apply_discount_on == "Grand Total" && this.frm.doc.is_cash_or_non_trade_discount) {
+ this.frm.doc.grand_total -= this.frm.doc.discount_amount;
+ this.frm.doc.base_grand_total -= this.frm.doc.base_discount_amount;
+ }
+
await this.calculate_shipping_charges();
// Advance calculation applicable to Sales /Purchase Invoice
@@ -633,6 +639,10 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
this.frm.doc.base_discount_amount = flt(this.frm.doc.discount_amount * this.frm.doc.conversion_rate,
precision("base_discount_amount"));
+ if (this.frm.doc.apply_discount_on == "Grand Total" && this.frm.doc.is_cash_or_non_trade_discount) {
+ return;
+ }
+
var total_for_discount_amount = this.get_total_for_discount_amount();
var net_total = 0;
// calculate item amount after Discount Amount
diff --git a/erpnext/regional/saudi_arabia/utils.py b/erpnext/regional/saudi_arabia/utils.py
index b47adc95f7..cac5ec113e 100644
--- a/erpnext/regional/saudi_arabia/utils.py
+++ b/erpnext/regional/saudi_arabia/utils.py
@@ -84,7 +84,7 @@ def create_qr_code(doc, method=None):
tlv_array.append("".join([tag, length, value]))
# Invoice Amount
- invoice_amount = str(doc.grand_total)
+ invoice_amount = str(doc.base_grand_total)
tag = bytes([4]).hex()
length = bytes([len(invoice_amount)]).hex()
value = invoice_amount.encode("utf-8").hex()
@@ -144,7 +144,7 @@ def get_vat_amount(doc):
for tax in doc.get("taxes"):
if tax.account_head in vat_accounts:
- vat_amount += tax.tax_amount
+ vat_amount += tax.base_tax_amount
return vat_amount
diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py
index 863fbc4059..96092b1523 100644
--- a/erpnext/selling/doctype/quotation/quotation.py
+++ b/erpnext/selling/doctype/quotation/quotation.py
@@ -268,7 +268,7 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
def set_expired_status():
# filter out submitted non expired quotations whose validity has been ended
- cond = "`tabQuotation`.docstatus = 1 and `tabQuotation`.status != 'Expired' and `tabQuotation`.valid_till < %s"
+ cond = "`tabQuotation`.docstatus = 1 and `tabQuotation`.status NOT IN ('Expired', 'Lost') and `tabQuotation`.valid_till < %s"
# check if those QUO have SO against it
so_against_quo = """
SELECT
diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js
index 6b6ea89b63..386c12b638 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.js
+++ b/erpnext/selling/doctype/sales_order/sales_order.js
@@ -59,7 +59,36 @@ frappe.ui.form.on("Sales Order", {
})
});
}
+
+ if (frm.doc.docstatus === 0 && frm.doc.is_internal_customer) {
+ frm.events.get_items_from_internal_purchase_order(frm);
+ }
},
+
+ get_items_from_internal_purchase_order(frm) {
+ frm.add_custom_button(__('Purchase Order'), () => {
+ erpnext.utils.map_current_doc({
+ method: 'erpnext.buying.doctype.purchase_order.purchase_order.make_inter_company_sales_order',
+ source_doctype: 'Purchase Order',
+ target: frm,
+ setters: [
+ {
+ label: 'Supplier',
+ fieldname: 'supplier',
+ fieldtype: 'Link',
+ options: 'Supplier'
+ }
+ ],
+ get_query_filters: {
+ company: frm.doc.company,
+ is_internal_supplier: 1,
+ docstatus: 1,
+ status: ['!=', 'Completed']
+ }
+ });
+ }, __('Get Items From'));
+ },
+
onload: function(frm) {
if (!frm.doc.transaction_date){
frm.set_value('transaction_date', frappe.datetime.get_today())
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 8c03cb5b41..09a9652cca 100755
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -892,6 +892,7 @@ def make_purchase_order_for_default_supplier(source_name, selected_items=None, t
target.additional_discount_percentage = 0.0
target.discount_amount = 0.0
target.inter_company_order_reference = ""
+ target.shipping_rule = ""
default_price_list = frappe.get_value("Supplier", supplier, "default_price_list")
if default_price_list:
@@ -1010,6 +1011,7 @@ def make_purchase_order(source_name, selected_items=None, target_doc=None):
target.additional_discount_percentage = 0.0
target.discount_amount = 0.0
target.inter_company_order_reference = ""
+ target.shipping_rule = ""
target.customer = ""
target.customer_name = ""
target.run_method("set_missing_values")
diff --git a/erpnext/selling/doctype/sales_order_item/sales_order_item.json b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
index 318799907e..2cf836f9fc 100644
--- a/erpnext/selling/doctype/sales_order_item/sales_order_item.json
+++ b/erpnext/selling/doctype/sales_order_item/sales_order_item.json
@@ -92,7 +92,11 @@
"section_break_63",
"page_break",
"item_tax_rate",
- "transaction_date"
+ "transaction_date",
+ "inter_transfer_reference_section",
+ "purchase_order",
+ "column_break_89",
+ "purchase_order_item"
],
"fields": [
{
@@ -809,12 +813,36 @@
"label": "Picked Qty (in Stock UOM)",
"no_copy": 1,
"read_only": 1
+ },
+ {
+ "fieldname": "inter_transfer_reference_section",
+ "fieldtype": "Section Break",
+ "label": "Inter Transfer Reference"
+ },
+ {
+ "fieldname": "purchase_order",
+ "fieldtype": "Link",
+ "label": "Purchase Order",
+ "options": "Purchase Order",
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "column_break_89",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "purchase_order_item",
+ "fieldtype": "Data",
+ "label": "Purchase Order Item",
+ "print_hide": 1,
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2022-06-17 05:27:41.603006",
+ "modified": "2022-09-06 13:24:18.065312",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",
diff --git a/erpnext/selling/report/sales_analytics/sales_analytics.py b/erpnext/selling/report/sales_analytics/sales_analytics.py
index 9d7d806c71..186352848d 100644
--- a/erpnext/selling/report/sales_analytics/sales_analytics.py
+++ b/erpnext/selling/report/sales_analytics/sales_analytics.py
@@ -168,7 +168,7 @@ class Analytics(object):
def get_sales_transactions_based_on_items(self):
if self.filters["value_quantity"] == "Value":
- value_field = "base_amount"
+ value_field = "base_net_amount"
else:
value_field = "stock_qty"
@@ -216,7 +216,7 @@ class Analytics(object):
def get_sales_transactions_based_on_item_group(self):
if self.filters["value_quantity"] == "Value":
- value_field = "base_amount"
+ value_field = "base_net_amount"
else:
value_field = "qty"
diff --git a/erpnext/setup/doctype/company/company.json b/erpnext/setup/doctype/company/company.json
index f34ec56dc0..f087d996ff 100644
--- a/erpnext/setup/doctype/company/company.json
+++ b/erpnext/setup/doctype/company/company.json
@@ -85,7 +85,6 @@
"depreciation_expense_account",
"series_for_depreciation_entry",
"expenses_included_in_asset_valuation",
- "repair_and_maintenance_account",
"column_break_40",
"disposal_account",
"depreciation_cost_center",
@@ -234,7 +233,6 @@
"label": "Default Warehouse for Sales Return",
"options": "Warehouse"
},
-
{
"fieldname": "country",
"fieldtype": "Link",
@@ -678,12 +676,6 @@
"fieldtype": "Section Break",
"label": "Fixed Asset Defaults"
},
- {
- "fieldname": "repair_and_maintenance_account",
- "fieldtype": "Link",
- "label": "Repair and Maintenance Account",
- "options": "Account"
- },
{
"fieldname": "section_break_28",
"fieldtype": "Section Break",
@@ -709,7 +701,7 @@
"image_field": "company_logo",
"is_tree": 1,
"links": [],
- "modified": "2022-06-30 18:03:18.701314",
+ "modified": "2022-08-16 16:09:02.327724",
"modified_by": "Administrator",
"module": "Setup",
"name": "Company",
diff --git a/erpnext/setup/doctype/employee/employee.json b/erpnext/setup/doctype/employee/employee.json
index 7a806d5906..39e0acd02a 100644
--- a/erpnext/setup/doctype/employee/employee.json
+++ b/erpnext/setup/doctype/employee/employee.json
@@ -10,79 +10,89 @@
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
+ "basic_details_tab",
"basic_information",
"employee",
"naming_series",
"first_name",
"middle_name",
"last_name",
- "salutation",
"employee_name",
- "image",
- "column_break1",
- "company",
- "status",
+ "column_break_9",
"gender",
"date_of_birth",
+ "salutation",
+ "column_break1",
"date_of_joining",
- "employee_number",
- "emergency_contact_details",
- "person_to_be_contacted",
- "relation",
- "column_break_19",
- "emergency_phone_number",
+ "image",
+ "status",
"erpnext_user",
"user_id",
"create_user",
"create_user_permission",
- "employment_details",
- "scheduled_confirmation_date",
- "final_confirmation_date",
- "col_break_22",
- "contract_end_date",
- "notice_number_of_days",
- "date_of_retirement",
- "job_profile",
+ "company_details_section",
+ "company",
"department",
+ "employee_number",
+ "column_break_25",
"designation",
"reports_to",
- "column_break_31",
+ "column_break_18",
"branch",
+ "employment_details",
+ "scheduled_confirmation_date",
+ "column_break_32",
+ "final_confirmation_date",
+ "contract_end_date",
+ "col_break_22",
+ "notice_number_of_days",
+ "date_of_retirement",
+ "contact_details",
+ "cell_number",
+ "column_break_40",
+ "personal_email",
+ "company_email",
+ "column_break4",
+ "prefered_contact_email",
+ "prefered_email",
+ "unsubscribed",
+ "address_section",
+ "current_address",
+ "current_accommodation_type",
+ "column_break_46",
+ "permanent_address",
+ "permanent_accommodation_type",
+ "emergency_contact_details",
+ "person_to_be_contacted",
+ "column_break_55",
+ "emergency_phone_number",
+ "column_break_19",
+ "relation",
"attendance_and_leave_details",
"attendance_device_id",
"column_break_44",
"holiday_list",
"salary_information",
- "salary_currency",
"ctc",
- "payroll_cost_center",
- "column_break_52",
+ "salary_currency",
+ "salary_mode",
+ "bank_details_section",
"bank_name",
"bank_ac_no",
- "contact_details",
- "cell_number",
- "prefered_email",
- "personal_email",
- "unsubscribed",
- "permanent_accommodation_type",
- "permanent_address",
- "column_break4",
- "prefered_contact_email",
- "company_email",
- "current_accommodation_type",
- "current_address",
- "sb53",
- "bio",
"personal_details",
- "passport_number",
- "date_of_issue",
- "valid_upto",
- "place_of_issue",
"marital_status",
- "blood_group",
- "column_break6",
"family_background",
+ "column_break6",
+ "blood_group",
"health_details",
+ "passport_details_section",
+ "passport_number",
+ "valid_upto",
+ "column_break_73",
+ "date_of_issue",
+ "place_of_issue",
+ "profile_tab",
+ "bio",
"educational_qualification",
"education",
"previous_work_experience",
@@ -92,16 +102,20 @@
"exit",
"resignation_letter_date",
"relieving_date",
- "reason_for_leaving",
- "leave_encashed",
- "encashment_date",
"exit_interview_details",
"held_on",
"new_workplace",
+ "column_break_99",
+ "leave_encashed",
+ "encashment_date",
+ "feedback_section",
+ "reason_for_leaving",
+ "column_break_104",
"feedback",
"lft",
"rgt",
- "old_parent"
+ "old_parent",
+ "connections_tab"
],
"fields": [
{
@@ -261,7 +275,7 @@
"collapsible": 1,
"fieldname": "erpnext_user",
"fieldtype": "Section Break",
- "label": "ERPNext User"
+ "label": "User Details"
},
{
"description": "System User (login) ID. If set, it will become default for all HR forms.",
@@ -289,8 +303,8 @@
"allow_in_quick_entry": 1,
"collapsible": 1,
"fieldname": "employment_details",
- "fieldtype": "Section Break",
- "label": "Joining Details"
+ "fieldtype": "Tab Break",
+ "label": "Joining"
},
{
"fieldname": "scheduled_confirmation_date",
@@ -331,12 +345,6 @@
"oldfieldname": "date_of_retirement",
"oldfieldtype": "Date"
},
- {
- "collapsible": 1,
- "fieldname": "job_profile",
- "fieldtype": "Section Break",
- "label": "Department"
- },
{
"fieldname": "department",
"fieldtype": "Link",
@@ -366,10 +374,6 @@
"oldfieldtype": "Link",
"options": "Employee"
},
- {
- "fieldname": "column_break_31",
- "fieldtype": "Column Break"
- },
{
"fieldname": "branch",
"fieldtype": "Link",
@@ -391,7 +395,7 @@
{
"collapsible": 1,
"fieldname": "salary_information",
- "fieldtype": "Section Break",
+ "fieldtype": "Tab Break",
"label": "Salary Details",
"oldfieldtype": "Section Break",
"width": "50%"
@@ -423,8 +427,8 @@
{
"collapsible": 1,
"fieldname": "contact_details",
- "fieldtype": "Section Break",
- "label": "Contact Details"
+ "fieldtype": "Tab Break",
+ "label": "Contact"
},
{
"fieldname": "cell_number",
@@ -493,12 +497,6 @@
"fieldtype": "Small Text",
"label": "Current Address"
},
- {
- "collapsible": 1,
- "fieldname": "sb53",
- "fieldtype": "Section Break",
- "label": "Personal Bio"
- },
{
"description": "Short biography for website and other publications.",
"fieldname": "bio",
@@ -508,7 +506,7 @@
{
"collapsible": 1,
"fieldname": "personal_details",
- "fieldtype": "Section Break",
+ "fieldtype": "Tab Break",
"label": "Personal Details"
},
{
@@ -601,7 +599,7 @@
{
"collapsible": 1,
"fieldname": "exit",
- "fieldtype": "Section Break",
+ "fieldtype": "Tab Break",
"label": "Exit",
"oldfieldtype": "Section Break"
},
@@ -702,7 +700,7 @@
{
"collapsible": 1,
"fieldname": "attendance_and_leave_details",
- "fieldtype": "Section Break",
+ "fieldtype": "Tab Break",
"label": "Attendance and Leave Details"
},
{
@@ -713,10 +711,6 @@
"fieldname": "column_break_19",
"fieldtype": "Column Break"
},
- {
- "fieldname": "column_break_52",
- "fieldtype": "Column Break"
- },
{
"fieldname": "salary_currency",
"fieldtype": "Link",
@@ -728,13 +722,95 @@
"fieldtype": "Currency",
"label": "Cost to Company (CTC)",
"options": "salary_currency"
+ },
+ {
+ "fieldname": "basic_details_tab",
+ "fieldtype": "Tab Break",
+ "label": "Basic Details"
+ },
+ {
+ "fieldname": "company_details_section",
+ "fieldtype": "Section Break",
+ "label": "Company Details"
+ },
+ {
+ "fieldname": "column_break_18",
+ "fieldtype": "Column Break"
+ },
+ {
+ "collapsible": 1,
+ "fieldname": "address_section",
+ "fieldtype": "Section Break",
+ "label": "Address"
+ },
+ {
+ "fieldname": "column_break_46",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "profile_tab",
+ "fieldtype": "Tab Break",
+ "label": "Profile"
+ },
+ {
+ "fieldname": "passport_details_section",
+ "fieldtype": "Section Break",
+ "label": "Passport Details"
+ },
+ {
+ "fieldname": "column_break_73",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "bank_details_section",
+ "fieldtype": "Section Break",
+ "label": "Bank Details"
+ },
+ {
+ "fieldname": "column_break_9",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "column_break_25",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "connections_tab",
+ "fieldtype": "Tab Break",
+ "label": "Connections",
+ "show_dashboard": 1
+ },
+ {
+ "fieldname": "column_break_32",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "column_break_40",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "column_break_55",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "column_break_99",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "feedback_section",
+ "fieldtype": "Section Break",
+ "label": "Feedback"
+ },
+ {
+ "fieldname": "column_break_104",
+ "fieldtype": "Column Break"
}
],
"icon": "fa fa-user",
"idx": 24,
"image_field": "image",
"links": [],
- "modified": "2022-06-27 01:29:32.952091",
+ "modified": "2022-08-23 13:47:46.944993",
"modified_by": "Administrator",
"module": "Setup",
"name": "Employee",
diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py
index 0e68e85806..36d5a6ce0e 100644
--- a/erpnext/stock/doctype/delivery_note/delivery_note.py
+++ b/erpnext/stock/doctype/delivery_note/delivery_note.py
@@ -178,6 +178,7 @@ class DeliveryNote(SellingController):
if (
cint(frappe.db.get_single_value("Selling Settings", "maintain_same_sales_rate"))
and not self.is_return
+ and not self.is_internal_customer
):
self.validate_rate_with_reference_doc(
[
@@ -896,6 +897,8 @@ def make_inter_company_transaction(doctype, source_name, target_doc=None):
"name": "delivery_note_item",
"batch_no": "batch_no",
"serial_no": "serial_no",
+ "purchase_order": "purchase_order",
+ "purchase_order_item": "purchase_order_item",
},
"field_no_map": ["warehouse"],
},
diff --git a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
index 2de4842ebe..0911cdb476 100644
--- a/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
+++ b/erpnext/stock/doctype/delivery_note_item/delivery_note_item.json
@@ -86,6 +86,10 @@
"expense_account",
"allow_zero_valuation_rate",
"column_break_71",
+ "internal_transfer_section",
+ "purchase_order",
+ "column_break_82",
+ "purchase_order_item",
"accounting_dimensions_section",
"cost_center",
"dimension_col_break",
@@ -777,13 +781,39 @@
"no_copy": 1,
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "collapsible": 1,
+ "depends_on": "eval:parent.is_internal_customer == 1",
+ "fieldname": "internal_transfer_section",
+ "fieldtype": "Section Break",
+ "label": "Internal Transfer"
+ },
+ {
+ "fieldname": "purchase_order",
+ "fieldtype": "Link",
+ "label": "Purchase Order",
+ "options": "Purchase Order",
+ "print_hide": 1,
+ "read_only": 1
+ },
+ {
+ "fieldname": "column_break_82",
+ "fieldtype": "Column Break"
+ },
+ {
+ "fieldname": "purchase_order_item",
+ "fieldtype": "Data",
+ "label": "Purchase Order Item",
+ "print_hide": 1,
+ "read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
- "modified": "2022-06-17 05:25:47.711177",
+ "modified": "2022-09-06 14:19:42.876357",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",
diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js
index 07cb73b1d5..79e7895f6d 100644
--- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js
+++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.js
@@ -30,6 +30,7 @@ frappe.ui.form.on('Inventory Dimension', {
onload(frm) {
frm.trigger('render_traget_field');
+ frm.trigger("set_parent_fields");
},
refresh(frm) {
@@ -52,6 +53,30 @@ frappe.ui.form.on('Inventory Dimension', {
}
},
+ document_type(frm) {
+ frm.trigger("set_parent_fields");
+ },
+
+ set_parent_fields(frm) {
+ if (frm.doc.apply_to_all_doctypes) {
+ frm.set_df_property("fetch_from_parent", "options", frm.doc.reference_document);
+ } else if (frm.doc.document_type && frm.doc.istable) {
+ frappe.call({
+ method: 'erpnext.stock.doctype.inventory_dimension.inventory_dimension.get_parent_fields',
+ args: {
+ child_doctype: frm.doc.document_type,
+ dimension_name: frm.doc.reference_document
+ },
+ callback: (r) => {
+ if (r.message && r.message.length) {
+ frm.set_df_property("fetch_from_parent", "options",
+ [""].concat(r.message));
+ }
+ }
+ });
+ }
+ },
+
delete_dimension(frm) {
let msg = (`
Custom fields related to this dimension will be deleted on deletion of dimension.
diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
index 03e7fda841..09f4f63031 100644
--- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
+++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.json
@@ -144,16 +144,15 @@
"fieldtype": "Column Break"
},
{
- "depends_on": "istable",
"description": "Set fieldname or DocType name like Supplier, Customer etc.",
"fieldname": "fetch_from_parent",
- "fieldtype": "Data",
+ "fieldtype": "Select",
"label": "Fetch Value From Parent Form"
}
],
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2022-08-17 11:43:24.722441",
+ "modified": "2022-09-02 13:29:04.098469",
"modified_by": "Administrator",
"module": "Stock",
"name": "Inventory Dimension",
diff --git a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
index 4ff8f33b40..9e8c10b394 100644
--- a/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
+++ b/erpnext/stock/doctype/inventory_dimension/inventory_dimension.py
@@ -236,3 +236,30 @@ def get_inventory_dimensions():
def delete_dimension(dimension):
doc = frappe.get_doc("Inventory Dimension", dimension)
doc.delete()
+
+
+@frappe.whitelist()
+def get_parent_fields(child_doctype, dimension_name):
+ parent_doctypes = frappe.get_all(
+ "DocField", fields=["parent"], filters={"options": child_doctype}
+ )
+
+ fields = []
+
+ fields.extend(
+ frappe.get_all(
+ "DocField",
+ fields=["fieldname as value", "label"],
+ filters={"options": dimension_name, "parent": ("in", [d.parent for d in parent_doctypes])},
+ )
+ )
+
+ fields.extend(
+ frappe.get_all(
+ "Custom Field",
+ fields=["fieldname as value", "label"],
+ filters={"options": dimension_name, "dt": ("in", [d.parent for d in parent_doctypes])},
+ )
+ )
+
+ return fields
diff --git a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py
index cc90b74ee8..19ddc449f0 100644
--- a/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py
+++ b/erpnext/stock/doctype/inventory_dimension/test_inventory_dimension.py
@@ -2,14 +2,17 @@
# See license.txt
import frappe
+from frappe.custom.doctype.custom_field.custom_field import create_custom_field
from frappe.tests.utils import FrappeTestCase
+from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
from erpnext.stock.doctype.inventory_dimension.inventory_dimension import (
CanNotBeChildDoc,
CanNotBeDefaultDimension,
DoNotChangeError,
delete_dimension,
)
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
from erpnext.stock.doctype.warehouse.test_warehouse import create_warehouse
@@ -136,6 +139,58 @@ class TestInventoryDimension(FrappeTestCase):
self.assertTrue(inv_dim1.has_stock_ledger())
self.assertRaises(DoNotChangeError, inv_dim1.save)
+ def test_inventory_dimension_for_purchase_receipt_and_delivery_note(self):
+ create_inventory_dimension(
+ reference_document="Rack",
+ type_of_transaction="Both",
+ dimension_name="Rack",
+ apply_to_all_doctypes=1,
+ fetch_from_parent="Rack",
+ )
+
+ create_custom_field(
+ "Purchase Receipt", dict(fieldname="rack", label="Rack", fieldtype="Link", options="Rack")
+ )
+
+ create_custom_field(
+ "Delivery Note", dict(fieldname="rack", label="Rack", fieldtype="Link", options="Rack")
+ )
+
+ frappe.reload_doc("stock", "doctype", "purchase_receipt_item")
+ frappe.reload_doc("stock", "doctype", "delivery_note_item")
+
+ pr_doc = make_purchase_receipt(qty=2, do_not_submit=True)
+ pr_doc.rack = "Rack 1"
+ pr_doc.save()
+ pr_doc.submit()
+
+ pr_doc.load_from_db()
+
+ self.assertEqual(pr_doc.items[0].rack, "Rack 1")
+ sle_rack = frappe.db.get_value(
+ "Stock Ledger Entry",
+ {"voucher_detail_no": pr_doc.items[0].name, "voucher_type": pr_doc.doctype},
+ "rack",
+ )
+
+ self.assertEqual(sle_rack, "Rack 1")
+
+ dn_doc = create_delivery_note(qty=2, do_not_submit=True)
+ dn_doc.rack = "Rack 1"
+ dn_doc.save()
+ dn_doc.submit()
+
+ dn_doc.load_from_db()
+
+ self.assertEqual(dn_doc.items[0].rack, "Rack 1")
+ sle_rack = frappe.db.get_value(
+ "Stock Ledger Entry",
+ {"voucher_detail_no": dn_doc.items[0].name, "voucher_type": dn_doc.doctype},
+ "rack",
+ )
+
+ self.assertEqual(sle_rack, "Rack 1")
+
def prepare_test_data():
if not frappe.db.exists("DocType", "Shelf"):
@@ -160,6 +215,28 @@ def prepare_test_data():
create_warehouse("Shelf Warehouse")
+ if not frappe.db.exists("DocType", "Rack"):
+ frappe.get_doc(
+ {
+ "doctype": "DocType",
+ "name": "Rack",
+ "module": "Stock",
+ "custom": 1,
+ "naming_rule": "By fieldname",
+ "autoname": "field:rack_name",
+ "fields": [{"label": "Rack Name", "fieldname": "rack_name", "fieldtype": "Data"}],
+ "permissions": [
+ {"role": "System Manager", "permlevel": 0, "read": 1, "write": 1, "create": 1, "delete": 1}
+ ],
+ }
+ ).insert(ignore_permissions=True)
+
+ for rack in ["Rack 1"]:
+ if not frappe.db.exists("Rack", rack):
+ frappe.get_doc({"doctype": "Rack", "rack_name": rack}).insert(ignore_permissions=True)
+
+ create_warehouse("Rack Warehouse")
+
def create_inventory_dimension(**args):
args = frappe._dict(args)
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 29b001fdcb..7e1476d240 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -562,7 +562,7 @@ $.extend(erpnext.item, {
let selected_attributes = {};
me.multiple_variant_dialog.$wrapper.find('.form-column').each((i, col) => {
if(i===0) return;
- let attribute_name = $(col).find('label').html().trim();
+ let attribute_name = $(col).find('.control-label').html().trim();
selected_attributes[attribute_name] = [];
let checked_opts = $(col).find('.checkbox input');
checked_opts.each((i, opt) => {
diff --git a/erpnext/stock/doctype/item/item_dashboard.py b/erpnext/stock/doctype/item/item_dashboard.py
index 897acb7448..34bb4d1225 100644
--- a/erpnext/stock/doctype/item/item_dashboard.py
+++ b/erpnext/stock/doctype/item/item_dashboard.py
@@ -5,7 +5,7 @@ def get_data():
return {
"heatmap": True,
"heatmap_message": _("This is based on stock movement. See {0} for details").format(
- '
' + _("Stock Ledger") + ""
+ '
' + _("Stock Ledger") + ""
),
"fieldname": "item_code",
"non_standard_fieldnames": {
diff --git a/erpnext/stock/doctype/item_barcode/item_barcode.json b/erpnext/stock/doctype/item_barcode/item_barcode.json
index 56832f32d3..bda1218817 100644
--- a/erpnext/stock/doctype/item_barcode/item_barcode.json
+++ b/erpnext/stock/doctype/item_barcode/item_barcode.json
@@ -17,6 +17,7 @@
"in_list_view": 1,
"label": "Barcode",
"no_copy": 1,
+ "reqd": 1,
"unique": 1
},
{
@@ -36,7 +37,7 @@
],
"istable": 1,
"links": [],
- "modified": "2022-06-01 06:24:33.969534",
+ "modified": "2022-08-24 19:59:47.871677",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Barcode",
diff --git a/erpnext/stock/doctype/item_price/item_price.json b/erpnext/stock/doctype/item_price/item_price.json
index 83177b372a..8c6f6d85a4 100644
--- a/erpnext/stock/doctype/item_price/item_price.json
+++ b/erpnext/stock/doctype/item_price/item_price.json
@@ -48,41 +48,31 @@
"oldfieldtype": "Select",
"options": "Item",
"reqd": 1,
- "search_index": 1,
- "show_days": 1,
- "show_seconds": 1
+ "search_index": 1
},
{
"fieldname": "uom",
"fieldtype": "Link",
"label": "UOM",
- "options": "UOM",
- "show_days": 1,
- "show_seconds": 1
+ "options": "UOM"
},
{
"default": "0",
"description": "Quantity that must be bought or sold per UOM",
"fieldname": "packing_unit",
"fieldtype": "Int",
- "label": "Packing Unit",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Packing Unit"
},
{
"fieldname": "column_break_17",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Item Name",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fetch_from": "item_code.brand",
@@ -90,36 +80,29 @@
"fieldtype": "Read Only",
"in_list_view": 1,
"label": "Brand",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "item_description",
"fieldtype": "Text",
"label": "Item Description",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "price_list_details",
"fieldtype": "Section Break",
"label": "Price List",
- "options": "fa fa-tags",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-tags"
},
{
"fieldname": "price_list",
"fieldtype": "Link",
"in_global_search": 1,
+ "in_list_view": 1,
"in_standard_filter": 1,
"label": "Price List",
"options": "Price List",
- "reqd": 1,
- "show_days": 1,
- "show_seconds": 1
+ "reqd": 1
},
{
"bold": 1,
@@ -127,49 +110,37 @@
"fieldname": "customer",
"fieldtype": "Link",
"label": "Customer",
- "options": "Customer",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Customer"
},
{
"depends_on": "eval:doc.buying == 1",
"fieldname": "supplier",
"fieldtype": "Link",
"label": "Supplier",
- "options": "Supplier",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Supplier"
},
{
"fieldname": "column_break_3",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "buying",
"fieldtype": "Check",
"label": "Buying",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"default": "0",
"fieldname": "selling",
"fieldtype": "Check",
"label": "Selling",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "item_details",
"fieldtype": "Section Break",
- "options": "fa fa-tag",
- "show_days": 1,
- "show_seconds": 1
+ "options": "fa fa-tag"
},
{
"bold": 1,
@@ -177,15 +148,11 @@
"fieldtype": "Link",
"label": "Currency",
"options": "Currency",
- "read_only": 1,
- "show_days": 1,
- "show_seconds": 1
+ "read_only": 1
},
{
"fieldname": "col_br_1",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "price_list_rate",
@@ -197,80 +164,61 @@
"oldfieldname": "ref_rate",
"oldfieldtype": "Currency",
"options": "currency",
- "reqd": 1,
- "show_days": 1,
- "show_seconds": 1
+ "reqd": 1
},
{
"fieldname": "section_break_15",
- "fieldtype": "Section Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Section Break"
},
{
"default": "Today",
"fieldname": "valid_from",
"fieldtype": "Date",
- "label": "Valid From",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Valid From"
},
{
"default": "0",
"fieldname": "lead_time_days",
"fieldtype": "Int",
- "label": "Lead Time in days",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Lead Time in days"
},
{
"fieldname": "column_break_18",
- "fieldtype": "Column Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Column Break"
},
{
"fieldname": "valid_upto",
"fieldtype": "Date",
- "label": "Valid Upto",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Valid Upto"
},
{
"fieldname": "section_break_24",
- "fieldtype": "Section Break",
- "show_days": 1,
- "show_seconds": 1
+ "fieldtype": "Section Break"
},
{
"fieldname": "note",
"fieldtype": "Text",
- "label": "Note",
- "show_days": 1,
- "show_seconds": 1
+ "label": "Note"
},
{
"fieldname": "reference",
"fieldtype": "Data",
"in_list_view": 1,
- "label": "Reference",
- "show_days": 1,
- "show_seconds": 1
+ "in_standard_filter": 1,
+ "label": "Reference"
},
{
"fieldname": "batch_no",
"fieldtype": "Link",
"label": "Batch No",
- "options": "Batch",
- "show_days": 1,
- "show_seconds": 1
+ "options": "Batch"
}
],
"icon": "fa fa-flag",
"idx": 1,
"index_web_pages_for_search": 1,
"links": [],
- "modified": "2020-12-08 18:12:15.395772",
+ "modified": "2022-09-02 16:33:55.612992",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Price",
@@ -307,6 +255,7 @@
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "ASC",
+ "states": [],
"title_field": "item_name",
"track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item_price/item_price_list.js b/erpnext/stock/doctype/item_price/item_price_list.js
new file mode 100644
index 0000000000..48158393f6
--- /dev/null
+++ b/erpnext/stock/doctype/item_price/item_price_list.js
@@ -0,0 +1,3 @@
+frappe.listview_settings['Item Price'] = {
+ hide_name_column: true,
+};
diff --git a/erpnext/stock/doctype/item_supplier/item_supplier.json b/erpnext/stock/doctype/item_supplier/item_supplier.json
index 6cff8e0892..84649a67d0 100644
--- a/erpnext/stock/doctype/item_supplier/item_supplier.json
+++ b/erpnext/stock/doctype/item_supplier/item_supplier.json
@@ -1,95 +1,43 @@
{
- "allow_copy": 0,
- "allow_import": 0,
- "allow_rename": 0,
- "beta": 0,
- "creation": "2013-02-22 01:28:01",
- "custom": 0,
- "docstatus": 0,
- "doctype": "DocType",
- "editable_grid": 1,
- "engine": "InnoDB",
+ "actions": [],
+ "creation": "2013-02-22 01:28:01",
+ "doctype": "DocType",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "field_order": [
+ "supplier",
+ "supplier_part_no"
+ ],
"fields": [
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "supplier",
- "fieldtype": "Link",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 0,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Supplier",
- "length": 0,
- "no_copy": 0,
- "options": "Supplier",
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
+ "fieldname": "supplier",
+ "fieldtype": "Link",
+ "in_list_view": 1,
+ "label": "Supplier",
+ "options": "Supplier",
+ "reqd": 1
+ },
{
- "allow_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "supplier_part_no",
- "fieldtype": "Data",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_global_search": 1,
- "in_list_view": 1,
- "in_standard_filter": 0,
- "label": "Supplier Part Number",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "print_width": "200px",
- "read_only": 0,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0,
+ "fieldname": "supplier_part_no",
+ "fieldtype": "Data",
+ "in_global_search": 1,
+ "in_list_view": 1,
+ "label": "Supplier Part Number",
+ "print_width": "200px",
"width": "200px"
}
- ],
- "hide_heading": 0,
- "hide_toolbar": 0,
- "idx": 1,
- "image_view": 0,
- "in_create": 0,
-
- "is_submittable": 0,
- "issingle": 0,
- "istable": 1,
- "max_attachments": 0,
- "modified": "2017-02-20 13:29:32.569715",
- "modified_by": "Administrator",
- "module": "Stock",
- "name": "Item Supplier",
- "owner": "Administrator",
- "permissions": [],
- "quick_entry": 0,
- "read_only": 0,
- "read_only_onload": 0,
- "show_name_in_global_search": 0,
- "track_changes": 1,
- "track_seen": 0
+ ],
+ "idx": 1,
+ "istable": 1,
+ "links": [],
+ "modified": "2022-09-07 12:33:55.780062",
+ "modified_by": "Administrator",
+ "module": "Stock",
+ "name": "Item Supplier",
+ "owner": "Administrator",
+ "permissions": [],
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "states": [],
+ "track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/material_request/material_request.json b/erpnext/stock/doctype/material_request/material_request.json
index cb46a6c368..35931307af 100644
--- a/erpnext/stock/doctype/material_request/material_request.json
+++ b/erpnext/stock/doctype/material_request/material_request.json
@@ -37,7 +37,8 @@
"tc_name",
"terms",
"reference",
- "job_card"
+ "job_card",
+ "work_order"
],
"fields": [
{
@@ -309,16 +310,24 @@
"label": "Transfer Status",
"options": "\nNot Started\nIn Transit\nCompleted",
"read_only": 1
+ },
+ {
+ "fieldname": "work_order",
+ "fieldtype": "Link",
+ "label": "Work Order",
+ "options": "Work Order",
+ "read_only": 1
}
],
"icon": "fa fa-ticket",
"idx": 70,
"is_submittable": 1,
"links": [],
- "modified": "2021-08-17 20:16:12.737743",
+ "modified": "2022-08-25 11:49:28.155048",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request",
+ "naming_rule": "By \"Naming Series\" field",
"owner": "Administrator",
"permissions": [
{
@@ -386,5 +395,6 @@
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC",
+ "states": [],
"title_field": "title"
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js
index d6e00eada7..eae73050b2 100644
--- a/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js
+++ b/erpnext/stock/doctype/repost_item_valuation/repost_item_valuation.js
@@ -24,7 +24,8 @@ frappe.ui.form.on('Repost Item Valuation', {
frm.set_query("voucher_no", () => {
return {
filters: {
- company: frm.doc.company
+ company: frm.doc.company,
+ docstatus: 1
}
};
});
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js
index e3a8438d95..1bbe570807 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.js
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.js
@@ -174,6 +174,8 @@ frappe.ui.form.on('Stock Entry', {
if(!items.length) {
items = frm.doc.items;
}
+
+ mr.work_order = frm.doc.work_order;
items.forEach(function(item) {
var mr_item = frappe.model.add_child(mr, 'items');
mr_item.item_code = item.item_code;
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index f719c1efda..d70952282d 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -116,6 +116,7 @@ class StockEntry(StockController):
self.validate_warehouse()
self.validate_work_order()
self.validate_bom()
+ self.validate_purchase_order()
if self.purpose in ("Manufacture", "Repack"):
self.mark_finished_and_scrap_items()
@@ -946,6 +947,19 @@ class StockEntry(StockController):
item_code = d.original_item or d.item_code
validate_bom_no(item_code, d.bom_no)
+ def validate_purchase_order(self):
+ if self.purpose == "Send to Subcontractor" and self.get("purchase_order"):
+ is_old_subcontracting_flow = frappe.db.get_value(
+ "Purchase Order", self.purchase_order, "is_old_subcontracting_flow"
+ )
+
+ if not is_old_subcontracting_flow:
+ frappe.throw(
+ _("Please select Subcontracting Order instead of Purchase Order {0}").format(
+ self.purchase_order
+ )
+ )
+
def mark_finished_and_scrap_items(self):
if any([d.item_code for d in self.items if (d.is_finished_item and d.t_warehouse)]):
return
@@ -2215,7 +2229,7 @@ class StockEntry(StockController):
return sorted(list(set(get_serial_nos(self.pro_doc.serial_no)) - set(used_serial_nos)))
def update_subcontracting_order_status(self):
- if self.subcontracting_order and self.purpose == "Send to Subcontractor":
+ if self.subcontracting_order and self.purpose in ["Send to Subcontractor", "Material Transfer"]:
from erpnext.subcontracting.doctype.subcontracting_order.subcontracting_order import (
update_subcontracting_order_status,
)
@@ -2554,27 +2568,26 @@ def get_supplied_items(
@frappe.whitelist()
def get_items_from_subcontracting_order(source_name, target_doc=None):
- sco = frappe.get_doc("Subcontracting Order", source_name)
+ def post_process(source, target):
+ target.stock_entry_type = target.purpose = "Send to Subcontractor"
+ target.subcontracting_order = source_name
- if sco.docstatus == 1:
- if target_doc and isinstance(target_doc, str):
- target_doc = frappe.get_doc(json.loads(target_doc))
-
- if target_doc.items:
- target_doc.items = []
+ if target.items:
+ target.items = []
warehouses = {}
- for item in sco.items:
+ for item in source.items:
warehouses[item.name] = item.warehouse
- for item in sco.supplied_items:
- target_doc.append(
+ for item in source.supplied_items:
+ target.append(
"items",
{
"s_warehouse": warehouses.get(item.reference_name),
- "t_warehouse": sco.supplier_warehouse,
+ "t_warehouse": source.supplier_warehouse,
+ "subcontracted_item": item.main_item_code,
"item_code": item.rm_item_code,
- "qty": item.required_qty,
+ "qty": max(item.required_qty - item.total_supplied_qty, 0),
"transfer_qty": item.required_qty,
"uom": item.stock_uom,
"stock_uom": item.stock_uom,
@@ -2582,6 +2595,23 @@ def get_items_from_subcontracting_order(source_name, target_doc=None):
},
)
+ target_doc = get_mapped_doc(
+ "Subcontracting Order",
+ source_name,
+ {
+ "Subcontracting Order": {
+ "doctype": "Stock Entry",
+ "field_no_map": ["purchase_order"],
+ "validation": {
+ "docstatus": ["=", 1],
+ },
+ },
+ },
+ target_doc,
+ post_process,
+ ignore_child_tables=True,
+ )
+
return target_doc
diff --git a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js
index c20f8ab665..065ef39db3 100644
--- a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js
+++ b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.js
@@ -107,9 +107,9 @@ frappe.ui.form.on('Subcontracting Order', {
get_materials_from_supplier: function (frm) {
let sco_rm_details = [];
- if (frm.doc.supplied_items && (frm.doc.per_received == 100)) {
+ if (frm.doc.supplied_items && frm.doc.per_received > 0) {
frm.doc.supplied_items.forEach(d => {
- if (d.total_supplied_qty && d.total_supplied_qty != d.consumed_qty) {
+ if (d.total_supplied_qty > 0 && d.total_supplied_qty != d.consumed_qty) {
sco_rm_details.push(d.name);
}
});
@@ -160,14 +160,11 @@ erpnext.buying.SubcontractingOrderController = class SubcontractingOrderControll
var me = this;
if (doc.docstatus == 1) {
- if (doc.status != 'Completed') {
+ if (!['Closed', 'Completed'].includes(doc.status)) {
if (flt(doc.per_received) < 100) {
cur_frm.add_custom_button(__('Subcontracting Receipt'), this.make_subcontracting_receipt, __('Create'));
if (me.has_unsupplied_items()) {
- cur_frm.add_custom_button(__('Material to Supplier'),
- () => {
- me.make_stock_entry();
- }, __('Transfer'));
+ cur_frm.add_custom_button(__('Material to Supplier'), this.make_stock_entry, __('Transfer'));
}
}
cur_frm.page.set_inner_btn_group_as_primary(__('Create'));
@@ -195,120 +192,6 @@ erpnext.buying.SubcontractingOrderController = class SubcontractingOrderControll
transaction_controller.autofill_warehouse(child_table, warehouse_field, warehouse);
}
- make_stock_entry() {
- var items = $.map(cur_frm.doc.items, (d) => d.bom ? d.item_code : false);
- var me = this;
-
- if (items.length >= 1) {
- me.raw_material_data = [];
- me.show_dialog = 1;
- let title = __('Transfer Material to Supplier');
- let fields = [
- { fieldtype: 'Section Break', label: __('Raw Materials') },
- {
- fieldname: 'sub_con_rm_items', fieldtype: 'Table', label: __('Items'),
- fields: [
- {
- fieldtype: 'Data',
- fieldname: 'item_code',
- label: __('Item'),
- read_only: 1,
- in_list_view: 1
- },
- {
- fieldtype: 'Data',
- fieldname: 'rm_item_code',
- label: __('Raw Material'),
- read_only: 1,
- in_list_view: 1
- },
- {
- fieldtype: 'Float',
- read_only: 1,
- fieldname: 'qty',
- label: __('Quantity'),
- in_list_view: 1
- },
- {
- fieldtype: 'Data',
- read_only: 1,
- fieldname: 'warehouse',
- label: __('Reserve Warehouse'),
- in_list_view: 1
- },
- {
- fieldtype: 'Float',
- read_only: 1,
- fieldname: 'rate',
- label: __('Rate'),
- hidden: 1
- },
- {
- fieldtype: 'Float',
- read_only: 1,
- fieldname: 'amount',
- label: __('Amount'),
- hidden: 1
- },
- {
- fieldtype: 'Link',
- read_only: 1,
- fieldname: 'uom',
- label: __('UOM'),
- hidden: 1
- }
- ],
- data: me.raw_material_data,
- get_data: () => me.raw_material_data
- }
- ];
-
- me.dialog = new frappe.ui.Dialog({
- title: title, fields: fields
- });
-
- if (me.frm.doc['supplied_items']) {
- me.frm.doc['supplied_items'].forEach((item) => {
- if (item.rm_item_code && item.main_item_code && item.required_qty - item.supplied_qty != 0) {
- me.raw_material_data.push({
- 'name': item.name,
- 'item_code': item.main_item_code,
- 'rm_item_code': item.rm_item_code,
- 'item_name': item.rm_item_code,
- 'qty': item.required_qty - item.supplied_qty,
- 'warehouse': item.reserve_warehouse,
- 'rate': item.rate,
- 'amount': item.amount,
- 'stock_uom': item.stock_uom
- });
- me.dialog.fields_dict.sub_con_rm_items.grid.refresh();
- }
- });
- }
-
- me.dialog.get_field('sub_con_rm_items').check_all_rows();
-
- me.dialog.show();
- this.dialog.set_primary_action(__('Transfer'), () => {
- me.values = me.dialog.get_values();
- if (me.values) {
- me.values.sub_con_rm_items.map((row, i) => {
- if (!row.item_code || !row.rm_item_code || !row.warehouse || !row.qty || row.qty === 0) {
- let row_id = i + 1;
- frappe.throw(__('Item Code, warehouse and quantity are required on row {0}', [row_id]));
- }
- });
- me.make_rm_stock_entry(me.dialog.fields_dict.sub_con_rm_items.grid.get_selected_children());
- me.dialog.hide();
- }
- });
- }
-
- me.dialog.get_close_btn().on('click', () => {
- me.dialog.hide();
- });
- }
-
has_unsupplied_items() {
return this.frm.doc['supplied_items'].some(item => item.required_qty > item.supplied_qty);
}
@@ -321,6 +204,15 @@ erpnext.buying.SubcontractingOrderController = class SubcontractingOrderControll
});
}
+ make_stock_entry() {
+ frappe.model.open_mapped_doc({
+ method: 'erpnext.stock.doctype.stock_entry.stock_entry.get_items_from_subcontracting_order',
+ source_name: cur_frm.doc.name,
+ freeze: true,
+ freeze_message: __('Creating Stock Entry ...')
+ });
+ }
+
make_rm_stock_entry(rm_items) {
frappe.call({
method: 'erpnext.controllers.subcontracting_controller.make_rm_stock_entry',
diff --git a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
index 156f027617..e6de72d494 100644
--- a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
+++ b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order.py
@@ -153,7 +153,7 @@ class SubcontractingOrder(SubcontractingController):
else:
self.set_missing_values()
- def update_status(self, status=None, update_modified=False):
+ def update_status(self, status=None, update_modified=True):
if self.docstatus >= 1 and not status:
if self.docstatus == 1:
if self.status == "Draft":
@@ -162,6 +162,10 @@ class SubcontractingOrder(SubcontractingController):
status = "Completed"
elif self.per_received > 0 and self.per_received < 100:
status = "Partially Received"
+ for item in self.supplied_items:
+ if item.returned_qty:
+ status = "Closed"
+ break
else:
total_required_qty = total_supplied_qty = 0
for item in self.supplied_items:
@@ -176,7 +180,10 @@ class SubcontractingOrder(SubcontractingController):
elif self.docstatus == 2:
status = "Cancelled"
- frappe.db.set_value("Subcontracting Order", self.name, "status", status, update_modified)
+ if status:
+ frappe.db.set_value(
+ "Subcontracting Order", self.name, "status", status, update_modified=update_modified
+ )
@frappe.whitelist()
diff --git a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order_list.js b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order_list.js
index 650419cf74..aab2fc927d 100644
--- a/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order_list.js
+++ b/erpnext/subcontracting/doctype/subcontracting_order/subcontracting_order_list.js
@@ -10,6 +10,7 @@ frappe.listview_settings['Subcontracting Order'] = {
"Completed": "green",
"Partial Material Transferred": "purple",
"Material Transferred": "blue",
+ "Closed": "red",
};
return [__(doc.status), status_colors[doc.status], "status,=," + doc.status];
},
diff --git a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py
index a676e48fad..9385568c2b 100644
--- a/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py
+++ b/erpnext/subcontracting/doctype/subcontracting_order/test_subcontracting_order.py
@@ -7,7 +7,10 @@ import frappe
from frappe.tests.utils import FrappeTestCase
from erpnext.buying.doctype.purchase_order.purchase_order import get_mapped_subcontracting_order
-from erpnext.controllers.subcontracting_controller import make_rm_stock_entry
+from erpnext.controllers.subcontracting_controller import (
+ get_materials_from_supplier,
+ make_rm_stock_entry,
+)
from erpnext.controllers.tests.test_subcontracting_controller import (
get_rm_items,
get_subcontracting_order,
@@ -89,6 +92,16 @@ class TestSubcontractingOrder(FrappeTestCase):
sco.load_from_db()
self.assertEqual(sco.status, "Partially Received")
+ # Closed
+ ste = get_materials_from_supplier(sco.name, [d.name for d in sco.supplied_items])
+ ste.save()
+ ste.submit()
+ sco.load_from_db()
+ self.assertEqual(sco.status, "Closed")
+ ste.cancel()
+ sco.load_from_db()
+ self.assertEqual(sco.status, "Partially Received")
+
# Completed
scr = make_subcontracting_receipt(sco.name)
scr.save()
@@ -174,22 +187,13 @@ class TestSubcontractingOrder(FrappeTestCase):
self.assertEqual(len(ste.items), len(rm_items))
def test_update_reserved_qty_for_subcontracting(self):
- # Make stock available for raw materials
- make_stock_entry(target="_Test Warehouse - _TC", qty=10, basic_rate=100)
+ # Create RM Material Receipt
+ make_stock_entry(target="_Test Warehouse - _TC", item_code="_Test Item", qty=10, basic_rate=100)
make_stock_entry(
target="_Test Warehouse - _TC", item_code="_Test Item Home Desktop 100", qty=20, basic_rate=100
)
- make_stock_entry(
- target="_Test Warehouse 1 - _TC", item_code="_Test Item", qty=30, basic_rate=100
- )
- make_stock_entry(
- target="_Test Warehouse 1 - _TC",
- item_code="_Test Item Home Desktop 100",
- qty=30,
- basic_rate=100,
- )
- bin1 = frappe.db.get_value(
+ bin_before_sco = frappe.db.get_value(
"Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname=["reserved_qty_for_sub_contract", "projected_qty", "modified"],
@@ -209,102 +213,97 @@ class TestSubcontractingOrder(FrappeTestCase):
]
sco = get_subcontracting_order(service_items=service_items)
- bin2 = frappe.db.get_value(
+ bin_after_sco = frappe.db.get_value(
"Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname=["reserved_qty_for_sub_contract", "projected_qty", "modified"],
as_dict=1,
)
- self.assertEqual(bin2.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
- self.assertEqual(bin2.projected_qty, bin1.projected_qty - 10)
- self.assertNotEqual(bin1.modified, bin2.modified)
+ # reserved_qty_for_sub_contract should be increased by 10
+ self.assertEqual(
+ bin_after_sco.reserved_qty_for_sub_contract, bin_before_sco.reserved_qty_for_sub_contract + 10
+ )
- # Create stock transfer
+ # projected_qty should be decreased by 10
+ self.assertEqual(bin_after_sco.projected_qty, bin_before_sco.projected_qty - 10)
+
+ self.assertNotEqual(bin_before_sco.modified, bin_after_sco.modified)
+
+ # Create Stock Entry(Send to Subcontractor)
rm_items = [
{
"item_code": "_Test FG Item",
"rm_item_code": "_Test Item",
"item_name": "_Test Item",
- "qty": 6,
+ "qty": 10,
"warehouse": "_Test Warehouse - _TC",
"rate": 100,
- "amount": 600,
+ "amount": 1000,
"stock_uom": "Nos",
- }
+ },
+ {
+ "item_code": "_Test FG Item",
+ "rm_item_code": "_Test Item Home Desktop 100",
+ "item_name": "_Test Item Home Desktop 100",
+ "qty": 20,
+ "warehouse": "_Test Warehouse - _TC",
+ "rate": 100,
+ "amount": 2000,
+ "stock_uom": "Nos",
+ },
]
ste = frappe.get_doc(make_rm_stock_entry(sco.name, rm_items))
ste.to_warehouse = "_Test Warehouse 1 - _TC"
ste.save()
ste.submit()
- bin3 = frappe.db.get_value(
+ bin_after_rm_transfer = frappe.db.get_value(
"Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract",
as_dict=1,
)
- self.assertEqual(bin3.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
-
- make_stock_entry(
- target="_Test Warehouse 1 - _TC", item_code="_Test Item", qty=40, basic_rate=100
- )
- make_stock_entry(
- target="_Test Warehouse 1 - _TC",
- item_code="_Test Item Home Desktop 100",
- qty=40,
- basic_rate=100,
+ # reserved_qty_for_sub_contract should be decreased by 10
+ self.assertEqual(
+ bin_after_rm_transfer.reserved_qty_for_sub_contract,
+ bin_after_sco.reserved_qty_for_sub_contract - 10,
)
- # Make SCR against the SCO
- scr = make_subcontracting_receipt(sco.name)
- scr.save()
- scr.submit()
-
- bin4 = frappe.db.get_value(
- "Bin",
- filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
- fieldname="reserved_qty_for_sub_contract",
- as_dict=1,
- )
-
- self.assertEqual(bin4.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
-
- # Cancel SCR
- scr.reload()
- scr.cancel()
- bin5 = frappe.db.get_value(
- "Bin",
- filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
- fieldname="reserved_qty_for_sub_contract",
- as_dict=1,
- )
-
- self.assertEqual(bin5.reserved_qty_for_sub_contract, bin2.reserved_qty_for_sub_contract - 6)
-
- # Cancel Stock Entry
+ # Cancel Stock Entry(Send to Subcontractor)
ste.cancel()
- bin6 = frappe.db.get_value(
+ bin_after_cancel_ste = frappe.db.get_value(
"Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract",
as_dict=1,
)
- self.assertEqual(bin6.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract + 10)
+ # reserved_qty_for_sub_contract should be increased by 10
+ self.assertEqual(
+ bin_after_cancel_ste.reserved_qty_for_sub_contract,
+ bin_after_rm_transfer.reserved_qty_for_sub_contract + 10,
+ )
- # Cancel PO
+ # Cancel SCO
sco.reload()
sco.cancel()
- bin7 = frappe.db.get_value(
+ bin_after_cancel_sco = frappe.db.get_value(
"Bin",
filters={"warehouse": "_Test Warehouse - _TC", "item_code": "_Test Item"},
fieldname="reserved_qty_for_sub_contract",
as_dict=1,
)
- self.assertEqual(bin7.reserved_qty_for_sub_contract, bin1.reserved_qty_for_sub_contract)
+ # reserved_qty_for_sub_contract should be decreased by 10
+ self.assertEqual(
+ bin_after_cancel_sco.reserved_qty_for_sub_contract,
+ bin_after_cancel_ste.reserved_qty_for_sub_contract - 10,
+ )
+ self.assertEqual(
+ bin_after_cancel_sco.reserved_qty_for_sub_contract, bin_before_sco.reserved_qty_for_sub_contract
+ )
def test_exploded_items(self):
item_code = "_Test Subcontracted FG Item 11"
diff --git a/erpnext/subcontracting/doctype/subcontracting_order_supplied_item/subcontracting_order_supplied_item.json b/erpnext/subcontracting/doctype/subcontracting_order_supplied_item/subcontracting_order_supplied_item.json
index a206a21ca6..8f7128be9a 100644
--- a/erpnext/subcontracting/doctype/subcontracting_order_supplied_item/subcontracting_order_supplied_item.json
+++ b/erpnext/subcontracting/doctype/subcontracting_order_supplied_item/subcontracting_order_supplied_item.json
@@ -150,8 +150,7 @@
"label": "Returned Qty",
"no_copy": 1,
"print_hide": 1,
- "read_only": 1,
- "hidden": 1
+ "read_only": 1
},
{
"fieldname": "total_supplied_qty",
@@ -166,7 +165,7 @@
"hide_toolbar": 1,
"istable": 1,
"links": [],
- "modified": "2022-04-07 12:58:28.208847",
+ "modified": "2022-08-26 16:04:56.125951",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Order Supplied Item",
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json
index 872d18e15e..5cd4e637cc 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json
@@ -369,7 +369,7 @@
"in_standard_filter": 1,
"label": "Status",
"no_copy": 1,
- "options": "\nDraft\nCompleted\nReturn\nReturn Issued\nCancelled",
+ "options": "\nDraft\nCompleted\nReturn\nReturn Issued\nCancelled\nClosed",
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
@@ -625,9 +625,10 @@
"print_hide": 1
}
],
+ "in_create": 1,
"is_submittable": 1,
"links": [],
- "modified": "2022-08-19 19:50:16.935124",
+ "modified": "2022-08-26 21:02:26.353870",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt",
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
index b8134d7b27..cd05b745e6 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py
@@ -77,6 +77,7 @@ class SubcontractingReceipt(SubcontractingController):
self.get_current_stock()
def on_submit(self):
+ self.validate_available_qty_for_consumption()
self.update_status_updater_args()
self.update_prevdoc_status()
self.set_subcontracting_order_status()
@@ -109,10 +110,42 @@ class SubcontractingReceipt(SubcontractingController):
self.set_missing_values_in_supplied_items()
self.set_missing_values_in_items()
+ def set_available_qty_for_consumption(self):
+ supplied_items_details = {}
+
+ sco_supplied_item = frappe.qb.DocType("Subcontracting Order Supplied Item")
+ for item in self.get("items"):
+ supplied_items = (
+ frappe.qb.from_(sco_supplied_item)
+ .select(
+ sco_supplied_item.rm_item_code,
+ sco_supplied_item.reference_name,
+ (sco_supplied_item.total_supplied_qty - sco_supplied_item.consumed_qty).as_("available_qty"),
+ )
+ .where(
+ (sco_supplied_item.parent == item.subcontracting_order)
+ & (sco_supplied_item.main_item_code == item.item_code)
+ & (sco_supplied_item.reference_name == item.subcontracting_order_item)
+ )
+ ).run(as_dict=True)
+
+ if supplied_items:
+ supplied_items_details[item.name] = {}
+
+ for supplied_item in supplied_items:
+ supplied_items_details[item.name][supplied_item.rm_item_code] = supplied_item.available_qty
+ else:
+ for item in self.get("supplied_items"):
+ item.available_qty_for_consumption = supplied_items_details.get(item.reference_name, {}).get(
+ item.rm_item_code, 0
+ )
+
def set_missing_values_in_supplied_items(self):
for item in self.get("supplied_items") or []:
item.amount = item.rate * item.consumed_qty
+ self.set_available_qty_for_consumption()
+
def set_missing_values_in_items(self):
rm_supp_cost = {}
for item in self.get("supplied_items") or []:
@@ -149,6 +182,17 @@ class SubcontractingReceipt(SubcontractingController):
_("Rejected Warehouse is mandatory against rejected Item {0}").format(item.item_code)
)
+ def validate_available_qty_for_consumption(self):
+ for item in self.get("supplied_items"):
+ if (
+ item.available_qty_for_consumption and item.available_qty_for_consumption < item.consumed_qty
+ ):
+ frappe.throw(
+ _(
+ "Row {0}: Consumed Qty must be less than or equal to Available Qty For Consumption in Consumed Items Table."
+ ).format(item.idx)
+ )
+
def set_items_cost_center(self):
if self.company:
cost_center = frappe.get_cached_value("Company", self.company, "cost_center")
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
index b5e6139bb7..090f1457d9 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt/test_subcontracting_receipt.py
@@ -73,6 +73,55 @@ class TestSubcontractingReceipt(FrappeTestCase):
rm_supp_cost = sum(item.amount for item in scr.get("supplied_items"))
self.assertEqual(scr.get("items")[0].rm_supp_cost, flt(rm_supp_cost))
+ def test_available_qty_for_consumption(self):
+ make_stock_entry(
+ item_code="_Test Item", qty=100, target="_Test Warehouse 1 - _TC", basic_rate=100
+ )
+ make_stock_entry(
+ item_code="_Test Item Home Desktop 100",
+ qty=100,
+ target="_Test Warehouse 1 - _TC",
+ basic_rate=100,
+ )
+ service_items = [
+ {
+ "warehouse": "_Test Warehouse - _TC",
+ "item_code": "Subcontracted Service Item 1",
+ "qty": 10,
+ "rate": 100,
+ "fg_item": "_Test FG Item",
+ "fg_item_qty": 10,
+ },
+ ]
+ sco = get_subcontracting_order(service_items=service_items)
+ rm_items = [
+ {
+ "main_item_code": "_Test FG Item",
+ "item_code": "_Test Item",
+ "qty": 5.0,
+ "rate": 100.0,
+ "stock_uom": "_Test UOM",
+ "warehouse": "_Test Warehouse - _TC",
+ },
+ {
+ "main_item_code": "_Test FG Item",
+ "item_code": "_Test Item Home Desktop 100",
+ "qty": 10.0,
+ "rate": 100.0,
+ "stock_uom": "_Test UOM",
+ "warehouse": "_Test Warehouse - _TC",
+ },
+ ]
+ itemwise_details = make_stock_in_entry(rm_items=rm_items)
+ make_stock_transfer_entry(
+ sco_no=sco.name,
+ rm_items=rm_items,
+ itemwise_details=copy.deepcopy(itemwise_details),
+ )
+ scr = make_subcontracting_receipt(sco.name)
+ scr.save()
+ self.assertRaises(frappe.ValidationError, scr.submit)
+
def test_subcontracting_gle_fg_item_rate_zero(self):
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import get_gl_entries
diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json b/erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json
index 100a8060e8..ddbb80661a 100644
--- a/erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json
+++ b/erpnext/subcontracting/doctype/subcontracting_receipt_supplied_item/subcontracting_receipt_supplied_item.json
@@ -19,6 +19,7 @@
"col_break2",
"amount",
"secbreak_2",
+ "available_qty_for_consumption",
"required_qty",
"col_break3",
"consumed_qty",
@@ -75,8 +76,7 @@
{
"fieldname": "required_qty",
"fieldtype": "Float",
- "in_list_view": 1,
- "label": "Available Qty For Consumption",
+ "label": "Required Qty",
"print_hide": 1,
"read_only": 1
},
@@ -85,7 +85,7 @@
"fieldname": "consumed_qty",
"fieldtype": "Float",
"in_list_view": 1,
- "label": "Qty to be Consumed",
+ "label": "Consumed Qty",
"reqd": 1
},
{
@@ -179,12 +179,21 @@
"options": "Subcontracting Order",
"print_hide": 1,
"read_only": 1
+ },
+ {
+ "default": "0",
+ "fieldname": "available_qty_for_consumption",
+ "fieldtype": "Float",
+ "in_list_view": 1,
+ "label": "Available Qty For Consumption",
+ "print_hide": 1,
+ "read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
- "modified": "2022-04-18 10:45:16.538479",
+ "modified": "2022-09-02 22:28:53.392381",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt Supplied Item",
@@ -193,6 +202,6 @@
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
- "track_changes": 1,
- "states": []
+ "states": [],
+ "track_changes": 1
}
\ No newline at end of file
diff --git a/erpnext/templates/pages/product_search.py b/erpnext/templates/pages/product_search.py
index 0768cc3fa6..f40fd479f4 100644
--- a/erpnext/templates/pages/product_search.py
+++ b/erpnext/templates/pages/product_search.py
@@ -5,14 +5,13 @@ import json
import frappe
from frappe.utils import cint, cstr
-from redisearch import AutoCompleter, Client, Query
+from redis.commands.search.query import Query
from erpnext.e_commerce.redisearch_utils import (
WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE,
WEBSITE_ITEM_INDEX,
WEBSITE_ITEM_NAME_AUTOCOMPLETE,
is_redisearch_enabled,
- make_key,
)
from erpnext.e_commerce.shopping_cart.product_info import set_product_info_for_website
from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html
@@ -88,15 +87,17 @@ def product_search(query, limit=10, fuzzy_search=True):
if not query:
return search_results
- red = frappe.cache()
+ redis = frappe.cache()
query = clean_up_query(query)
# TODO: Check perf/correctness with Suggestions & Query vs only Query
# TODO: Use Levenshtein Distance in Query (max=3)
- ac = AutoCompleter(make_key(WEBSITE_ITEM_NAME_AUTOCOMPLETE), conn=red)
- client = Client(make_key(WEBSITE_ITEM_INDEX), conn=red)
- suggestions = ac.get_suggestions(
- query, num=limit, fuzzy=fuzzy_search and len(query) > 3 # Fuzzy on length < 3 can be real slow
+ redisearch = redis.ft(WEBSITE_ITEM_INDEX)
+ suggestions = redisearch.sugget(
+ WEBSITE_ITEM_NAME_AUTOCOMPLETE,
+ query,
+ num=limit,
+ fuzzy=fuzzy_search and len(query) > 3,
)
# Build a query
@@ -106,8 +107,8 @@ def product_search(query, limit=10, fuzzy_search=True):
query_string += f"|('{clean_up_query(s.string)}')"
q = Query(query_string)
+ results = redisearch.search(q)
- results = client.search(q)
search_results["results"] = list(map(convert_to_dict, results.docs))
search_results["results"] = sorted(
search_results["results"], key=lambda k: frappe.utils.cint(k["ranking"]), reverse=True
@@ -141,8 +142,8 @@ def get_category_suggestions(query):
if not query:
return search_results
- ac = AutoCompleter(make_key(WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE), conn=frappe.cache())
- suggestions = ac.get_suggestions(query, num=10, with_payloads=True)
+ ac = frappe.cache().ft()
+ suggestions = ac.sugget(WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE, query, num=10, with_payloads=True)
results = [json.loads(s.payload) for s in suggestions]
diff --git a/erpnext/translations/de.csv b/erpnext/translations/de.csv
index d6bceb342d..ca16403d95 100644
--- a/erpnext/translations/de.csv
+++ b/erpnext/translations/de.csv
@@ -196,7 +196,7 @@ All other ITC,Alle anderen ITC,
All the mandatory Task for employee creation hasn't been done yet.,Alle obligatorischen Aufgaben zur Mitarbeitererstellung wurden noch nicht erledigt.,
Allocate Payment Amount,Zahlungsbetrag zuweisen,
Allocated Amount,Zugewiesene Menge,
-Allocated Leaves,Zugewiesene Blätter,
+Allocated Leaves,Zugewiesene Urlaubstage,
Allocating leaves...,Blätter zuordnen...,
Already record exists for the item {0},Es existiert bereits ein Datensatz für den Artikel {0},
"Already set default in pos profile {0} for user {1}, kindly disabled default","Im Standardprofil {0} für den Benutzer {1} ist der Standard bereits festgelegt, standardmäßig deaktiviert",
@@ -8623,8 +8623,8 @@ Material Request Warehouse,Materialanforderungslager,
Select warehouse for material requests,Wählen Sie Lager für Materialanfragen,
Transfer Materials For Warehouse {0},Material für Lager übertragen {0},
Production Plan Material Request Warehouse,Produktionsplan Materialanforderungslager,
-Sets 'Source Warehouse' in each row of the items table.,Legt 'Source Warehouse' in jeder Zeile der Artikeltabelle fest.,
-Sets 'Target Warehouse' in each row of the items table.,"Füllt das Feld ""Ziel Lager"" in allen Positionen der folgenden Tabelle.",
+Sets 'Source Warehouse' in each row of the items table.,Legt in jeder Zeile der Artikeltabelle das „Ausgangslager“ fest.,
+Sets 'Target Warehouse' in each row of the items table.,Legt in jeder Zeile der Artikeltabelle das „Eingangslager“ fest.,
Show Cancelled Entries,Abgebrochene Einträge anzeigen,
Backdated Stock Entry,Backdated Stock Entry,
Row #{}: Currency of {} - {} doesn't matches company currency.,Zeile # {}: Die Währung von {} - {} stimmt nicht mit der Firmenwährung überein.,
@@ -9871,3 +9871,31 @@ Leave Type Allocation,Zuordnung Abwesenheitsarten,
From Lead,Aus Lead,
From Opportunity,Aus Chance,
Publish in Website,Auf Webseite veröffentlichen,
+Total Allocated Leave(s),Gesamte zugewiesene Urlaubstage,
+Expired Leave(s),Verfallene Urlaubstage,
+Used Leave(s),Verbrauchte Urlaubstage,
+Leave(s) Pending Approval,Urlaubstage zur Genehmigung ausstehend,
+Available Leave(s),Verfügbare Urlaubstage,
+Party Specific Item,Parteispezifischer Artikel,
+Active Customers,Aktive Kunden,
+Annual Sales,Jährlicher Umsatz,
+Total Outgoing Bills,Ausgangsrechnungen insgesamt,
+Total Incoming Bills,Eingangsrechnungen insgesamt,
+Total Incoming Payment,Zahlungseingang insgesamt,
+Total Outgoing Payment,Zahlungsausgang insgesamt,
+Incoming Bills (Purchase Invoice),Eingehende Rechnungen (Eingangsrechnung),
+Outgoing Bills (Sales Invoice),Ausgehende Rechnungen (Ausgangsrechnung),
+Accounts Receivable Ageing,Fälligkeit Forderungen,
+Accounts Payable Ageing,Fälligkeit Verbindlichkeiten,
+Budget Variance,Budgetabweichung,
+Based On Value,Basierend auf Wert,
+Restrict Items Based On,Artikel einschränken auf Basis von,
+Earnings & Deductions,Erträge & Abzüge,
+Is Process Loss,Ist Prozessverlust,
+Is Finished Item,Ist fertiger Artikel,
+Is Scrap Item,Ist Schrott,
+Issue a debit note with 0 qty against an existing Sales Invoice,Lastschrift mit Menge 0 gegen eine bestehende Ausgangsrechnung ausstellen,
+Show Remarks,Bemerkungen anzeigen,
+Website Item,Webseiten-Artikel,
+Update Property,Eigenschaft aktualisieren,
+Recurring Sales Invoice,Wiederkehrende Ausgangsrechnung,
diff --git a/erpnext/translations/fr.csv b/erpnext/translations/fr.csv
index dbc319476b..b2074618a6 100644
--- a/erpnext/translations/fr.csv
+++ b/erpnext/translations/fr.csv
@@ -329,11 +329,11 @@ Average Rate,Prix moyen,
Avg Daily Outgoing,Moy Quotidienne Sortante,
Avg. Buying Price List Rate,Moyenne de la liste de prix d'achat,
Avg. Selling Price List Rate,Prix moyen de la liste de prix de vente,
-Avg. Selling Rate,Moy. Taux de vente,
+Avg. Selling Rate,Moy. prix de vente,
BOM,Nomenclature,
BOM Browser,Explorateur Nomenclature,
BOM No,N° Nomenclature,
-BOM Rate,Valeur nomenclature,
+BOM Rate,Cout nomenclature,
BOM Stock Report,Rapport de Stock des nomenclatures,
BOM and Manufacturing Quantity are required,Nomenclature et quantité de production sont nécessaires,
BOM does not contain any stock item,Nomenclature ne contient aucun article en stock,
@@ -561,9 +561,9 @@ Colour,Couleur,
Combined invoice portion must equal 100%,La portion combinée de la facture doit être égale à 100%,
Commercial,Commercial,
Commission,Commission,
-Commission Rate %,Taux de commission%,
+Commission Rate %,Pourcentage de commission,
Commission on Sales,Commission sur les ventes,
-Commission rate cannot be greater than 100,Taux de commission ne peut pas être supérieure à 100,
+Commission rate cannot be greater than 100,Pourcentage de commission ne peut pas être supérieure à 100,
Community Forum,Forum de la communauté,
Company (not Customer or Supplier) master.,Données de base de la Société (ni les Clients ni les Fournisseurs),
Company Abbreviation,Abréviation de la Société,
@@ -658,7 +658,7 @@ Create Invoice,Créer une facture,
Create Invoices,Créer des factures,
Create Job Card,Créer une carte de travail,
Create Journal Entry,Créer une entrée de journal,
-Create Lead,Créer une piste,
+Create Lead,Créer un Prospect,
Create Leads,Créer des Prospects,
Create Maintenance Visit,Créer une visite de maintenance,
Create Material Request,Créer une demande de matériel,
@@ -1072,7 +1072,7 @@ For Warehouse is required before Submit,Pour l’Entrepôt est requis avant de V
"For an item {0}, quantity must be negative number","Pour l'article {0}, la quantité doit être un nombre négatif",
"For an item {0}, quantity must be positive number","Pour un article {0}, la quantité doit être un nombre positif",
"For job card {0}, you can only make the 'Material Transfer for Manufacture' type stock entry","Pour la carte de travail {0}, vous pouvez uniquement saisir une entrée de stock de type "Transfert d'article pour fabrication".",
-"For row {0} in {1}. To include {2} in Item rate, rows {3} must also be included","Pour la ligne {0} dans {1}. Pour inclure {2} dans le prix de l'Article, les lignes {3} doivent également être incluses",
+"For row {0} in {1}. To include {2} in Item rate, rows {3} must also be included","Pour la ligne {0} dans {1}. Pour inclure {2} dans le prix de l'article, les lignes {3} doivent également être incluses",
For row {0}: Enter Planned Qty,Pour la ligne {0}: entrez la quantité planifiée,
"For {0}, only credit accounts can be linked against another debit entry","Pour {0}, seuls les comptes de crédit peuvent être liés avec une autre écriture de débit",
"For {0}, only debit accounts can be linked against another credit entry","Pour {0}, seuls les comptes de débit peuvent être liés avec une autre écriture de crédit",
@@ -1235,7 +1235,7 @@ ITC Reversed,CTI inversé,
Identifying Decision Makers,Identifier les décideurs,
"If Auto Opt In is checked, then the customers will be automatically linked with the concerned Loyalty Program (on save)","Si l'option adhésion automatique est cochée, les clients seront automatiquement liés au programme de fidélité concerné (après l'enregistrement)",
"If multiple Pricing Rules continue to prevail, users are asked to set Priority manually to resolve conflict.","Si plusieurs Règles de Prix continuent de prévaloir, les utilisateurs sont invités à définir manuellement la priorité pour résoudre les conflits.",
-"If selected Pricing Rule is made for 'Rate', it will overwrite Price List. Pricing Rule rate is the final rate, so no further discount should be applied. Hence, in transactions like Sales Order, Purchase Order etc, it will be fetched in 'Rate' field, rather than 'Price List Rate' field.","Si la règle de tarification sélectionnée est définie pour le «Prix Unitaire», elle écrase la liste de prix. Le prix unitaire de la règle de tarification est le prix unitaire final, donc aucune autre réduction supplémentaire ne doit être appliquée. Par conséquent, dans les transactions telles que la commande client, la commande d'achat, etc., elle sera récupérée dans le champ ""Prix Unitaire"", plutôt que dans le champ ""Tarif de la liste de prix"".",
+"If selected Pricing Rule is made for 'Rate', it will overwrite Price List. Pricing Rule rate is the final rate, so no further discount should be applied. Hence, in transactions like Sales Order, Purchase Order etc, it will be fetched in 'Rate' field, rather than 'Price List Rate' field.","Si la règle de tarification sélectionnée est définie pour le 'Prix Unitaire', elle écrase la liste de prix. Le prix unitaire de la règle de tarification est le prix unitaire final, donc aucune autre réduction supplémentaire ne doit être appliquée. Par conséquent, dans les transactions telles que la commande client, la commande d'achat, etc., elle sera récupérée dans le champ 'Prix Unitaire', plutôt que dans le champ 'Tarif de la liste de prix'.",
"If two or more Pricing Rules are found based on the above conditions, Priority is applied. Priority is a number between 0 to 20 while default value is zero (blank). Higher number means it will take precedence if there are multiple Pricing Rules with same conditions.","Si deux Règles de Prix ou plus sont trouvées sur la base des conditions ci-dessus, une Priorité est appliquée. La Priorité est un nombre compris entre 0 et 20 avec une valeur par défaut de zéro (vide). Les nombres les plus élévés sont prioritaires s'il y a plusieurs Règles de Prix avec mêmes conditions.",
"If unlimited expiry for the Loyalty Points, keep the Expiry Duration empty or 0.","Si vous souhaitez ne pas mettre de date d'expiration pour les points de fidélité, laissez la durée d'expiration vide ou mettez 0.",
"If you have any questions, please get back to us.","Si vous avez des questions, veuillez revenir vers nous.",
@@ -1269,7 +1269,7 @@ Income,Revenus,
Income Account,Compte de Produits,
Income Tax,Impôt sur le revenu,
Incoming,Entrant,
-Incoming Rate,Taux d'Entrée,
+Incoming Rate,Prix d'Entrée,
Incorrect number of General Ledger Entries found. You might have selected a wrong Account in the transaction.,Nombre incorrect d'Écritures Grand Livre trouvées. Vous avez peut-être choisi le mauvais Compte dans la transaction.,
Increment cannot be 0,Incrément ne peut pas être 0,
Increment for Attribute {0} cannot be 0,Incrément pour l'Attribut {0} ne peut pas être 0,
@@ -1365,7 +1365,7 @@ Item Variants,Variantes de l'Article,
Item Variants updated,Variantes d'article mises à jour,
Item has variants.,L'article a des variantes.,
Item must be added using 'Get Items from Purchase Receipts' button,L'article doit être ajouté à l'aide du bouton 'Obtenir des éléments de Reçus d'Achat',
-Item valuation rate is recalculated considering landed cost voucher amount,Le taux d'évaluation de l'article est recalculé compte tenu du montant du bon de prix au débarquement,
+Item valuation rate is recalculated considering landed cost voucher amount,Le taux de valorisation de l'article est recalculé compte tenu du montant du bon de prix au débarquement,
Item variant {0} exists with same attributes,La variante de l'article {0} existe avec les mêmes caractéristiques,
Item {0} does not exist,Article {0} n'existe pas,
Item {0} does not exist in the system or has expired,L'article {0} n'existe pas dans le système ou a expiré,
@@ -2147,7 +2147,7 @@ Previous Financial Year is not closed,L’Exercice Financier Précédent n’est
Price,Prix,
Price List,Liste de prix,
Price List Currency not selected,Devise de la Liste de Prix non sélectionnée,
-Price List Rate,Taux de la Liste des Prix,
+Price List Rate,Prix de la Liste des Prix,
Price List master.,Données de Base des Listes de Prix,
Price List must be applicable for Buying or Selling,La Liste de Prix doit être applicable pour les Achats et les Ventes,
Price List {0} is disabled or does not exist,Liste des Prix {0} est désactivée ou n'existe pas,
@@ -2288,8 +2288,8 @@ Quotations: ,Devis :,
Quotes to Leads or Customers.,Devis de Prospects ou Clients.,
RFQs are not allowed for {0} due to a scorecard standing of {1},Les Appels d'Offres ne sont pas autorisés pour {0} en raison d'une note de {1} sur la fiche d'évaluation,
Range,Plage,
-Rate,Taux,
-Rate:,Taux:,
+Rate,Prix,
+Rate:,Prix:,
Rating,Évaluation,
Raw Material,Matières Premières,
Raw Materials,Matières premières,
@@ -2426,7 +2426,7 @@ Route,Route,
Row # {0}: ,Ligne # {0} :,
Row # {0}: Batch No must be same as {1} {2},Ligne # {0} : Le N° de Lot doit être le même que {1} {2},
Row # {0}: Cannot return more than {1} for Item {2},Ligne # {0} : Vous ne pouvez pas retourner plus de {1} pour l’Article {2},
-Row # {0}: Rate cannot be greater than the rate used in {1} {2},Ligne # {0}: Le Taux ne peut pas être supérieur au taux utilisé dans {1} {2},
+Row # {0}: Rate cannot be greater than the rate used in {1} {2},Ligne # {0}: Le prix ne peut pas être supérieur au prix utilisé dans {1} {2},
Row # {0}: Serial No is mandatory,Ligne # {0} : N° de série est obligatoire,
Row # {0}: Serial No {1} does not match with {2} {3},Ligne # {0} : N° de série {1} ne correspond pas à {2} {3},
Row #{0} (Payment Table): Amount must be negative,Row # {0} (Table de paiement): le montant doit être négatif,
@@ -2434,7 +2434,7 @@ Row #{0} (Payment Table): Amount must be positive,Ligne #{0} (Table de paiement)
Row #{0}: Account {1} does not belong to company {2},Ligne # {0}: le compte {1} n'appartient pas à la société {2},
Row #{0}: Allocated Amount cannot be greater than outstanding amount.,Ligne # {0}: montant attribué ne peut pas être supérieur au montant en souffrance.,
"Row #{0}: Asset {1} cannot be submitted, it is already {2}","Ligne #{0} : L’Actif {1} ne peut pas être soumis, il est déjà {2}",
-Row #{0}: Cannot set Rate if amount is greater than billed amount for Item {1}.,Ligne n ° {0}: impossible de définir le tarif si le montant est supérieur au montant facturé pour l'élément {1}.,
+Row #{0}: Cannot set Rate if amount is greater than billed amount for Item {1}.,Ligne n ° {0}: impossible de définir le prix si le montant est supérieur au montant facturé pour l'élément {1}.,
Row #{0}: Clearance date {1} cannot be before Cheque Date {2},Ligne #{0} : Date de compensation {1} ne peut pas être antérieure à la Date du Chèque {2},
Row #{0}: Duplicate entry in References {1} {2},Ligne # {0}: entrée en double dans les références {1} {2},
Row #{0}: Expected Delivery Date cannot be before Purchase Order Date,Ligne {0}: la date de livraison prévue ne peut pas être avant la date de commande,
@@ -2898,7 +2898,7 @@ Sync has been temporarily disabled because maximum retries have been exceeded,La
Syntax error in condition: {0},Erreur de syntaxe dans la condition: {0},
Syntax error in formula or condition: {0},Erreur de syntaxe dans la formule ou condition : {0},
System Manager,Responsable Système,
-TDS Rate %,Taux de TDS%,
+TDS Rate %,Pourcentage de TDS,
Tap items to add them here,Choisissez des articles pour les ajouter ici,
Target,Cible,
Target ({}),Cible ({}),
@@ -3190,7 +3190,7 @@ Update Print Format,Mettre à Jour le Format d'Impression,
Update Response,Mettre à jour la réponse,
Update bank payment dates with journals.,Mettre à jour les dates de paiement bancaires avec les journaux.,
Update in progress. It might take a while.,Mise à jour en cours. Ça peut prendre un moment.,
-Update rate as per last purchase,Taux de mise à jour selon le dernier achat,
+Update rate as per last purchase,Mettre à jour les prix selon le dernier prix achat,
Update stock must be enable for the purchase invoice {0},La mise à jour du stock doit être activée pour la facture d'achat {0},
Updating Variants...,Mise à jour des variantes ...,
Upload your letter head and logo. (you can edit them later).,Charger votre en-tête et logo. (vous pouvez les modifier ultérieurement).,
@@ -3326,7 +3326,6 @@ You are not authorized to add or update entries before {0},Vous n'êtes pas auto
You are not authorized to approve leaves on Block Dates,Vous n'êtes pas autorisé à approuver les congés sur les Dates Bloquées,
You are not authorized to set Frozen value,Vous n'êtes pas autorisé à définir des valeurs gelées,
You are not present all day(s) between compensatory leave request days,Vous n'êtes pas présent(e) tous les jours vos demandes de congé compensatoire,
-You can not change rate if BOM mentioned agianst any item,Vous ne pouvez pas modifier le taux si la nomenclature est mentionnée pour un article,
You can not enter current voucher in 'Against Journal Entry' column,Vous ne pouvez pas entrer le bon actuel dans la colonne 'Pour l'Écriture de Journal',
You can only have Plans with the same billing cycle in a Subscription,Vous ne pouvez avoir que des plans ayant le même cycle de facturation dans le même abonnement,
You can only redeem max {0} points in this order.,Vous pouvez uniquement échanger un maximum de {0} points dans cet commande.,
@@ -3882,7 +3881,7 @@ Only expired allocation can be cancelled,Seule l'allocation expirée peut être
Only users with the {0} role can create backdated leave applications,Seuls les utilisateurs avec le rôle {0} peuvent créer des demandes de congé antidatées,
Open,Ouvert,
Open Contact,Contact ouvert,
-Open Lead,Ouvrir le fil,
+Open Lead,Ouvrir le Prospect,
Opening and Closing,Ouverture et fermeture,
Operating Cost as per Work Order / BOM,Coût d'exploitation selon l'ordre de fabrication / nomenclature,
Order Amount,Montant de la commande,
@@ -3971,7 +3970,7 @@ Queued,File d'Attente,
Quick Entry,Écriture Rapide,
Quiz {0} does not exist,Le questionnaire {0} n'existe pas,
Quotation Amount,Montant du devis,
-Rate or Discount is required for the price discount.,Le taux ou la remise est requis pour la remise de prix.,
+Rate or Discount is required for the price discount.,Le prix ou la remise est requis pour la remise.,
Reason,Raison,
Reconcile Entries,Réconcilier les entrées,
Reconcile this account,Réconcilier ce compte,
@@ -4348,7 +4347,7 @@ Valid Upto date cannot be before Valid From date,La date de validité valide ne
Valid From date not in Fiscal Year {0},Date de début de validité non comprise dans l'exercice {0},
Valid Upto date not in Fiscal Year {0},Valable jusqu'à la date hors exercice {0},
Group Roll No,Groupe Roll Non,
-Maintain Same Rate Throughout Sales Cycle,Maintenir le Même Taux Durant le Cycle de Vente,
+Maintain Same Rate Throughout Sales Cycle,Maintenir le même prix Durant le Cycle de Vente,
"Row {1}: Quantity ({0}) cannot be a fraction. To allow this, disable '{2}' in UOM {3}.","Ligne {1}: la quantité ({0}) ne peut pas être une fraction. Pour autoriser cela, désactivez «{2}» dans UdM {3}.",
Must be Whole Number,Doit être un Nombre Entier,
Please setup Razorpay Plan ID,Veuillez configurer l'ID du plan Razorpay,
@@ -4961,7 +4960,7 @@ Threshold for Suggestion,Seuil de suggestion,
System will notify to increase or decrease quantity or amount ,Le système notifiera d'augmenter ou de diminuer la quantité ou le montant,
"Higher the number, higher the priority","Plus le nombre est grand, plus la priorité est haute",
Apply Multiple Pricing Rules,Appliquer plusieurs règles de tarification,
-Apply Discount on Rate,Appliquer une réduction sur le taux,
+Apply Discount on Rate,Appliquer une réduction sur le prix,
Validate Applied Rule,Valider la règle appliquée,
Rule Description,Description de la règle,
Pricing Rule Help,Aide pour les Règles de Tarification,
@@ -5050,19 +5049,18 @@ End date of current invoice's period,Date de fin de la période de facturation e
Update Auto Repeat Reference,Mettre à jour la référence de répétition automatique,
Purchase Invoice Advance,Avance sur Facture d’Achat,
Purchase Invoice Item,Article de la Facture d'Achat,
-Quantity and Rate,Quantité et Taux,
+Quantity and Rate,Quantité et Prix,
Received Qty,Qté Reçue,
Accepted Qty,Quantité acceptée,
Rejected Qty,Qté Rejetée,
UOM Conversion Factor,Facteur de Conversion de l'UDM,
Discount on Price List Rate (%),Remise sur la Liste des Prix (%),
Price List Rate (Company Currency),Taux de la Liste de Prix (Devise Société),
-Rate ,Taux,
Rate (Company Currency),Prix (Devise Société),
Amount (Company Currency),Montant (Devise de la Société),
Is Free Item,Est un article gratuit,
-Net Rate,Taux Net,
-Net Rate (Company Currency),Taux Net (Devise Société),
+Net Rate,Prix Net,
+Net Rate (Company Currency),Prix Net (Devise Société),
Net Amount (Company Currency),Montant Net (Devise Société),
Item Tax Amount Included in Value,Montant de la taxe incluse dans la valeur,
Landed Cost Voucher Amount,Montant de la Référence de Coût au Débarquement,
@@ -5080,7 +5078,7 @@ Enable Deferred Expense,Activer les frais reportés,
Service Start Date,Date de début du service,
Service End Date,Date de fin du service,
Allow Zero Valuation Rate,Autoriser un Taux de Valorisation Égal à Zéro,
-Item Tax Rate,Taux de la Taxe sur l'Article,
+Item Tax Rate,Prix de la Taxe sur l'Article,
Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges,La table de détails de taxe est récupérée depuis les données de base de l'article comme une chaîne de caractères et stockée dans ce champ. Elle est utilisée pour les Taxes et Frais.,
Purchase Order Item,Article de la Commande d'Achat,
Purchase Receipt Detail,Détail du reçu d'achat,
@@ -5098,8 +5096,8 @@ On Previous Row Amount,Le Montant de la Rangée Précédente,
On Previous Row Total,Le Total de la Rangée Précédente,
On Item Quantity,Sur quantité d'article,
Reference Row #,Ligne de Référence #,
-Is this Tax included in Basic Rate?,Cette Taxe est-elle incluse dans le Taux de Base ?,
-"If checked, the tax amount will be considered as already included in the Print Rate / Print Amount","Si cochée, le montant de la taxe sera considéré comme déjà inclus dans le Taux d'Impression / Prix d'Impression",
+Is this Tax included in Basic Rate?,Cette Taxe est-elle incluse dans le Prix de Base ?,
+"If checked, the tax amount will be considered as already included in the Print Rate / Print Amount","Si cochée, le montant de la taxe sera considéré comme déjà inclus dans le Taux / Prix des documents (PDF, impressions)",
Account Head,Compte Principal,
Tax Amount After Discount Amount,Montant de la Taxe après Remise,
Item Wise Tax Detail ,Détail de la taxe de l'article Wise,
@@ -5147,7 +5145,7 @@ Accounting Details,Détails Comptabilité,
Debit To,Débit Pour,
Is Opening Entry,Est Écriture Ouverte,
C-Form Applicable,Formulaire-C Applicable,
-Commission Rate (%),Taux de Commission (%),
+Commission Rate (%),Pourcentage de Commission,
Sales Team1,Équipe des Ventes 1,
Against Income Account,Pour le Compte de Produits,
Sales Invoice Advance,Avance sur Facture de Vente,
@@ -5157,9 +5155,9 @@ Customer's Item Code,Code de l'Article du Client,
Brand Name,Nom de la Marque,
Qty as per Stock UOM,Qté par UDM du Stock,
Discount and Margin,Remise et Marge,
-Rate With Margin,Tarif Avec Marge,
-Discount (%) on Price List Rate with Margin,Remise (%) sur le Tarif de la Liste de Prix avec la Marge,
-Rate With Margin (Company Currency),Taux avec marge (devise de l'entreprise),
+Rate With Margin,Prix Avec Marge,
+Discount (%) on Price List Rate with Margin,Remise (%) sur le prix de la Liste de Prix avec la Marge,
+Rate With Margin (Company Currency),Prix avec marge (devise de l'entreprise),
Delivered By Supplier,Livré par le Fournisseur,
Deferred Revenue,Produits comptabilisés d'avance,
Deferred Revenue Account,Compte de produits comptabilisés d'avance,
@@ -5721,7 +5719,7 @@ Contact Mobile No,N° de Portable du Contact,
Enter name of campaign if source of enquiry is campaign,Entrez le nom de la campagne si la source de l'enquête est une campagne,
Opportunity Date,Date d'Opportunité,
Opportunity Item,Article de l'Opportunité,
-Basic Rate,Taux de Base,
+Basic Rate,Prix de Base,
Stage Name,Nom de scène,
Social Media Post,Publication sur les réseaux sociaux,
Post Status,Statut du message,
@@ -7218,8 +7216,8 @@ Qty Consumed Per Unit,Qté Consommée Par Unité,
Include Item In Manufacturing,Inclure l'article dans la fabrication,
BOM Item,Article de la nomenclature,
Item operation,Opération de l'article,
-Rate & Amount,Taux et Montant,
-Basic Rate (Company Currency),Taux de Base (Devise de la Société ),
+Rate & Amount,Prix et Montant,
+Basic Rate (Company Currency),Prix de Base (Devise de la Société ),
Scrap %,% de Rebut,
Original Item,Article original,
BOM Operation,Opération de la nomenclature (gamme),
@@ -7464,8 +7462,8 @@ Website Attribute,Attribut de site Web,
Attribute,Attribut,
Website Filter Field,Champ de filtrage de site Web,
Activity Cost,Coût de l'Activité,
-Billing Rate,Taux de Facturation,
-Costing Rate,Taux des Coûts,
+Billing Rate,Prix de Facturation,
+Costing Rate,Tarifs des Coûts,
title,Titre,
Projects User,Utilisateur/Intervenant Projets,
Default Costing Rate,Coût de Revient par Défaut,
@@ -7963,7 +7961,7 @@ Reserved Quantity,Quantité Réservée,
Actual Quantity,Quantité Réelle,
Requested Quantity,Quantité Demandée,
Reserved Qty for sub contract,Qté réservée pour le sous-contrat,
-Moving Average Rate,Taux Mobile Moyen,
+Moving Average Rate,Prix moyen pondéré,
FCFS Rate,Montant PAPS,
Customs Tariff Number,Tarifs Personnalisés,
Tariff Number,Tarif,
@@ -8311,7 +8309,7 @@ Total Additional Costs,Total des Coûts Additionnels,
Customer or Supplier Details,Détails du Client ou du Fournisseur,
Per Transferred,Par transféré,
Stock Entry Detail,Détails de l'Écriture de Stock,
-Basic Rate (as per Stock UOM),Taux de base (comme l’UDM du Stock),
+Basic Rate (as per Stock UOM),Prix de base (comme l’UDM du Stock),
Basic Amount,Montant de Base,
Additional Cost,Frais Supplémentaire,
Serial No / Batch,N° de Série / Lot,
@@ -8323,7 +8321,7 @@ Stock Entry Child,Entrée de stock enfant,
PO Supplied Item,PO article fourni,
Reference Purchase Receipt,Reçu d'achat de référence,
Stock Ledger Entry,Écriture du Livre d'Inventaire,
-Outgoing Rate,Taux Sortant,
+Outgoing Rate,Prix Sortant,
Actual Qty After Transaction,Qté Réelle Après Transaction,
Stock Value Difference,Différence de Valeur du Sock,
Stock Queue (FIFO),File d'Attente du Stock (FIFO),
@@ -8509,7 +8507,7 @@ Item Price Stock,Stock et prix de l'article,
Item Prices,Prix des Articles,
Item Shortage Report,Rapport de Rupture de Stock d'Article,
Item Variant Details,Détails de la variante de l'article,
-Item-wise Price List Rate,Taux de la Liste des Prix par Article,
+Item-wise Price List Rate,Prix de la Liste des Prix par Article,
Item-wise Purchase History,Historique d'Achats par Article,
Item-wise Purchase Register,Registre des Achats par Article,
Item-wise Sales History,Historique des Ventes par Article,
@@ -8561,7 +8559,7 @@ Sales Partner Target Variance based on Item Group,Variance cible du partenaire c
Sales Partner Transaction Summary,Récapitulatif des transactions du partenaire commercial,
Sales Partners Commission,Commission des Partenaires de Vente,
Invoiced Amount (Exclusive Tax),Montant facturé (taxe exclusive),
-Average Commission Rate,Taux Moyen de la Commission,
+Average Commission Rate,Coût Moyen de la Commission,
Sales Payment Summary,Résumé du paiement des ventes,
Sales Person Commission Summary,Récapitulatif de la commission des ventes,
Sales Person Target Variance Based On Item Group,Écart cible du commercial basé sur le groupe de postes,
@@ -8815,7 +8813,7 @@ Generate New Invoices Past Due Date,Générer de nouvelles factures en retard,
New invoices will be generated as per schedule even if current invoices are unpaid or past due date,"De nouvelles factures seront générées selon le calendrier, même si les factures actuelles sont impayées ou en retard",
Document Type ,Type de document,
Subscription Price Based On,Prix d'abonnement basé sur,
-Fixed Rate,Taux fixe,
+Fixed Rate,Tarif fixe,
Based On Price List,Basé sur la liste de prix,
Monthly Rate,Tarif mensuel,
Cancel Subscription After Grace Period,Annuler l'abonnement après la période de grâce,
@@ -8886,10 +8884,6 @@ Practitioner Name,Nom du praticien,
Enter a name for the Clinical Procedure Template,Entrez un nom pour le modèle de procédure clinique,
Set the Item Code which will be used for billing the Clinical Procedure.,Définissez le code article qui sera utilisé pour facturer la procédure clinique.,
Select an Item Group for the Clinical Procedure Item.,Sélectionnez un groupe d'articles pour l'article de procédure clinique.,
-Clinical Procedure Rate,Taux de procédure clinique,
-Check this if the Clinical Procedure is billable and also set the rate.,Cochez cette case si la procédure clinique est facturable et définissez également le tarif.,
-Check this if the Clinical Procedure utilises consumables. Click ,Vérifiez ceci si la procédure clinique utilise des consommables. Cliquez sur,
- to know more,en savoir plus,
"You can also set the Medical Department for the template. After saving the document, an Item will automatically be created for billing this Clinical Procedure. You can then use this template while creating Clinical Procedures for Patients. Templates save you from filling up redundant data every single time. You can also create templates for other operations like Lab Tests, Therapy Sessions, etc.","Vous pouvez également définir le service médical du modèle. Après avoir enregistré le document, un élément sera automatiquement créé pour facturer cette procédure clinique. Vous pouvez ensuite utiliser ce modèle lors de la création de procédures cliniques pour les patients. Les modèles vous évitent de remplir des données redondantes à chaque fois. Vous pouvez également créer des modèles pour d'autres opérations telles que des tests de laboratoire, des séances de thérapie, etc.",
Descriptive Test Result,Résultat du test descriptif,
Allow Blank,Autoriser le blanc,
@@ -9033,7 +9027,7 @@ Work In Progress Warehouse,Entrepôt de travaux en cours,
This Warehouse will be auto-updated in the Work In Progress Warehouse field of Work Orders.,Cet entrepôt sera mis à jour automatiquement dans le champ Entrepôt de travaux en cours des bons de travail.,
Finished Goods Warehouse,Entrepôt de produits finis,
This Warehouse will be auto-updated in the Target Warehouse field of Work Order.,Cet entrepôt sera mis à jour automatiquement dans le champ Entrepôt cible de l'ordre de fabrication.
-"If ticked, the BOM cost will be automatically updated based on Valuation Rate / Price List Rate / last purchase rate of raw materials.","Si coché, le coût de la nomenclature sera automatiquement mis à jour en fonction du taux de valorisation / tarif tarifaire / dernier taux d'achat des matières premières.",
+"If ticked, the BOM cost will be automatically updated based on Valuation Rate / Price List Rate / last purchase rate of raw materials.","Si coché, le coût de la nomenclature sera automatiquement mis à jour en fonction du taux de valorisation / prix de la liste prix / dernier prix d'achat des matières premières.",
Source Warehouses (Optional),Entrepôts d'origine (facultatif),
"System will pickup the materials from the selected warehouses. If not specified, system will create material request for purchase.","Le système ramassera les matériaux dans les entrepôts sélectionnés. S'il n'est pas spécifié, le système créera une demande de matériel pour l'achat.",
Lead Time,Délai de mise en œuvre,
@@ -9107,7 +9101,7 @@ MAT-PR-RET-.YYYY.-,MAT-PR-RET-.YYYY.-,
Track this Purchase Receipt against any Project,Suivre ce reçu d'achat par rapport à n'importe quel projet,
Please Select a Supplier,Veuillez sélectionner un fournisseur,
Add to Transit,Ajouter à Transit,
-Set Basic Rate Manually,Définir manuellement le taux de base,
+Set Basic Rate Manually,Définir manuellement le prix de base,
"By default, the Item Name is set as per the Item Code entered. If you want Items to be named by a ","Par défaut, le nom de l'article est défini selon le code d'article entré. Si vous souhaitez que les éléments soient nommés par un",
Set a Default Warehouse for Inventory Transactions. This will be fetched into the Default Warehouse in the Item master.,Définissez un entrepôt par défaut pour les mouvements de stock. Ce sera récupéré dans l'entrepôt par défaut dans la base d'articles.,
"This will allow stock items to be displayed in negative values. Using this option depends on your use case. With this option unchecked, the system warns before obstructing a transaction that is causing negative stock.","Cela permettra aux articles en stock d'être affichés avec des valeurs négatives. L'utilisation de cette option dépend de votre cas d'utilisation. Lorsque cette option n'est pas cochée, le système avertit avant d'entraver une transaction entraînant un stock négatif.",
@@ -9495,7 +9489,7 @@ Normal Range: ,Plage normale:,
Row #{0}: Check Out datetime cannot be less than Check In datetime,Ligne n ° {0}: la date de sortie ne peut pas être inférieure à la date de sortie,
"Missing required details, did not create Inpatient Record","Détails requis manquants, n'a pas créé de dossier d'hospitalisation",
Unbilled Invoices,Factures non facturées,
-Standard Selling Rate should be greater than zero.,Le taux de vente standard doit être supérieur à zéro.,
+Standard Selling Rate should be greater than zero.,Le prix de vente standard doit être supérieur à zéro.,
Conversion Factor is mandatory,Le facteur de conversion est obligatoire,
Row #{0}: Conversion Factor is mandatory,Ligne n ° {0}: le facteur de conversion est obligatoire,
Sample Quantity cannot be negative or 0,La quantité d'échantillon ne peut pas être négative ou 0,
@@ -9559,7 +9553,7 @@ The Request for Quotation can be accessed by clicking on the following button,La
Regards,Cordialement,
Please click on the following button to set your new password,Veuillez cliquer sur le bouton suivant pour définir votre nouveau mot de passe,
Update Password,Mettre à jour le mot de passe,
-Row #{}: Selling rate for item {} is lower than its {}. Selling {} should be atleast {},Ligne n ° {}: le taux de vente de l'article {} est inférieur à son {}. La vente {} doit être au moins {},
+Row #{}: Selling rate for item {} is lower than its {}. Selling {} should be atleast {},Ligne n ° {}: le prix de vente de l'article {} est inférieur à son {}. La vente {} doit être au moins {},
You can alternatively disable selling price validation in {} to bypass this validation.,Vous pouvez également désactiver la validation du prix de vente dans {} pour contourner cette validation.,
Invalid Selling Price,Prix de vente invalide,
Address needs to be linked to a Company. Please add a row for Company in the Links table.,L'adresse doit être liée à une entreprise. Veuillez ajouter une ligne pour Entreprise dans le tableau Liens.,
@@ -9581,7 +9575,7 @@ Only select this if you have set up the Cash Flow Mapper documents,Sélectionnez
Payment Channel,Canal de paiement,
Is Purchase Order Required for Purchase Invoice & Receipt Creation?,Une Commande d'Achat est-il requis pour la création de factures d'achat et de reçus?,
Is Purchase Receipt Required for Purchase Invoice Creation?,Un reçu d'achat est-il requis pour la création d'une facture d'achat?,
-Maintain Same Rate Throughout the Purchase Cycle,Maintenir le même taux tout au long du cycle d'achat,
+Maintain Same Rate Throughout the Purchase Cycle,Maintenir les même prix tout au long du cycle d'achat,
Allow Item To Be Added Multiple Times in a Transaction,Autoriser l'ajout d'un article plusieurs fois dans une transaction,
Suppliers,Fournisseurs,
Send Emails to Suppliers,Envoyer des e-mails aux fournisseurs,
@@ -9633,7 +9627,7 @@ Plan operations X days in advance,Planifier les opérations X jours à l'avance,
Time Between Operations (Mins),Temps entre les opérations (minutes),
Default: 10 mins,Par défaut: 10 minutes,
Overproduction for Sales and Work Order,Surproduction pour les ventes et les bons de travail,
-"Update BOM cost automatically via scheduler, based on the latest Valuation Rate/Price List Rate/Last Purchase Rate of raw materials","Mettre à jour automatiquement le coût de la nomenclature via le planificateur, en fonction du dernier taux de valorisation / tarif tarifaire / dernier taux d'achat de matières premières",
+"Update BOM cost automatically via scheduler, based on the latest Valuation Rate/Price List Rate/Last Purchase Rate of raw materials","Mettre à jour automatiquement le coût de la nomenclature via le planificateur, en fonction du dernier taux de valorisation / prix de la liste de prix / dernier prix d'achat de matières premières",
Purchase Order already created for all Sales Order items,Commande d'Achat déjà créé pour tous les articles de commande client,
Select Items,Sélectionner des éléments,
Against Default Supplier,Contre le fournisseur par défaut,
@@ -9641,14 +9635,14 @@ Auto close Opportunity after the no. of days mentioned above,Opportunité de fer
Is Sales Order Required for Sales Invoice & Delivery Note Creation?,Une commande client est-elle requise pour la création de factures clients et de bons de livraison?,
Is Delivery Note Required for Sales Invoice Creation?,Un bon de livraison est-il nécessaire pour la création de factures de vente?,
How often should Project and Company be updated based on Sales Transactions?,À quelle fréquence le projet et l'entreprise doivent-ils être mis à jour en fonction des transactions de vente?,
-Allow User to Edit Price List Rate in Transactions,Autoriser l'utilisateur à modifier le tarif tarifaire dans les transactions,
+Allow User to Edit Price List Rate in Transactions,Autoriser l'utilisateur à modifier le prix de la liste prix dans les transactions,
Allow Item to Be Added Multiple Times in a Transaction,Autoriser l'ajout d'un article plusieurs fois dans une transaction,
Allow Multiple Sales Orders Against a Customer's Purchase Order,Autoriser plusieurs commandes client par rapport à la commande d'achat d'un client,
-Validate Selling Price for Item Against Purchase Rate or Valuation Rate,Valider le prix de vente de l'article par rapport au taux d'achat ou au taux de valorisation,
+Validate Selling Price for Item Against Purchase Rate or Valuation Rate,Valider le prix de vente de l'article par rapport au prix d'achat ou au taux de valorisation,
Hide Customer's Tax ID from Sales Transactions,Masquer le numéro d'identification fiscale du client dans les transactions de vente,
"The percentage you are allowed to receive or deliver more against the quantity ordered. For example, if you have ordered 100 units, and your Allowance is 10%, then you are allowed to receive 110 units.","Le pourcentage que vous êtes autorisé à recevoir ou à livrer plus par rapport à la quantité commandée. Par exemple, si vous avez commandé 100 unités et que votre allocation est de 10%, vous êtes autorisé à recevoir 110 unités.",
Action If Quality Inspection Is Not Submitted,Action si l'inspection qualité n'est pas soumise,
-Auto Insert Price List Rate If Missing,Taux de liste de prix d'insertion automatique s'il est manquant,
+Auto Insert Price List Rate If Missing,Insérer automatiquement le prix dand liste de prix s'il est manquant,
Automatically Set Serial Nos Based on FIFO,Définir automatiquement les numéros de série en fonction de FIFO,
Set Qty in Transactions Based on Serial No Input,Définir la quantité dans les transactions en fonction du numéro de série,
Raise Material Request When Stock Reaches Re-order Level,Augmenter la demande d'article lorsque le stock atteint le niveau de commande,
@@ -9722,7 +9716,7 @@ No Inpatient Record found against patient {0},Aucun dossier d'hospitalisation tr
An Inpatient Medication Order {0} against Patient Encounter {1} already exists.,Une ordonnance de médicament pour patients hospitalisés {0} contre rencontre avec un patient {1} existe déjà.,
Allow In Returns,Autoriser les retours,
Hide Unavailable Items,Masquer les éléments non disponibles,
-Apply Discount on Discounted Rate,Appliquer une remise sur un tarif réduit,
+Apply Discount on Discounted Rate,Appliquer une remise sur un prix réduit,
Therapy Plan Template,Modèle de plan de thérapie,
Fetching Template Details,Récupération des détails du modèle,
Linked Item Details,Détails de l'élément lié,
@@ -9927,4 +9921,3 @@ Enable Reviews and Ratings,Activer les avis et notes
Enable Recommendations,Activer les recommendations
Item Search Settings,Paramétrage de la recherche d'article
Purchase demande,Demande de materiel
-Calendar,Calendier
diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py
index cd1bf9f321..21a0a551b6 100644
--- a/erpnext/utilities/transaction_base.py
+++ b/erpnext/utilities/transaction_base.py
@@ -71,6 +71,9 @@ class TransactionBase(StatusUpdater):
self.validate_value(field, condition, prevdoc_values[field], doc)
def validate_rate_with_reference_doc(self, ref_details):
+ if self.get("is_internal_supplier"):
+ return
+
buying_doctypes = ["Purchase Order", "Purchase Invoice", "Purchase Receipt"]
if self.doctype in buying_doctypes:
diff --git a/pyproject.toml b/pyproject.toml
index 5acfd39272..c61f1a5548 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -12,7 +12,6 @@ dependencies = [
"pycountry~=20.7.3",
"python-stdnum~=1.16",
"Unidecode~=1.2.0",
- "redisearch~=2.1.0",
# integration dependencies
"gocardless-pro~=1.22.0",
@@ -21,6 +20,9 @@ dependencies = [
"python-youtube~=0.8.0",
"taxjar~=1.9.2",
"tweepy~=3.10.0",
+
+ # Not used directly - required by PyQRCode for PNG generation
+ "pypng~=0.20220715.0",
]
[build-system]