Merge branch 'version-13-hotfix' of https://github.com/frappe/erpnext into dynamic_gst_rates
This commit is contained in:
commit
5434dd048b
12
.git-blame-ignore-revs
Normal file
12
.git-blame-ignore-revs
Normal file
@ -0,0 +1,12 @@
|
||||
# Since version 2.23 (released in August 2019), git-blame has a feature
|
||||
# to ignore or bypass certain commits.
|
||||
#
|
||||
# This file contains a list of commits that are not likely what you
|
||||
# are looking for in a blame, such as mass reformatting or renaming.
|
||||
# You can set this file as a default ignore file for blame by running
|
||||
# the following command.
|
||||
#
|
||||
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||
|
||||
# This commit just changes spaces to tabs for indentation in some files
|
||||
5f473611bd6ed57703716244a054d3fb5ba9cd23
|
6
.github/workflows/patch.yml
vendored
6
.github/workflows/patch.yml
vendored
@ -66,4 +66,8 @@ jobs:
|
||||
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
|
||||
|
||||
- name: Run Patch Tests
|
||||
run: cd ~/frappe-bench/ && wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz && bench --site test_site --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz && bench --site test_site migrate
|
||||
run: |
|
||||
cd ~/frappe-bench/
|
||||
wget https://erpnext.com/files/v10-erpnext.sql.gz
|
||||
bench --site test_site --force restore ~/frappe-bench/v10-erpnext.sql.gz
|
||||
bench --site test_site migrate
|
||||
|
@ -18,6 +18,7 @@
|
||||
"delete_linked_ledger_entries",
|
||||
"book_asset_depreciation_entry_automatically",
|
||||
"unlink_advance_payment_on_cancelation_of_order",
|
||||
"post_change_gl_entries",
|
||||
"tax_settings_section",
|
||||
"determine_address_tax_category_from",
|
||||
"column_break_19",
|
||||
@ -253,6 +254,12 @@
|
||||
{
|
||||
"fieldname": "column_break_19",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "post_change_gl_entries",
|
||||
"fieldtype": "Check",
|
||||
"label": "Post Ledger Entries for Given Change"
|
||||
}
|
||||
],
|
||||
"icon": "icon-cog",
|
||||
@ -260,7 +267,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2021-04-30 15:25:10.381008",
|
||||
"modified": "2021-05-25 12:34:05.858669",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Accounts Settings",
|
||||
|
@ -49,11 +49,11 @@ class InvoiceDiscounting(AccountsController):
|
||||
self.make_gl_entries()
|
||||
|
||||
def on_cancel(self):
|
||||
self.set_status()
|
||||
self.set_status(cancel=1)
|
||||
self.update_sales_invoice()
|
||||
self.make_gl_entries()
|
||||
|
||||
def set_status(self, status=None):
|
||||
def set_status(self, status=None, cancel=0):
|
||||
if status:
|
||||
self.status = status
|
||||
self.db_set("status", status)
|
||||
@ -66,6 +66,9 @@ class InvoiceDiscounting(AccountsController):
|
||||
elif self.docstatus == 2:
|
||||
self.status = "Cancelled"
|
||||
|
||||
if cancel:
|
||||
self.db_set('status', self.status, update_modified = True)
|
||||
|
||||
def update_sales_invoice(self):
|
||||
for d in self.invoices:
|
||||
if self.docstatus == 1:
|
||||
|
@ -65,7 +65,6 @@ class PaymentEntry(AccountsController):
|
||||
self.set_status()
|
||||
|
||||
def on_submit(self):
|
||||
self.setup_party_account_field()
|
||||
if self.difference_amount:
|
||||
frappe.throw(_("Difference Amount must be zero"))
|
||||
self.make_gl_entries()
|
||||
@ -78,7 +77,6 @@ class PaymentEntry(AccountsController):
|
||||
|
||||
def on_cancel(self):
|
||||
self.ignore_linked_doctypes = ('GL Entry', 'Stock Ledger Entry')
|
||||
self.setup_party_account_field()
|
||||
self.make_gl_entries(cancel=1)
|
||||
self.update_outstanding_amounts()
|
||||
self.update_advance_paid()
|
||||
@ -122,6 +120,11 @@ class PaymentEntry(AccountsController):
|
||||
if flt(d.allocated_amount) > flt(d.outstanding_amount):
|
||||
frappe.throw(_("Row #{0}: Allocated Amount cannot be greater than outstanding amount.").format(d.idx))
|
||||
|
||||
# Check for negative outstanding invoices as well
|
||||
if flt(d.allocated_amount) < 0:
|
||||
if flt(d.allocated_amount) < flt(d.outstanding_amount):
|
||||
frappe.throw(_("Row #{0}: Allocated Amount cannot be greater than outstanding amount.").format(d.idx))
|
||||
|
||||
def delink_advance_entry_references(self):
|
||||
for reference in self.references:
|
||||
if reference.reference_doctype in ("Sales Invoice", "Purchase Invoice"):
|
||||
@ -177,7 +180,7 @@ class PaymentEntry(AccountsController):
|
||||
|
||||
for field, value in iteritems(ref_details):
|
||||
if field == 'exchange_rate' or not d.get(field) or force:
|
||||
d.set(field, value)
|
||||
d.db_set(field, value)
|
||||
|
||||
def validate_payment_type(self):
|
||||
if self.payment_type not in ("Receive", "Pay", "Internal Transfer"):
|
||||
@ -386,6 +389,8 @@ class PaymentEntry(AccountsController):
|
||||
else:
|
||||
self.status = 'Draft'
|
||||
|
||||
self.db_set('status', self.status, update_modified = True)
|
||||
|
||||
def set_amounts(self):
|
||||
self.set_amounts_in_company_currency()
|
||||
self.set_total_allocated_amount()
|
||||
@ -791,7 +796,7 @@ def split_invoices_based_on_payment_terms(outstanding_invoices):
|
||||
|
||||
outstanding_invoices.pop(idx - 1)
|
||||
outstanding_invoices += invoice_ref_based_on_payment_terms[idx]
|
||||
|
||||
|
||||
return outstanding_invoices
|
||||
|
||||
def get_orders_to_be_billed(posting_date, party_type, party,
|
||||
@ -989,6 +994,7 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre
|
||||
outstanding_amount = ref_doc.get("outstanding_amount")
|
||||
elif reference_doctype == "Donation":
|
||||
total_amount = ref_doc.get("amount")
|
||||
outstanding_amount = total_amount
|
||||
exchange_rate = 1
|
||||
elif reference_doctype == "Dunning":
|
||||
total_amount = ref_doc.get("dunning_amount")
|
||||
|
@ -101,7 +101,7 @@ class PaymentRequest(Document):
|
||||
|
||||
controller.validate_transaction_currency(self.currency)
|
||||
controller.request_for_payment(**payment_record)
|
||||
|
||||
|
||||
def get_request_amount(self):
|
||||
data_of_completed_requests = frappe.get_all("Integration Request", filters={
|
||||
'reference_doctype': self.doctype,
|
||||
@ -492,7 +492,6 @@ def update_payment_req_status(doc, method):
|
||||
status = 'Requested'
|
||||
|
||||
pay_req_doc.db_set('status', status)
|
||||
frappe.db.commit()
|
||||
|
||||
def get_dummy_message(doc):
|
||||
return frappe.render_template("""{% if doc.contact_person -%}
|
||||
|
@ -1,350 +1,138 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "ACC-PCV-.YYYY.-.#####",
|
||||
"beta": 0,
|
||||
"creation": "2013-01-10 16:34:07",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 0,
|
||||
"engine": "InnoDB",
|
||||
"actions": [],
|
||||
"autoname": "ACC-PCV-.YYYY.-.#####",
|
||||
"creation": "2013-01-10 16:34:07",
|
||||
"doctype": "DocType",
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"transaction_date",
|
||||
"posting_date",
|
||||
"fiscal_year",
|
||||
"amended_from",
|
||||
"company",
|
||||
"cost_center_wise_pnl",
|
||||
"column_break1",
|
||||
"closing_account_head",
|
||||
"remarks"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Date",
|
||||
"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": "Transaction Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "transaction_date",
|
||||
"oldfieldtype": "Date",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Transaction Date",
|
||||
"oldfieldname": "transaction_date",
|
||||
"oldfieldtype": "Date"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"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": "Posting Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"label": "Posting Date",
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "fiscal_year",
|
||||
"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": 1,
|
||||
"label": "Closing Fiscal Year",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "fiscal_year",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Fiscal Year",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Closing Fiscal Year",
|
||||
"oldfieldname": "fiscal_year",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Fiscal Year",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Amended From",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "amended_from",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Period Closing Voucher",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "amended_from",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Period Closing Voucher",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"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": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"label": "Company",
|
||||
"oldfieldname": "company",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Company",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"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,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Column Break",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "The account head under Liability or Equity, in which Profit/Loss will be booked",
|
||||
"fieldname": "closing_account_head",
|
||||
"fieldtype": "Link",
|
||||
"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": "Closing Account Head",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "closing_account_head",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"description": "The account head under Liability or Equity, in which Profit/Loss will be booked",
|
||||
"fieldname": "closing_account_head",
|
||||
"fieldtype": "Link",
|
||||
"label": "Closing Account Head",
|
||||
"oldfieldname": "closing_account_head",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "remarks",
|
||||
"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": "Remarks",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "remarks",
|
||||
"oldfieldtype": "Small Text",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldname": "remarks",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Remarks",
|
||||
"oldfieldname": "remarks",
|
||||
"oldfieldtype": "Small Text",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "cost_center_wise_pnl",
|
||||
"fieldtype": "Check",
|
||||
"label": "Book Cost Center Wise Profit/Loss"
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2020-09-18 17:26:09.703215",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Period Closing Voucher",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"icon": "fa fa-file-text",
|
||||
"idx": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-05-20 15:27:37.210458",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Period Closing Voucher",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"search_fields": "posting_date, fiscal_year",
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "closing_account_head",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
],
|
||||
"search_fields": "posting_date, fiscal_year",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "closing_account_head"
|
||||
}
|
@ -51,63 +51,96 @@ class PeriodClosingVoucher(AccountsController):
|
||||
|
||||
def make_gl_entries(self):
|
||||
gl_entries = []
|
||||
net_pl_balance = 0
|
||||
dimension_fields = ['t1.cost_center']
|
||||
net_pl_balance = 0
|
||||
|
||||
accounting_dimensions = get_accounting_dimensions()
|
||||
for dimension in accounting_dimensions:
|
||||
dimension_fields.append('t1.{0}'.format(dimension))
|
||||
|
||||
dimension_filters, default_dimensions = get_dimensions()
|
||||
|
||||
pl_accounts = self.get_pl_balances(dimension_fields)
|
||||
pl_accounts = self.get_pl_balances()
|
||||
|
||||
for acc in pl_accounts:
|
||||
if flt(acc.balance_in_company_currency):
|
||||
if flt(acc.bal_in_company_currency):
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": acc.account,
|
||||
"cost_center": acc.cost_center,
|
||||
"account_currency": acc.account_currency,
|
||||
"debit_in_account_currency": abs(flt(acc.balance_in_account_currency)) \
|
||||
if flt(acc.balance_in_account_currency) < 0 else 0,
|
||||
"debit": abs(flt(acc.balance_in_company_currency)) \
|
||||
if flt(acc.balance_in_company_currency) < 0 else 0,
|
||||
"credit_in_account_currency": abs(flt(acc.balance_in_account_currency)) \
|
||||
if flt(acc.balance_in_account_currency) > 0 else 0,
|
||||
"credit": abs(flt(acc.balance_in_company_currency)) \
|
||||
if flt(acc.balance_in_company_currency) > 0 else 0
|
||||
"debit_in_account_currency": abs(flt(acc.bal_in_account_currency)) if flt(acc.bal_in_account_currency) < 0 else 0,
|
||||
"debit": abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) < 0 else 0,
|
||||
"credit_in_account_currency": abs(flt(acc.bal_in_account_currency)) if flt(acc.bal_in_account_currency) > 0 else 0,
|
||||
"credit": abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) > 0 else 0
|
||||
}, item=acc))
|
||||
|
||||
net_pl_balance += flt(acc.balance_in_company_currency)
|
||||
net_pl_balance += flt(acc.bal_in_company_currency)
|
||||
|
||||
if net_pl_balance:
|
||||
cost_center = frappe.db.get_value("Company", self.company, "cost_center")
|
||||
gl_entry = self.get_gl_dict({
|
||||
"account": self.closing_account_head,
|
||||
"debit_in_account_currency": abs(net_pl_balance) if net_pl_balance > 0 else 0,
|
||||
"debit": abs(net_pl_balance) if net_pl_balance > 0 else 0,
|
||||
"credit_in_account_currency": abs(net_pl_balance) if net_pl_balance < 0 else 0,
|
||||
"credit": abs(net_pl_balance) if net_pl_balance < 0 else 0,
|
||||
"cost_center": cost_center
|
||||
})
|
||||
|
||||
for dimension in accounting_dimensions:
|
||||
gl_entry.update({
|
||||
dimension: default_dimensions.get(self.company, {}).get(dimension)
|
||||
})
|
||||
|
||||
gl_entries.append(gl_entry)
|
||||
if self.cost_center_wise_pnl:
|
||||
costcenter_wise_gl_entries = self.get_costcenter_wise_pnl_gl_entries(pl_accounts)
|
||||
gl_entries += costcenter_wise_gl_entries
|
||||
else:
|
||||
gl_entry = self.get_pnl_gl_entry(net_pl_balance)
|
||||
gl_entries.append(gl_entry)
|
||||
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
make_gl_entries(gl_entries)
|
||||
|
||||
def get_pnl_gl_entry(self, net_pl_balance):
|
||||
cost_center = frappe.db.get_value("Company", self.company, "cost_center")
|
||||
gl_entry = self.get_gl_dict({
|
||||
"account": self.closing_account_head,
|
||||
"debit_in_account_currency": abs(net_pl_balance) if net_pl_balance > 0 else 0,
|
||||
"debit": abs(net_pl_balance) if net_pl_balance > 0 else 0,
|
||||
"credit_in_account_currency": abs(net_pl_balance) if net_pl_balance < 0 else 0,
|
||||
"credit": abs(net_pl_balance) if net_pl_balance < 0 else 0,
|
||||
"cost_center": cost_center
|
||||
})
|
||||
|
||||
self.update_default_dimensions(gl_entry)
|
||||
|
||||
return gl_entry
|
||||
|
||||
def get_costcenter_wise_pnl_gl_entries(self, pl_accounts):
|
||||
company_cost_center = frappe.db.get_value("Company", self.company, "cost_center")
|
||||
gl_entries = []
|
||||
|
||||
for acc in pl_accounts:
|
||||
if flt(acc.bal_in_company_currency):
|
||||
gl_entry = self.get_gl_dict({
|
||||
"account": self.closing_account_head,
|
||||
"cost_center": acc.cost_center or company_cost_center,
|
||||
"account_currency": acc.account_currency,
|
||||
"debit_in_account_currency": abs(flt(acc.bal_in_account_currency)) if flt(acc.bal_in_account_currency) > 0 else 0,
|
||||
"debit": abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) > 0 else 0,
|
||||
"credit_in_account_currency": abs(flt(acc.bal_in_account_currency)) if flt(acc.bal_in_account_currency) < 0 else 0,
|
||||
"credit": abs(flt(acc.bal_in_company_currency)) if flt(acc.bal_in_company_currency) < 0 else 0
|
||||
}, item=acc)
|
||||
|
||||
self.update_default_dimensions(gl_entry)
|
||||
|
||||
gl_entries.append(gl_entry)
|
||||
|
||||
return gl_entries
|
||||
|
||||
def update_default_dimensions(self, gl_entry):
|
||||
if not self.accounting_dimensions:
|
||||
self.accounting_dimensions = get_accounting_dimensions()
|
||||
|
||||
_, default_dimensions = get_dimensions()
|
||||
for dimension in self.accounting_dimensions:
|
||||
gl_entry.update({
|
||||
dimension: default_dimensions.get(self.company, {}).get(dimension)
|
||||
})
|
||||
|
||||
def get_pl_balances(self):
|
||||
"""Get balance for dimension-wise pl accounts"""
|
||||
|
||||
dimension_fields = ['t1.cost_center']
|
||||
|
||||
self.accounting_dimensions = get_accounting_dimensions()
|
||||
for dimension in self.accounting_dimensions:
|
||||
dimension_fields.append('t1.{0}'.format(dimension))
|
||||
|
||||
def get_pl_balances(self, dimension_fields):
|
||||
"""Get balance for pl accounts"""
|
||||
return frappe.db.sql("""
|
||||
select
|
||||
t1.account, t2.account_currency, {dimension_fields},
|
||||
sum(t1.debit_in_account_currency) - sum(t1.credit_in_account_currency) as balance_in_account_currency,
|
||||
sum(t1.debit) - sum(t1.credit) as balance_in_company_currency
|
||||
sum(t1.debit_in_account_currency) - sum(t1.credit_in_account_currency) as bal_in_account_currency,
|
||||
sum(t1.debit) - sum(t1.credit) as bal_in_company_currency
|
||||
from `tabGL Entry` t1, `tabAccount` t2
|
||||
where t1.account = t2.name and t2.report_type = 'Profit and Loss'
|
||||
and t2.docstatus < 2 and t2.company = %s
|
||||
|
@ -8,6 +8,7 @@ import frappe
|
||||
from frappe.utils import flt, today
|
||||
from erpnext.accounts.utils import get_fiscal_year, now
|
||||
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
|
||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
|
||||
|
||||
class TestPeriodClosingVoucher(unittest.TestCase):
|
||||
def test_closing_entry(self):
|
||||
@ -65,6 +66,58 @@ class TestPeriodClosingVoucher(unittest.TestCase):
|
||||
self.assertEqual(gle_for_random_expense_account[0].amount_in_account_currency,
|
||||
-1*random_expense_account[0].balance_in_account_currency)
|
||||
|
||||
def test_cost_center_wise_posting(self):
|
||||
frappe.db.sql("delete from `tabGL Entry` where company='Test PCV Company'")
|
||||
|
||||
company = create_company()
|
||||
surplus_account = create_account()
|
||||
|
||||
cost_center1 = create_cost_center("Test Cost Center 1")
|
||||
cost_center2 = create_cost_center("Test Cost Center 2")
|
||||
|
||||
create_sales_invoice(
|
||||
company=company,
|
||||
cost_center=cost_center1,
|
||||
income_account="Sales - TPC",
|
||||
expense_account="Cost of Goods Sold - TPC",
|
||||
rate=400,
|
||||
debit_to="Debtors - TPC"
|
||||
)
|
||||
create_sales_invoice(
|
||||
company=company,
|
||||
cost_center=cost_center2,
|
||||
income_account="Sales - TPC",
|
||||
expense_account="Cost of Goods Sold - TPC",
|
||||
rate=200,
|
||||
debit_to="Debtors - TPC"
|
||||
)
|
||||
|
||||
pcv = frappe.get_doc({
|
||||
"transaction_date": today(),
|
||||
"posting_date": today(),
|
||||
"fiscal_year": get_fiscal_year(today())[0],
|
||||
"company": "Test PCV Company",
|
||||
"cost_center_wise_pnl": 1,
|
||||
"closing_account_head": surplus_account,
|
||||
"remarks": "Test",
|
||||
"doctype": "Period Closing Voucher"
|
||||
})
|
||||
pcv.insert()
|
||||
pcv.submit()
|
||||
|
||||
expected_gle = (
|
||||
('Sales - TPC', 200.0, 0.0, cost_center2),
|
||||
(surplus_account, 0.0, 200.0, cost_center2),
|
||||
('Sales - TPC', 400.0, 0.0, cost_center1),
|
||||
(surplus_account, 0.0, 400.0, cost_center1)
|
||||
)
|
||||
|
||||
pcv_gle = frappe.db.sql("""
|
||||
select account, debit, credit, cost_center from `tabGL Entry` where voucher_no=%s
|
||||
""", (pcv.name))
|
||||
|
||||
self.assertTrue(pcv_gle, expected_gle)
|
||||
|
||||
def make_period_closing_voucher(self):
|
||||
pcv = frappe.get_doc({
|
||||
"doctype": "Period Closing Voucher",
|
||||
@ -80,6 +133,38 @@ class TestPeriodClosingVoucher(unittest.TestCase):
|
||||
|
||||
return pcv
|
||||
|
||||
def create_company():
|
||||
company = frappe.get_doc({
|
||||
'doctype': 'Company',
|
||||
'company_name': "Test PCV Company",
|
||||
'country': 'United States',
|
||||
'default_currency': 'USD'
|
||||
})
|
||||
company.insert(ignore_if_duplicate = True)
|
||||
return company.name
|
||||
|
||||
def create_account():
|
||||
account = frappe.get_doc({
|
||||
"account_name": "Reserve and Surplus",
|
||||
"is_group": 0,
|
||||
"company": "Test PCV Company",
|
||||
"root_type": "Liability",
|
||||
"report_type": "Balance Sheet",
|
||||
"account_currency": "USD",
|
||||
"parent_account": "Current Liabilities - TPC",
|
||||
"doctype": "Account"
|
||||
}).insert(ignore_if_duplicate = True)
|
||||
return account.name
|
||||
|
||||
def create_cost_center(cc_name):
|
||||
costcenter = frappe.get_doc({
|
||||
"company": "Test PCV Company",
|
||||
"cost_center_name": cc_name,
|
||||
"doctype": "Cost Center",
|
||||
"parent_cost_center": "Test PCV Company - TPC"
|
||||
})
|
||||
costcenter.insert(ignore_if_duplicate = True)
|
||||
return costcenter.name
|
||||
|
||||
test_dependencies = ["Customer", "Cost Center"]
|
||||
test_records = frappe.get_test_records("Period Closing Voucher")
|
||||
|
@ -837,6 +837,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.disable_rounded_total",
|
||||
"fieldname": "base_rounding_adjustment",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Rounding Adjustment (Company Currency)",
|
||||
@ -883,6 +884,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.disable_rounded_total",
|
||||
"fieldname": "rounding_adjustment",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Rounding Adjustment",
|
||||
@ -1380,7 +1382,7 @@
|
||||
"idx": 204,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-04-30 22:45:58.334107",
|
||||
"modified": "2021-06-09 12:30:25.632109",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice",
|
||||
|
@ -17,7 +17,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
var me = this;
|
||||
this._super();
|
||||
|
||||
this.frm.ignore_doctypes_on_cancel_all = ['POS Invoice', 'Timesheet'];
|
||||
this.frm.ignore_doctypes_on_cancel_all = ['POS Invoice', 'Timesheet', 'POS Invoice Merge Log', 'POS Closing Entry'];
|
||||
if(!this.frm.doc.__islocal && !this.frm.doc.customer && this.frm.doc.debit_to) {
|
||||
// show debit_to in print format
|
||||
this.frm.set_df_property("debit_to", "print_hide", 0);
|
||||
|
@ -531,7 +531,7 @@ class SalesInvoice(SellingController):
|
||||
# set pos values in items
|
||||
for item in self.get("items"):
|
||||
if item.get('item_code'):
|
||||
profile_details = get_pos_profile_item_details(pos, frappe._dict(item.as_dict()), pos)
|
||||
profile_details = get_pos_profile_item_details(pos, frappe._dict(item.as_dict()), pos, update_data=True)
|
||||
for fname, val in iteritems(profile_details):
|
||||
if (not for_validate) or (for_validate and not item.get(fname)):
|
||||
item.set(fname, val)
|
||||
@ -849,7 +849,6 @@ class SalesInvoice(SellingController):
|
||||
|
||||
self.make_loyalty_point_redemption_gle(gl_entries)
|
||||
self.make_pos_gl_entries(gl_entries)
|
||||
self.make_gle_for_change_amount(gl_entries)
|
||||
|
||||
self.make_write_off_gl_entry(gl_entries)
|
||||
self.make_gle_for_rounding_adjustment(gl_entries)
|
||||
@ -983,7 +982,13 @@ class SalesInvoice(SellingController):
|
||||
|
||||
def make_pos_gl_entries(self, gl_entries):
|
||||
if cint(self.is_pos):
|
||||
|
||||
skip_change_gl_entries = not cint(frappe.db.get_single_value('Accounts Settings', 'post_change_gl_entries'))
|
||||
|
||||
for payment_mode in self.payments:
|
||||
if skip_change_gl_entries and payment_mode.account == self.account_for_change_amount:
|
||||
payment_mode.base_amount -= self.change_amount
|
||||
|
||||
if payment_mode.amount:
|
||||
# POS, make payment entries
|
||||
gl_entries.append(
|
||||
@ -1015,8 +1020,11 @@ class SalesInvoice(SellingController):
|
||||
}, payment_mode_account_currency, item=self)
|
||||
)
|
||||
|
||||
if not skip_change_gl_entries:
|
||||
self.make_gle_for_change_amount(gl_entries)
|
||||
|
||||
def make_gle_for_change_amount(self, gl_entries):
|
||||
if cint(self.is_pos) and self.change_amount:
|
||||
if self.change_amount:
|
||||
if self.account_for_change_amount:
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
|
@ -713,7 +713,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
si.submit()
|
||||
self.assertEqual(si.paid_amount, 100.0)
|
||||
|
||||
self.pos_gl_entry(si, pos, 50)
|
||||
self.validate_pos_gl_entry(si, pos, 50)
|
||||
|
||||
def test_pos_returns_with_repayment(self):
|
||||
from erpnext.accounts.doctype.sales_invoice.sales_invoice import make_sales_return
|
||||
@ -749,7 +749,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
make_pos_profile(company="_Test Company with perpetual inventory", income_account = "Sales - TCP1",
|
||||
expense_account = "Cost of Goods Sold - TCP1", warehouse="Stores - TCP1", cost_center = "Main - TCP1", write_off_account="_Test Write Off - TCP1")
|
||||
|
||||
pr = make_purchase_receipt(company= "_Test Company with perpetual inventory",
|
||||
make_purchase_receipt(company= "_Test Company with perpetual inventory",
|
||||
item_code= "_Test FG Item",warehouse= "Stores - TCP1", cost_center= "Main - TCP1")
|
||||
|
||||
pos = create_sales_invoice(company= "_Test Company with perpetual inventory",
|
||||
@ -770,7 +770,45 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
self.assertEqual(pos.grand_total, 100.0)
|
||||
self.assertEqual(pos.write_off_amount, -5)
|
||||
|
||||
def pos_gl_entry(self, si, pos, cash_amount):
|
||||
def test_pos_with_no_gl_entry_for_change_amount(self):
|
||||
frappe.db.set_value('Accounts Settings', None, 'post_change_gl_entries', 0)
|
||||
|
||||
make_pos_profile(company="_Test Company with perpetual inventory", income_account = "Sales - TCP1",
|
||||
expense_account = "Cost of Goods Sold - TCP1", warehouse="Stores - TCP1", cost_center = "Main - TCP1", write_off_account="_Test Write Off - TCP1")
|
||||
|
||||
make_purchase_receipt(company= "_Test Company with perpetual inventory",
|
||||
item_code= "_Test FG Item",warehouse= "Stores - TCP1", cost_center= "Main - TCP1")
|
||||
|
||||
pos = create_sales_invoice(company= "_Test Company with perpetual inventory",
|
||||
debit_to="Debtors - TCP1", item_code= "_Test FG Item", warehouse="Stores - TCP1",
|
||||
income_account = "Sales - TCP1", expense_account = "Cost of Goods Sold - TCP1",
|
||||
cost_center = "Main - TCP1", do_not_save=True)
|
||||
|
||||
pos.is_pos = 1
|
||||
pos.update_stock = 1
|
||||
|
||||
taxes = get_taxes_and_charges()
|
||||
pos.taxes = []
|
||||
for tax in taxes:
|
||||
pos.append("taxes", tax)
|
||||
|
||||
pos.append("payments", {'mode_of_payment': 'Bank Draft', 'account': '_Test Bank - TCP1', 'amount': 50})
|
||||
pos.append("payments", {'mode_of_payment': 'Cash', 'account': 'Cash - TCP1', 'amount': 60})
|
||||
|
||||
pos.insert()
|
||||
pos.submit()
|
||||
|
||||
self.assertEqual(pos.grand_total, 100.0)
|
||||
self.assertEqual(pos.change_amount, 10)
|
||||
|
||||
self.validate_pos_gl_entry(pos, pos, 60, validate_without_change_gle=True)
|
||||
|
||||
frappe.db.set_value('Accounts Settings', None, 'post_change_gl_entries', 1)
|
||||
|
||||
def validate_pos_gl_entry(self, si, pos, cash_amount, validate_without_change_gle=False):
|
||||
if validate_without_change_gle:
|
||||
cash_amount -= pos.change_amount
|
||||
|
||||
# check stock ledger entries
|
||||
sle = frappe.db.sql("""select * from `tabStock Ledger Entry`
|
||||
where voucher_type = 'Sales Invoice' and voucher_no = %s""",
|
||||
|
@ -185,10 +185,10 @@ def make_round_off_gle(gl_map, debit_credit_diff, precision):
|
||||
for d in gl_map:
|
||||
if d.account == round_off_account:
|
||||
round_off_gle = d
|
||||
if d.debit_in_account_currency:
|
||||
debit_credit_diff -= flt(d.debit_in_account_currency)
|
||||
if d.debit:
|
||||
debit_credit_diff -= flt(d.debit)
|
||||
else:
|
||||
debit_credit_diff += flt(d.credit_in_account_currency)
|
||||
debit_credit_diff += flt(d.credit)
|
||||
round_off_account_exists = True
|
||||
|
||||
if round_off_account_exists and abs(debit_credit_diff) <= (1.0 / (10**precision)):
|
||||
|
@ -58,11 +58,9 @@ def get_conditions(filters):
|
||||
def get_data(filters):
|
||||
|
||||
data = []
|
||||
|
||||
conditions = get_conditions(filters)
|
||||
|
||||
accounts = frappe.db.get_all("Account", fields=["name", "account_currency"],
|
||||
filters=conditions)
|
||||
filters=conditions, order_by='name')
|
||||
|
||||
for d in accounts:
|
||||
balance = get_balance_on(d.name, date=filters.report_date)
|
||||
|
@ -23,7 +23,7 @@ class TestAccountBalance(unittest.TestCase):
|
||||
|
||||
expected_data = [
|
||||
{
|
||||
"account": 'Sales - _TC2',
|
||||
"account": 'Direct Income - _TC2',
|
||||
"currency": 'EUR',
|
||||
"balance": -100.0,
|
||||
},
|
||||
@ -32,21 +32,21 @@ class TestAccountBalance(unittest.TestCase):
|
||||
"currency": 'EUR',
|
||||
"balance": -100.0,
|
||||
},
|
||||
{
|
||||
"account": 'Service - _TC2',
|
||||
"currency": 'EUR',
|
||||
"balance": 0.0,
|
||||
},
|
||||
{
|
||||
"account": 'Direct Income - _TC2',
|
||||
"currency": 'EUR',
|
||||
"balance": -100.0,
|
||||
},
|
||||
{
|
||||
"account": 'Indirect Income - _TC2',
|
||||
"currency": 'EUR',
|
||||
"balance": 0.0,
|
||||
},
|
||||
{
|
||||
"account": 'Sales - _TC2',
|
||||
"currency": 'EUR',
|
||||
"balance": -100.0,
|
||||
},
|
||||
{
|
||||
"account": 'Service - _TC2',
|
||||
"currency": 'EUR',
|
||||
"balance": 0.0,
|
||||
}
|
||||
]
|
||||
|
||||
self.assertEqual(expected_data, report[1])
|
||||
|
@ -584,6 +584,7 @@ class ReceivablePayableReport(object):
|
||||
`tabGL Entry`
|
||||
where
|
||||
docstatus < 2
|
||||
and is_cancelled = 0
|
||||
and party_type=%s
|
||||
and (party is not null and party != '')
|
||||
{1} {2} {3}"""
|
||||
|
@ -445,15 +445,15 @@
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"dependencies": "GL Entry",
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "UAE VAT 201",
|
||||
"link_to": "UAE VAT 201",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
"dependencies": "GL Entry",
|
||||
"hidden": 0,
|
||||
"is_query_report": 1,
|
||||
"label": "UAE VAT 201",
|
||||
"link_to": "UAE VAT 201",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
"hidden": 0,
|
||||
"is_query_report": 0,
|
||||
@ -684,6 +684,7 @@
|
||||
"is_query_report": 0,
|
||||
"label": "Goods and Services Tax (GST India)",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Card Break"
|
||||
},
|
||||
{
|
||||
@ -694,6 +695,7 @@
|
||||
"link_to": "GST Settings",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -704,6 +706,7 @@
|
||||
"link_to": "GST HSN Code",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -714,6 +717,7 @@
|
||||
"link_to": "GSTR-1",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -724,6 +728,7 @@
|
||||
"link_to": "GSTR-2",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -734,6 +739,7 @@
|
||||
"link_to": "GSTR 3B Report",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -744,6 +750,7 @@
|
||||
"link_to": "GST Sales Register",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -754,6 +761,7 @@
|
||||
"link_to": "GST Purchase Register",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -764,6 +772,7 @@
|
||||
"link_to": "GST Itemised Sales Register",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -774,6 +783,7 @@
|
||||
"link_to": "GST Itemised Purchase Register",
|
||||
"link_type": "Report",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -784,6 +794,7 @@
|
||||
"link_to": "C-Form",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -794,6 +805,7 @@
|
||||
"link_to": "Lower Deduction Certificate",
|
||||
"link_type": "DocType",
|
||||
"onboard": 0,
|
||||
"only_for": "India",
|
||||
"type": "Link"
|
||||
},
|
||||
{
|
||||
@ -1052,7 +1064,7 @@
|
||||
"type": "Link"
|
||||
}
|
||||
],
|
||||
"modified": "2021-05-12 11:48:01.905144",
|
||||
"modified": "2021-06-10 03:17:31.427945",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Accounting",
|
||||
@ -1107,4 +1119,4 @@
|
||||
"type": "Dashboard"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -765,6 +765,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.disable_rounded_total",
|
||||
"fieldname": "base_rounding_adjustment",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Rounding Adjustment (Company Currency)",
|
||||
@ -810,6 +811,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.disable_rounded_total",
|
||||
"fieldname": "rounding_adjustment",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Rounding Adjustment",
|
||||
@ -1124,7 +1126,7 @@
|
||||
"idx": 105,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-01-20 22:07:23.487138",
|
||||
"modified": "2021-04-19 00:55:30.781375",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order",
|
||||
|
@ -576,6 +576,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.disable_rounded_total",
|
||||
"fieldname": "base_rounding_adjustment",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Rounding Adjustment (Company Currency",
|
||||
@ -620,6 +621,7 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:!doc.disable_rounded_total",
|
||||
"fieldname": "rounding_adjustment",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Rounding Adjustment",
|
||||
@ -802,7 +804,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2020-12-03 15:18:29.073368",
|
||||
"modified": "2021-04-19 00:58:20.995491",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Supplier Quotation",
|
||||
|
@ -225,7 +225,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
def validate_date_with_fiscal_year(self):
|
||||
if self.meta.get_field("fiscal_year"):
|
||||
date_field = ""
|
||||
date_field = None
|
||||
if self.meta.get_field("posting_date"):
|
||||
date_field = "posting_date"
|
||||
elif self.meta.get_field("transaction_date"):
|
||||
@ -1449,6 +1449,7 @@ def validate_and_delete_children(parent, data):
|
||||
for d in deleted_children:
|
||||
update_bin_on_delete(d, parent.doctype)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, child_docname="items"):
|
||||
def check_doc_permissions(doc, perm_type='create'):
|
||||
|
@ -4,6 +4,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import erpnext
|
||||
import json
|
||||
from frappe.desk.reportview import get_match_cond, get_filters_cond
|
||||
from frappe.utils import nowdate, getdate
|
||||
from collections import defaultdict
|
||||
@ -198,13 +199,16 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
|
||||
conditions = []
|
||||
|
||||
if isinstance(filters, str):
|
||||
filters = json.loads(filters)
|
||||
|
||||
#Get searchfields from meta and use in Item Link field query
|
||||
meta = frappe.get_meta("Item", cached=True)
|
||||
searchfields = meta.get_search_fields()
|
||||
|
||||
if "description" in searchfields:
|
||||
searchfields.remove("description")
|
||||
|
||||
|
||||
columns = ''
|
||||
extra_searchfields = [field for field in searchfields
|
||||
if not field in ["name", "item_group", "description"]]
|
||||
@ -216,9 +220,10 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
if not field in searchfields]
|
||||
searchfields = " or ".join([field + " like %(txt)s" for field in searchfields])
|
||||
|
||||
if filters.get('supplier'):
|
||||
item_group_list = frappe.get_all('Supplier Item Group', filters = {'supplier': filters.get('supplier')}, fields = ['item_group'])
|
||||
|
||||
if filters and isinstance(filters, dict) and filters.get('supplier'):
|
||||
item_group_list = frappe.get_all('Supplier Item Group',
|
||||
filters = {'supplier': filters.get('supplier')}, fields = ['item_group'])
|
||||
|
||||
item_groups = []
|
||||
for i in item_group_list:
|
||||
item_groups.append(i.item_group)
|
||||
@ -227,7 +232,7 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
|
||||
if item_groups:
|
||||
filters['item_group'] = ['in', item_groups]
|
||||
|
||||
|
||||
description_cond = ''
|
||||
if frappe.db.count('Item', cache=True) < 50000:
|
||||
# scan description only if items are less than 50000
|
||||
|
@ -1,17 +1,21 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
from frappe.utils import cint, flt, cstr, get_link_to_form, today, getdate
|
||||
from frappe import _
|
||||
import frappe.defaults
|
||||
import json
|
||||
from collections import defaultdict
|
||||
from erpnext.accounts.utils import get_fiscal_year, check_if_stock_and_account_balance_synced
|
||||
|
||||
import frappe
|
||||
import frappe.defaults
|
||||
from frappe import _
|
||||
from frappe.utils import cint, cstr, flt, get_link_to_form, getdate
|
||||
|
||||
import erpnext
|
||||
from erpnext.accounts.general_ledger import make_gl_entries, make_reverse_gl_entries, process_gl_map
|
||||
from erpnext.accounts.utils import check_if_stock_and_account_balance_synced, get_fiscal_year
|
||||
from erpnext.controllers.accounts_controller import AccountsController
|
||||
from erpnext.stock.stock_ledger import get_valuation_rate
|
||||
from erpnext.stock import get_warehouse_account_map
|
||||
from erpnext.stock.stock_ledger import get_valuation_rate
|
||||
|
||||
|
||||
class QualityInspectionRequiredError(frappe.ValidationError): pass
|
||||
class QualityInspectionRejectedError(frappe.ValidationError): pass
|
||||
@ -189,7 +193,6 @@ class StockController(AccountsController):
|
||||
if hasattr(self, "items"):
|
||||
item_doclist = self.get("items")
|
||||
elif self.doctype == "Stock Reconciliation":
|
||||
import json
|
||||
item_doclist = []
|
||||
data = json.loads(self.reconciliation_json)
|
||||
for row in data[data.index(self.head_row)+1:]:
|
||||
@ -319,7 +322,7 @@ class StockController(AccountsController):
|
||||
return serialized_items
|
||||
|
||||
def validate_warehouse(self):
|
||||
from erpnext.stock.utils import validate_warehouse_company, validate_disabled_warehouse
|
||||
from erpnext.stock.utils import validate_disabled_warehouse, validate_warehouse_company
|
||||
|
||||
warehouses = list(set([d.warehouse for d in
|
||||
self.get("items") if getattr(d, "warehouse", None)]))
|
||||
@ -498,6 +501,39 @@ class StockController(AccountsController):
|
||||
check_if_stock_and_account_balance_synced(self.posting_date,
|
||||
self.company, self.doctype, self.name)
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_quality_inspections(doctype, docname, items):
|
||||
if isinstance(items, str):
|
||||
items = json.loads(items)
|
||||
|
||||
inspections = []
|
||||
for item in items:
|
||||
if flt(item.get("sample_size")) > flt(item.get("qty")):
|
||||
frappe.throw(_("{item_name}'s Sample Size ({sample_size}) cannot be greater than the Accepted Quantity ({accepted_quantity})").format(
|
||||
item_name=item.get("item_name"),
|
||||
sample_size=item.get("sample_size"),
|
||||
accepted_quantity=item.get("qty")
|
||||
))
|
||||
|
||||
quality_inspection = frappe.get_doc({
|
||||
"doctype": "Quality Inspection",
|
||||
"inspection_type": "Incoming",
|
||||
"inspected_by": frappe.session.user,
|
||||
"reference_type": doctype,
|
||||
"reference_name": docname,
|
||||
"item_code": item.get("item_code"),
|
||||
"description": item.get("description"),
|
||||
"sample_size": flt(item.get("sample_size")),
|
||||
"item_serial_no": item.get("serial_no").split("\n")[0] if item.get("serial_no") else None,
|
||||
"batch_no": item.get("batch_no")
|
||||
}).insert()
|
||||
quality_inspection.save()
|
||||
inspections.append(quality_inspection.name)
|
||||
|
||||
return inspections
|
||||
|
||||
|
||||
def is_reposting_pending():
|
||||
return frappe.db.exists("Repost Item Valuation",
|
||||
{'docstatus': 1, 'status': ['in', ['Queued','In Progress']]})
|
||||
|
@ -280,7 +280,6 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:",
|
||||
"fieldname": "territory",
|
||||
"fieldtype": "Link",
|
||||
"label": "Territory",
|
||||
@ -431,7 +430,7 @@
|
||||
"icon": "fa fa-info-sign",
|
||||
"idx": 195,
|
||||
"links": [],
|
||||
"modified": "2021-01-06 19:42:46.190051",
|
||||
"modified": "2021-06-04 10:11:22.831139",
|
||||
"modified_by": "Administrator",
|
||||
"module": "CRM",
|
||||
"name": "Opportunity",
|
||||
|
@ -219,7 +219,6 @@ def get_quiz(quiz_name, course):
|
||||
try:
|
||||
quiz = frappe.get_doc("Quiz", quiz_name)
|
||||
questions = quiz.get_questions()
|
||||
duration = quiz.duration
|
||||
except:
|
||||
frappe.throw(_("Quiz {0} does not exist").format(quiz_name), frappe.DoesNotExistError)
|
||||
return None
|
||||
@ -236,15 +235,17 @@ def get_quiz(quiz_name, course):
|
||||
return {
|
||||
'questions': questions,
|
||||
'activity': None,
|
||||
'duration':duration
|
||||
'is_time_bound': quiz.is_time_bound,
|
||||
'duration': quiz.duration
|
||||
}
|
||||
|
||||
student = get_current_student()
|
||||
course_enrollment = get_enrollment("course", course, student.name)
|
||||
status, score, result, time_taken = check_quiz_completion(quiz, course_enrollment)
|
||||
return {
|
||||
'questions': questions,
|
||||
'questions': questions,
|
||||
'activity': {'is_complete': status, 'score': score, 'result': result, 'time_taken': time_taken},
|
||||
'is_time_bound': quiz.is_time_bound,
|
||||
'duration': quiz.duration
|
||||
}
|
||||
|
||||
@ -372,9 +373,9 @@ def check_content_completion(content_name, content_type, enrollment_name):
|
||||
def check_quiz_completion(quiz, enrollment_name):
|
||||
attempts = frappe.get_all("Quiz Activity",
|
||||
filters={
|
||||
'enrollment': enrollment_name,
|
||||
'enrollment': enrollment_name,
|
||||
'quiz': quiz.name
|
||||
},
|
||||
},
|
||||
fields=["name", "activity_date", "score", "status", "time_taken"]
|
||||
)
|
||||
status = False if quiz.max_attempts == 0 else bool(len(attempts) >= quiz.max_attempts)
|
||||
@ -389,4 +390,4 @@ def check_quiz_completion(quiz, enrollment_name):
|
||||
time_taken = attempts[0]['time_taken']
|
||||
if result == 'Pass':
|
||||
status = True
|
||||
return status, score, result, time_taken
|
||||
return status, score, result, time_taken
|
||||
|
@ -332,7 +332,9 @@ scheduler_events = {
|
||||
"erpnext.projects.doctype.project.project.collect_project_status",
|
||||
"erpnext.hr.doctype.shift_type.shift_type.process_auto_attendance_for_all_shifts",
|
||||
"erpnext.support.doctype.issue.issue.set_service_level_agreement_variance",
|
||||
"erpnext.erpnext_integrations.connectors.shopify_connection.sync_old_orders",
|
||||
"erpnext.erpnext_integrations.connectors.shopify_connection.sync_old_orders"
|
||||
],
|
||||
"hourly_long": [
|
||||
"erpnext.stock.doctype.repost_item_valuation.repost_item_valuation.repost_entries"
|
||||
],
|
||||
"daily": [
|
||||
|
@ -433,7 +433,8 @@ def make_material_request(source_name, target_doc=None):
|
||||
def make_stock_entry(source_name, target_doc=None):
|
||||
def update_item(obj, target, source_parent):
|
||||
target.t_warehouse = source_parent.wip_warehouse
|
||||
target.conversion_factor = 1
|
||||
if not target.conversion_factor:
|
||||
target.conversion_factor = 1
|
||||
|
||||
def set_missing_values(source, target):
|
||||
target.purpose = "Material Transfer for Manufacture"
|
||||
|
@ -211,16 +211,27 @@ frappe.ui.form.on('Production Plan', {
|
||||
});
|
||||
},
|
||||
|
||||
get_items: function(frm) {
|
||||
get_items: function (frm) {
|
||||
frm.clear_table('prod_plan_references');
|
||||
|
||||
frappe.call({
|
||||
method: "get_items",
|
||||
freeze: true,
|
||||
doc: frm.doc,
|
||||
callback: function() {
|
||||
callback: function () {
|
||||
refresh_field('po_items');
|
||||
}
|
||||
});
|
||||
},
|
||||
combine_items: function (frm) {
|
||||
frm.clear_table('prod_plan_references');
|
||||
|
||||
frappe.call({
|
||||
method: "get_items",
|
||||
freeze: true,
|
||||
doc: frm.doc,
|
||||
});
|
||||
},
|
||||
|
||||
get_items_for_mr: function(frm) {
|
||||
if (!frm.doc.for_warehouse) {
|
||||
|
@ -28,7 +28,10 @@
|
||||
"material_requests",
|
||||
"select_items_to_manufacture_section",
|
||||
"get_items",
|
||||
"combine_items",
|
||||
"po_items",
|
||||
"section_break_25",
|
||||
"prod_plan_references",
|
||||
"material_request_planning",
|
||||
"include_non_stock_items",
|
||||
"include_subcontracted_items",
|
||||
@ -316,13 +319,31 @@
|
||||
"fieldname": "include_safety_stock",
|
||||
"fieldtype": "Check",
|
||||
"label": "Include Safety Stock in Required Qty Calculation"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"depends_on": "eval:doc.get_items_from == 'Sales Order'",
|
||||
"fieldname": "combine_items",
|
||||
"fieldtype": "Check",
|
||||
"label": "Consolidate Items"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_25",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "prod_plan_references",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 1,
|
||||
"label": "Production Plan Item Reference",
|
||||
"options": "Production Plan Item Reference"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-calendar",
|
||||
"index_web_pages_for_search": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-03-08 11:17:25.470147",
|
||||
"modified": "2021-05-24 16:59:03.643211",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Plan",
|
||||
|
@ -96,8 +96,10 @@ class ProductionPlan(Document):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_items(self):
|
||||
self.set('po_items', [])
|
||||
if self.get_items_from == "Sales Order":
|
||||
self.get_so_items()
|
||||
self.get_so_items()
|
||||
|
||||
elif self.get_items_from == "Material Request":
|
||||
self.get_mr_items()
|
||||
|
||||
@ -165,9 +167,31 @@ class ProductionPlan(Document):
|
||||
self.calculate_total_planned_qty()
|
||||
|
||||
def add_items(self, items):
|
||||
self.set('po_items', [])
|
||||
refs = {}
|
||||
for data in items:
|
||||
item_details = get_item_details(data.item_code)
|
||||
if self.combine_items:
|
||||
if item_details.bom_no in refs:
|
||||
refs[item_details.bom_no]['so_details'].append({
|
||||
'sales_order': data.parent,
|
||||
'sales_order_item': data.name,
|
||||
'qty': data.pending_qty
|
||||
})
|
||||
refs[item_details.bom_no]['qty'] += data.pending_qty
|
||||
continue
|
||||
|
||||
else:
|
||||
refs[item_details.bom_no] = {
|
||||
'qty': data.pending_qty,
|
||||
'po_item_ref': data.name,
|
||||
'so_details': []
|
||||
}
|
||||
refs[item_details.bom_no]['so_details'].append({
|
||||
'sales_order': data.parent,
|
||||
'sales_order_item': data.name,
|
||||
'qty': data.pending_qty
|
||||
})
|
||||
|
||||
pi = self.append('po_items', {
|
||||
'include_exploded_items': 1,
|
||||
'warehouse': data.warehouse,
|
||||
@ -185,11 +209,28 @@ class ProductionPlan(Document):
|
||||
pi.sales_order = data.parent
|
||||
pi.sales_order_item = data.name
|
||||
pi.description = data.description
|
||||
|
||||
|
||||
elif self.get_items_from == "Material Request":
|
||||
pi.material_request = data.parent
|
||||
pi.material_request_item = data.name
|
||||
pi.description = data.description
|
||||
|
||||
if refs:
|
||||
for po_item in self.po_items:
|
||||
po_item.planned_qty = refs[po_item.bom_no]['qty']
|
||||
po_item.pending_qty = refs[po_item.bom_no]['qty']
|
||||
po_item.sales_order = ''
|
||||
self.add_pp_ref(refs)
|
||||
|
||||
def add_pp_ref(self, refs):
|
||||
for bom_no in refs:
|
||||
for so_detail in refs[bom_no]['so_details']:
|
||||
self.append('prod_plan_references', {
|
||||
'item_reference': refs[bom_no]['po_item_ref'],
|
||||
'sales_order': so_detail['sales_order'],
|
||||
'sales_order_item': so_detail['sales_order_item'],
|
||||
'qty': so_detail['qty']
|
||||
})
|
||||
|
||||
def calculate_total_planned_qty(self):
|
||||
self.total_planned_qty = 0
|
||||
|
@ -100,7 +100,7 @@ class TestProductionPlan(unittest.TestCase):
|
||||
|
||||
def test_production_plan_sales_orders(self):
|
||||
item = 'Test Production Item 1'
|
||||
so = make_sales_order(item_code=item, qty=5)
|
||||
so = make_sales_order(item_code=item, qty=1)
|
||||
sales_order = so.name
|
||||
sales_order_item = so.items[0].name
|
||||
|
||||
@ -124,8 +124,8 @@ class TestProductionPlan(unittest.TestCase):
|
||||
|
||||
wo_doc = frappe.get_doc('Work Order', work_order)
|
||||
wo_doc.update({
|
||||
'wip_warehouse': '_Test Warehouse 1 - _TC',
|
||||
'fg_warehouse': '_Test Warehouse - _TC'
|
||||
'wip_warehouse': 'Work In Progress - _TC',
|
||||
'fg_warehouse': 'Finished Goods - _TC'
|
||||
})
|
||||
wo_doc.submit()
|
||||
|
||||
@ -145,6 +145,58 @@ class TestProductionPlan(unittest.TestCase):
|
||||
|
||||
self.assertEqual(sales_orders, [])
|
||||
|
||||
def test_production_plan_combine_items(self):
|
||||
item = 'Test Production Item 1'
|
||||
so = make_sales_order(item_code=item, qty=1)
|
||||
|
||||
pln = frappe.new_doc('Production Plan')
|
||||
pln.company = so.company
|
||||
pln.get_items_from = 'Sales Order'
|
||||
pln.append('sales_orders', {
|
||||
'sales_order': so.name,
|
||||
'sales_order_date': so.transaction_date,
|
||||
'customer': so.customer,
|
||||
'grand_total': so.grand_total
|
||||
})
|
||||
so = make_sales_order(item_code=item, qty=2)
|
||||
pln.append('sales_orders', {
|
||||
'sales_order': so.name,
|
||||
'sales_order_date': so.transaction_date,
|
||||
'customer': so.customer,
|
||||
'grand_total': so.grand_total
|
||||
})
|
||||
pln.combine_items = 1
|
||||
pln.get_items()
|
||||
pln.submit()
|
||||
|
||||
self.assertTrue(pln.po_items[0].planned_qty, 3)
|
||||
|
||||
pln.make_work_order()
|
||||
work_order = frappe.db.get_value('Work Order', {
|
||||
'production_plan_item': pln.po_items[0].name,
|
||||
'production_plan': pln.name
|
||||
}, 'name')
|
||||
|
||||
wo_doc = frappe.get_doc('Work Order', work_order)
|
||||
wo_doc.update({
|
||||
'wip_warehouse': 'Work In Progress - _TC',
|
||||
})
|
||||
|
||||
wo_doc.submit()
|
||||
so_items = []
|
||||
for plan_reference in pln.prod_plan_references:
|
||||
so_items.append(plan_reference.sales_order_item)
|
||||
so_wo_qty = frappe.db.get_value('Sales Order Item', plan_reference.sales_order_item, 'work_order_qty')
|
||||
self.assertEqual(so_wo_qty, plan_reference.qty)
|
||||
|
||||
wo_doc.cancel()
|
||||
for so_item in so_items:
|
||||
so_wo_qty = frappe.db.get_value('Sales Order Item', so_item, 'work_order_qty')
|
||||
self.assertEqual(so_wo_qty, 0.0)
|
||||
|
||||
latest_plan = frappe.get_doc('Production Plan', pln.name)
|
||||
latest_plan.cancel()
|
||||
|
||||
def test_pp_to_mr_customer_provided(self):
|
||||
#Material Request from Production Plan for Customer Provided
|
||||
create_item('CUST-0987', is_customer_provided_item = 1, customer = '_Test Customer', is_purchase_item = 0)
|
||||
|
@ -1,792 +1,229 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"autoname": "hash",
|
||||
"beta": 0,
|
||||
"creation": "2013-02-22 01:27:49",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"actions": [],
|
||||
"autoname": "hash",
|
||||
"creation": "2013-02-22 01:27:49",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"include_exploded_items",
|
||||
"item_code",
|
||||
"bom_no",
|
||||
"planned_qty",
|
||||
"column_break_6",
|
||||
"make_work_order_for_sub_assembly_items",
|
||||
"warehouse",
|
||||
"planned_start_date",
|
||||
"section_break_9",
|
||||
"pending_qty",
|
||||
"ordered_qty",
|
||||
"produced_qty",
|
||||
"column_break_17",
|
||||
"description",
|
||||
"stock_uom",
|
||||
"reference_section",
|
||||
"sales_order",
|
||||
"sales_order_item",
|
||||
"column_break_19",
|
||||
"material_request",
|
||||
"material_request_item",
|
||||
"product_bundle_item",
|
||||
"item_reference"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "include_exploded_items",
|
||||
"fieldtype": "Check",
|
||||
"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": "Include Exploded Items",
|
||||
"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
|
||||
},
|
||||
"columns": 2,
|
||||
"default": "0",
|
||||
"fieldname": "include_exploded_items",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 1,
|
||||
"label": "Include Exploded Items"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "item_code",
|
||||
"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": "Item Code",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "150px",
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"columns": 2,
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Item",
|
||||
"print_width": "150px",
|
||||
"reqd": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 2,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "bom_no",
|
||||
"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": "BOM No",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "bom_no",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "BOM",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "100px",
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"columns": 2,
|
||||
"fieldname": "bom_no",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "BOM No",
|
||||
"oldfieldname": "bom_no",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "BOM",
|
||||
"print_width": "100px",
|
||||
"reqd": 1,
|
||||
"width": "100px"
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "planned_qty",
|
||||
"fieldtype": "Float",
|
||||
"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": "Planned Qty",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "planned_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "100px",
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"fieldname": "planned_qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Planned Qty",
|
||||
"oldfieldname": "planned_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"print_width": "100px",
|
||||
"reqd": 1,
|
||||
"width": "100px"
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "column_break_6",
|
||||
"fieldtype": "Column Break",
|
||||
"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,
|
||||
"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
|
||||
},
|
||||
"fieldname": "column_break_6",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "",
|
||||
"description": "If enabled, system will create the work order for the exploded items against which BOM is available.",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "make_work_order_for_sub_assembly_items",
|
||||
"fieldtype": "Check",
|
||||
"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": "Make Work Order for Sub Assembly Items",
|
||||
"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
|
||||
},
|
||||
"default": "0",
|
||||
"description": "If enabled, system will create the work order for the exploded items against which BOM is available.",
|
||||
"fieldname": "make_work_order_for_sub_assembly_items",
|
||||
"fieldtype": "Check",
|
||||
"label": "Make Work Order for Sub Assembly Items"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "warehouse",
|
||||
"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": "For Warehouse",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Warehouse",
|
||||
"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,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "warehouse",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "For Warehouse",
|
||||
"options": "Warehouse"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "Today",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "planned_start_date",
|
||||
"fieldtype": "Datetime",
|
||||
"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": "Planned Start Date",
|
||||
"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": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "Today",
|
||||
"fieldname": "planned_start_date",
|
||||
"fieldtype": "Datetime",
|
||||
"in_list_view": 1,
|
||||
"label": "Planned Start Date",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "section_break_9",
|
||||
"fieldtype": "Section Break",
|
||||
"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": "Quantity and 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
|
||||
},
|
||||
"fieldname": "section_break_9",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Quantity and Description"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "pending_qty",
|
||||
"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": "Pending Qty",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "prevdoc_reqd_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"default": "0",
|
||||
"fieldname": "pending_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Pending Qty",
|
||||
"oldfieldname": "prevdoc_reqd_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
"print_width": "100px",
|
||||
"read_only": 1,
|
||||
"width": "100px"
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "ordered_qty",
|
||||
"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": "Ordered Qty",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "0",
|
||||
"fieldname": "ordered_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Ordered Qty",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "0",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "produced_qty",
|
||||
"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": "Produced Qty",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"default": "0",
|
||||
"fieldname": "produced_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Produced Qty",
|
||||
"no_copy": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "column_break_17",
|
||||
"fieldtype": "Column Break",
|
||||
"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,
|
||||
"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
|
||||
},
|
||||
"fieldname": "column_break_17",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"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": "Text Editor",
|
||||
"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,
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "200px",
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text Editor",
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text",
|
||||
"print_width": "200px",
|
||||
"read_only": 1,
|
||||
"width": "200px"
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Link",
|
||||
"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": "UOM",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "stock_uom",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "80px",
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0,
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Link",
|
||||
"label": "UOM",
|
||||
"oldfieldname": "stock_uom",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "UOM",
|
||||
"print_width": "80px",
|
||||
"read_only": 1,
|
||||
"reqd": 1,
|
||||
"width": "80px"
|
||||
},
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "reference_section",
|
||||
"fieldtype": "Section Break",
|
||||
"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": "Reference",
|
||||
"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
|
||||
},
|
||||
"fieldname": "reference_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Reference"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "sales_order",
|
||||
"fieldtype": "Link",
|
||||
"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": "Sales Order",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "source_docname",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Sales Order",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "sales_order",
|
||||
"fieldtype": "Link",
|
||||
"label": "Sales Order",
|
||||
"oldfieldname": "source_docname",
|
||||
"oldfieldtype": "Data",
|
||||
"options": "Sales Order",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "sales_order_item",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Sales Order Item",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"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
|
||||
},
|
||||
"fieldname": "sales_order_item",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Sales Order Item",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "column_break_19",
|
||||
"fieldtype": "Column Break",
|
||||
"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,
|
||||
"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
|
||||
},
|
||||
"fieldname": "column_break_19",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "material_request",
|
||||
"fieldtype": "Link",
|
||||
"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": "Material Request",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Material Request",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
"fieldname": "material_request",
|
||||
"fieldtype": "Link",
|
||||
"label": "Material Request",
|
||||
"options": "Material Request",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "material_request_item",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "material_request_item",
|
||||
"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
|
||||
},
|
||||
"fieldname": "material_request_item",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "material_request_item"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "product_bundle_item",
|
||||
"fieldtype": "Link",
|
||||
"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": "Product Bundle Item",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Item",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
"fieldname": "product_bundle_item",
|
||||
"fieldtype": "Link",
|
||||
"label": "Product Bundle Item",
|
||||
"no_copy": 1,
|
||||
"options": "Item",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "item_reference",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"label": "Item Reference"
|
||||
}
|
||||
],
|
||||
"has_web_view": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 1,
|
||||
"in_create": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-04-08 23:09:57.199423",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Plan Item",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"show_name_in_global_search": 0,
|
||||
"sort_order": "ASC",
|
||||
"track_changes": 0,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-04-28 19:14:57.772123",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Plan Item",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "ASC"
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
{
|
||||
"actions": [],
|
||||
"creation": "2021-04-22 10:32:58.896330",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"item_reference",
|
||||
"sales_order",
|
||||
"sales_order_item",
|
||||
"qty"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "sales_order",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Sales Order Reference",
|
||||
"options": "Sales Order"
|
||||
},
|
||||
{
|
||||
"fieldname": "sales_order_item",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Sales Order Item"
|
||||
},
|
||||
{
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "qty"
|
||||
},
|
||||
{
|
||||
"fieldname": "item_reference",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Reference"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-05-07 17:03:49.707487",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Plan Item Reference",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class ProductionPlanItemReference(Document):
|
||||
pass
|
@ -240,8 +240,12 @@ class WorkOrder(Document):
|
||||
frappe.throw(_("Work-in-Progress Warehouse is required before Submit"))
|
||||
if not self.fg_warehouse:
|
||||
frappe.throw(_("For Warehouse is required before Submit"))
|
||||
|
||||
if self.production_plan and frappe.db.exists('Production Plan Item Reference',{'parent':self.production_plan}):
|
||||
self.update_work_order_qty_in_combined_so()
|
||||
else:
|
||||
self.update_work_order_qty_in_so()
|
||||
|
||||
self.update_work_order_qty_in_so()
|
||||
self.update_reserved_qty_for_production()
|
||||
self.update_completed_qty_in_material_request()
|
||||
self.update_planned_qty()
|
||||
@ -250,9 +254,13 @@ class WorkOrder(Document):
|
||||
|
||||
def on_cancel(self):
|
||||
self.validate_cancel()
|
||||
|
||||
frappe.db.set(self,'status', 'Cancelled')
|
||||
self.update_work_order_qty_in_so()
|
||||
|
||||
if self.production_plan and frappe.db.exists('Production Plan Item Reference',{'parent':self.production_plan}):
|
||||
self.update_work_order_qty_in_combined_so()
|
||||
else:
|
||||
self.update_work_order_qty_in_so()
|
||||
|
||||
self.delete_job_card()
|
||||
self.update_completed_qty_in_material_request()
|
||||
self.update_planned_qty()
|
||||
@ -357,7 +365,28 @@ class WorkOrder(Document):
|
||||
work_order_qty = qty[0][0] if qty and qty[0][0] else 0
|
||||
frappe.db.set_value('Sales Order Item',
|
||||
self.sales_order_item, 'work_order_qty', flt(work_order_qty/total_bundle_qty, 2))
|
||||
|
||||
def update_work_order_qty_in_combined_so(self):
|
||||
total_bundle_qty = 1
|
||||
if self.product_bundle_item:
|
||||
total_bundle_qty = frappe.db.sql(""" select sum(qty) from
|
||||
`tabProduct Bundle Item` where parent = %s""", (frappe.db.escape(self.product_bundle_item)))[0][0]
|
||||
|
||||
if not total_bundle_qty:
|
||||
# product bundle is 0 (product bundle allows 0 qty for items)
|
||||
total_bundle_qty = 1
|
||||
|
||||
prod_plan = frappe.get_doc('Production Plan', self.production_plan)
|
||||
item_reference = frappe.get_value('Production Plan Item', self.production_plan_item, 'sales_order_item')
|
||||
|
||||
for plan_reference in prod_plan.prod_plan_references:
|
||||
work_order_qty = 0.0
|
||||
if plan_reference.item_reference == item_reference:
|
||||
if self.docstatus == 1:
|
||||
work_order_qty = flt(plan_reference.qty) / total_bundle_qty
|
||||
frappe.db.set_value('Sales Order Item',
|
||||
plan_reference.sales_order_item, 'work_order_qty', work_order_qty)
|
||||
|
||||
def update_completed_qty_in_material_request(self):
|
||||
if self.material_request:
|
||||
frappe.get_doc("Material Request", self.material_request).update_completed_qty([self.material_request_item])
|
||||
|
@ -1,494 +1,19 @@
|
||||
execute:import unidecode # new requirement
|
||||
erpnext.patches.v8_0.move_perpetual_inventory_setting
|
||||
erpnext.patches.v8_9.set_print_zero_amount_taxes
|
||||
erpnext.patches.v12_0.update_is_cancelled_field
|
||||
erpnext.patches.v11_0.rename_production_order_to_work_order
|
||||
erpnext.patches.v11_0.refactor_naming_series
|
||||
erpnext.patches.v11_0.refactor_autoname_naming
|
||||
erpnext.patches.v10_0.rename_schools_to_education
|
||||
erpnext.patches.v4_0.validate_v3_patch
|
||||
erpnext.patches.v4_0.fix_employee_user_id
|
||||
erpnext.patches.v4_0.remove_employee_role_if_no_employee
|
||||
erpnext.patches.v4_0.update_user_properties
|
||||
erpnext.patches.v4_0.apply_user_permissions
|
||||
erpnext.patches.v4_0.move_warehouse_user_to_restrictions
|
||||
erpnext.patches.v4_0.global_defaults_to_system_settings
|
||||
erpnext.patches.v4_0.update_incharge_name_to_sales_person_in_maintenance_schedule
|
||||
execute:frappe.reload_doc("accounts", "doctype", "POS Payment Method") #2020-05-28
|
||||
execute:frappe.reload_doc("HR", "doctype", "HR Settings") #2020-01-16 #2020-07-24
|
||||
execute:frappe.reload_doc('stock', 'doctype', 'warehouse') # 2017-04-24
|
||||
execute:frappe.reload_doc('accounts', 'doctype', 'sales_invoice') # 2016-08-31
|
||||
execute:frappe.reload_doc('selling', 'doctype', 'sales_order') # 2014-01-29
|
||||
execute:frappe.reload_doc('selling', 'doctype', 'quotation') # 2014-01-29
|
||||
execute:frappe.reload_doc('stock', 'doctype', 'delivery_note') # 2014-01-29
|
||||
erpnext.patches.v4_0.reload_sales_print_format
|
||||
execute:frappe.reload_doc('accounts', 'doctype', 'purchase_invoice') # 2014-01-29
|
||||
execute:frappe.reload_doc('buying', 'doctype', 'purchase_order') # 2014-01-29
|
||||
execute:frappe.reload_doc('buying', 'doctype', 'supplier_quotation') # 2014-01-29
|
||||
execute:frappe.reload_doc('stock', 'doctype', 'purchase_receipt') # 2014-01-29
|
||||
execute:frappe.reload_doc('accounts', 'doctype', 'pos_setting') # 2014-01-29
|
||||
execute:frappe.reload_doc('selling', 'doctype', 'customer') # 2014-01-29
|
||||
execute:frappe.reload_doc('buying', 'doctype', 'supplier') # 2014-01-29
|
||||
execute:frappe.reload_doc('accounts', 'doctype', 'asset_category')
|
||||
execute:frappe.reload_doc('accounts', 'doctype', 'pricing_rule')
|
||||
erpnext.patches.v4_0.map_charge_to_taxes_and_charges
|
||||
execute:frappe.reload_doc('support', 'doctype', 'newsletter') # 2014-01-31
|
||||
execute:frappe.reload_doc('hr', 'doctype', 'employee') # 2014-02-03
|
||||
execute:frappe.db.sql("update tabPage set module='Core' where name='Setup'")
|
||||
erpnext.patches.v5_2.change_item_selects_to_checks
|
||||
execute:frappe.reload_doctype('Item')
|
||||
erpnext.patches.v4_0.fields_to_be_renamed
|
||||
erpnext.patches.v4_0.rename_sitemap_to_route
|
||||
erpnext.patches.v7_0.re_route #2016-06-27
|
||||
erpnext.patches.v4_0.fix_contact_address
|
||||
erpnext.patches.v4_0.customer_discount_to_pricing_rule
|
||||
execute:frappe.db.sql("""delete from `tabWebsite Item Group` where ifnull(item_group, '')=''""")
|
||||
erpnext.patches.v4_0.remove_module_home_pages
|
||||
erpnext.patches.v4_0.split_email_settings
|
||||
erpnext.patches.v4_0.import_country_codes
|
||||
erpnext.patches.v4_0.countrywise_coa
|
||||
execute:frappe.delete_doc("DocType", "MIS Control")
|
||||
execute:frappe.delete_doc("Page", "Financial Statements")
|
||||
execute:frappe.delete_doc("DocType", "Stock Ledger")
|
||||
execute:frappe.delete_doc("DocType", "Grade")
|
||||
execute:frappe.db.sql("delete from `tabWebsite Item Group` where ifnull(item_group, '')=''")
|
||||
execute:frappe.delete_doc("Print Format", "SalesInvoice")
|
||||
execute:import frappe.defaults;frappe.defaults.clear_default("price_list_currency")
|
||||
erpnext.patches.v4_0.update_account_root_type
|
||||
execute:frappe.delete_doc("Report", "Purchase In Transit")
|
||||
erpnext.patches.v4_0.new_address_template
|
||||
execute:frappe.delete_doc("DocType", "SMS Control")
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Bulk SMS") #2015-08-18
|
||||
erpnext.patches.v4_0.fix_case_of_hr_module_def
|
||||
erpnext.patches.v4_0.fix_address_template
|
||||
|
||||
# WATCHOUT: This patch reload's documents
|
||||
erpnext.patches.v4_0.reset_permissions_for_masters
|
||||
erpnext.patches.v6_20x.rename_project_name_to_project #2016-03-14
|
||||
|
||||
erpnext.patches.v4_0.update_tax_amount_after_discount
|
||||
execute:frappe.permissions.reset_perms("GL Entry") #2014-06-09
|
||||
execute:frappe.permissions.reset_perms("Stock Ledger Entry") #2014-06-09
|
||||
erpnext.patches.v4_0.create_custom_fields_for_india_specific_fields
|
||||
erpnext.patches.v4_0.save_default_letterhead
|
||||
erpnext.patches.v4_0.update_custom_print_formats_for_renamed_fields
|
||||
erpnext.patches.v4_0.update_other_charges_in_custom_purchase_print_formats
|
||||
erpnext.patches.v4_0.create_price_list_if_missing
|
||||
execute:frappe.db.sql("update `tabItem` set end_of_life=null where end_of_life='0000-00-00'") #2014-06-16
|
||||
erpnext.patches.v4_0.update_users_report_view_settings
|
||||
erpnext.patches.v4_0.set_pricing_rule_for_buying_or_selling
|
||||
erpnext.patches.v4_1.set_outgoing_email_footer
|
||||
erpnext.patches.v4_1.fix_sales_order_delivered_status
|
||||
erpnext.patches.v4_1.fix_delivery_and_billing_status
|
||||
execute:frappe.db.sql("update `tabAccount` set root_type='Liability' where root_type='Income' and report_type='Balance Sheet'")
|
||||
execute:frappe.delete_doc("DocType", "Payment to Invoice Matching Tool") # 29-07-2014
|
||||
execute:frappe.delete_doc("DocType", "Payment to Invoice Matching Tool Detail") # 29-07-2014
|
||||
execute:frappe.delete_doc("Page", "trial-balance") #2014-07-22
|
||||
erpnext.patches.v4_2.delete_old_print_formats #2014-07-29
|
||||
erpnext.patches.v4_2.toggle_rounded_total #2014-07-30
|
||||
erpnext.patches.v4_2.fix_account_master_type
|
||||
erpnext.patches.v4_2.update_project_milestones
|
||||
erpnext.patches.v4_2.add_currency_turkish_lira #2014-08-08
|
||||
execute:frappe.delete_doc("DocType", "Landed Cost Wizard")
|
||||
erpnext.patches.v4_2.default_website_style
|
||||
erpnext.patches.v4_2.set_company_country
|
||||
erpnext.patches.v4_2.update_sales_order_invoice_field_name
|
||||
erpnext.patches.v4_2.seprate_manufacture_and_repack
|
||||
execute:frappe.delete_doc("Report", "Warehouse-Wise Stock Balance")
|
||||
execute:frappe.delete_doc("DocType", "Purchase Request")
|
||||
execute:frappe.delete_doc("DocType", "Purchase Request Item")
|
||||
erpnext.patches.v4_2.recalculate_bom_cost
|
||||
erpnext.patches.v4_2.fix_gl_entries_for_stock_transactions
|
||||
erpnext.patches.v4_2.update_requested_and_ordered_qty #2021-03-31
|
||||
execute:frappe.rename_doc("DocType", "Support Ticket", "Issue", force=True)
|
||||
erpnext.patches.v4_4.make_email_accounts
|
||||
execute:frappe.delete_doc("DocType", "Contact Control")
|
||||
erpnext.patches.v4_2.discount_amount
|
||||
erpnext.patches.v4_2.reset_bom_costs
|
||||
erpnext.patches.v5_0.update_frozen_accounts_permission_role
|
||||
erpnext.patches.v5_0.update_dn_against_doc_fields
|
||||
execute:frappe.db.sql("update `tabMaterial Request` set material_request_type = 'Material Transfer' where material_request_type = 'Transfer'")
|
||||
execute:frappe.reload_doc('stock', 'doctype', 'item')
|
||||
erpnext.patches.v5_0.set_default_company_in_bom
|
||||
execute:frappe.reload_doc('crm', 'doctype', 'lead')
|
||||
execute:frappe.reload_doc('crm', 'doctype', 'opportunity')
|
||||
erpnext.patches.v5_0.rename_taxes_and_charges_master
|
||||
erpnext.patches.v5_1.sales_bom_rename
|
||||
erpnext.patches.v5_0.rename_table_fieldnames
|
||||
execute:frappe.db.sql("update `tabJournal Entry` set voucher_type='Journal Entry' where ifnull(voucher_type, '')=''")
|
||||
erpnext.patches.v5_0.is_group
|
||||
erpnext.patches.v4_2.party_model
|
||||
erpnext.patches.v5_0.party_model_patch_fix
|
||||
erpnext.patches.v4_1.fix_jv_remarks
|
||||
erpnext.patches.v4_2.update_landed_cost_voucher
|
||||
erpnext.patches.v4_2.set_item_has_batch
|
||||
erpnext.patches.v4_2.update_stock_uom_for_dn_in_sle
|
||||
erpnext.patches.v5_0.recalculate_total_amount_in_jv
|
||||
erpnext.patches.v5_0.update_companywise_payment_account
|
||||
erpnext.patches.v5_0.remove_birthday_events
|
||||
erpnext.patches.v5_0.update_item_name_in_bom
|
||||
erpnext.patches.v5_0.rename_customer_issue
|
||||
erpnext.patches.v5_0.rename_total_fields
|
||||
erpnext.patches.v5_0.new_crm_module
|
||||
erpnext.patches.v5_0.rename_customer_issue
|
||||
erpnext.patches.v5_0.update_material_transfer_for_manufacture
|
||||
execute:frappe.reload_doc('crm', 'doctype', 'opportunity_item')
|
||||
erpnext.patches.v5_0.update_item_description_and_image
|
||||
erpnext.patches.v5_0.update_material_transferred_for_manufacturing
|
||||
erpnext.patches.v5_0.stock_entry_update_value
|
||||
erpnext.patches.v5_0.convert_stock_reconciliation
|
||||
erpnext.patches.v5_0.update_projects
|
||||
erpnext.patches.v5_0.item_patches
|
||||
erpnext.patches.v5_0.update_journal_entry_title
|
||||
erpnext.patches.v5_0.taxes_and_totals_in_party_currency
|
||||
erpnext.patches.v5_0.replace_renamed_fields_in_custom_scripts_and_print_formats
|
||||
erpnext.patches.v5_0.update_from_bom
|
||||
erpnext.patches.v5_0.update_account_types
|
||||
erpnext.patches.v5_0.update_sms_sender
|
||||
erpnext.patches.v5_0.set_appraisal_remarks
|
||||
erpnext.patches.v5_0.update_time_log_title
|
||||
erpnext.patches.v7_0.create_warehouse_nestedset
|
||||
erpnext.patches.v7_0.merge_account_type_stock_and_warehouse_to_stock
|
||||
erpnext.patches.v7_0.set_is_group_for_warehouse
|
||||
erpnext.patches.v7_2.stock_uom_in_selling
|
||||
erpnext.patches.v4_2.repost_sle_for_si_with_no_warehouse
|
||||
erpnext.patches.v5_0.newsletter
|
||||
execute:frappe.delete_doc("DocType", "Chart of Accounts")
|
||||
execute:frappe.delete_doc("DocType", "Style Settings")
|
||||
erpnext.patches.v5_0.update_opportunity
|
||||
erpnext.patches.v5_0.opportunity_not_submittable
|
||||
execute:frappe.permissions.reset_perms("Purchase Taxes and Charges Template") #2014-06-09
|
||||
execute:frappe.permissions.reset_perms("Expense Claim Type") #2014-06-19
|
||||
erpnext.patches.v5_0.execute_on_doctype_update
|
||||
erpnext.patches.v4_2.fix_recurring_orders
|
||||
erpnext.patches.v4_2.delete_gl_entries_for_cancelled_invoices
|
||||
erpnext.patches.v5_0.project_costing
|
||||
erpnext.patches.v5_0.update_temporary_account
|
||||
erpnext.patches.v5_0.update_advance_paid
|
||||
erpnext.patches.v5_0.link_warehouse_with_account
|
||||
execute:frappe.delete_doc("Page", "stock-ledger")
|
||||
execute:frappe.delete_doc("Page","stock-level")
|
||||
erpnext.patches.v5_0.reclculate_planned_operating_cost_in_production_order
|
||||
erpnext.patches.v5_0.repost_requested_qty
|
||||
erpnext.patches.v5_0.fix_taxes_and_totals_in_party_currency
|
||||
erpnext.patches.v5_0.update_tax_amount_after_discount_in_purchase_cycle
|
||||
erpnext.patches.v5_0.rename_pos_setting
|
||||
erpnext.patches.v5_0.update_operation_description
|
||||
erpnext.patches.v5_0.set_footer_address
|
||||
execute:frappe.db.set_value("Backup Manager", None, "send_backups_to_dropbox", 1 if frappe.db.get_value("Backup Manager", None, "upload_backups_to_dropbox") in ("Daily", "Weekly") else 0)
|
||||
execute:frappe.db.sql_list("delete from `tabDocPerm` where parent='Issue' and modified_by='Administrator' and role='Guest'")
|
||||
erpnext.patches.v5_0.update_item_and_description_again
|
||||
erpnext.patches.v6_0.multi_currency
|
||||
erpnext.patches.v7_0.create_budget_record
|
||||
erpnext.patches.v5_0.repost_gle_for_jv_with_multiple_party
|
||||
erpnext.patches.v5_0.portal_fixes
|
||||
erpnext.patches.v5_0.reset_values_in_tools # 02-05-2016
|
||||
execute:frappe.delete_doc("Page", "users")
|
||||
erpnext.patches.v5_0.update_material_transferred_for_manufacturing_again
|
||||
erpnext.patches.v5_0.index_on_account_and_gl_entry
|
||||
execute:frappe.db.sql("""delete from `tabProject Task`""")
|
||||
erpnext.patches.v5_0.update_item_desc_in_invoice
|
||||
erpnext.patches.v5_1.fix_against_account
|
||||
execute:frappe.rename_doc("DocType", "Salary Manager", "Process Payroll", force=True)
|
||||
erpnext.patches.v5_1.rename_roles
|
||||
erpnext.patches.v5_1.default_bom
|
||||
execute:frappe.delete_doc("DocType", "Party Type")
|
||||
execute:frappe.delete_doc("Module Def", "Contacts")
|
||||
erpnext.patches.v5_4.fix_reserved_qty_and_sle_for_packed_items # 30-07-2015
|
||||
execute:frappe.reload_doctype("Leave Type")
|
||||
execute:frappe.db.sql("update `tabLeave Type` set include_holiday=0")
|
||||
erpnext.patches.v5_4.set_root_and_report_type
|
||||
erpnext.patches.v5_4.notify_system_managers_regarding_wrong_tax_calculation
|
||||
erpnext.patches.v5_4.fix_invoice_outstanding
|
||||
execute:frappe.db.sql("update `tabStock Ledger Entry` set stock_queue = '[]' where voucher_type = 'Stock Reconciliation' and ifnull(qty_after_transaction, 0) = 0")
|
||||
erpnext.patches.v5_4.fix_missing_item_images
|
||||
erpnext.patches.v5_4.stock_entry_additional_costs
|
||||
erpnext.patches.v5_4.cleanup_journal_entry #2015-08-14
|
||||
erpnext.patches.v5_7.update_item_description_based_on_item_master
|
||||
erpnext.patches.v5_7.item_template_attributes
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Manage Variants")
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Manage Variants Item")
|
||||
erpnext.patches.v4_2.repost_reserved_qty #2021-03-31
|
||||
erpnext.patches.v5_4.update_purchase_cost_against_project
|
||||
erpnext.patches.v5_8.update_order_reference_in_return_entries
|
||||
erpnext.patches.v5_8.add_credit_note_print_heading
|
||||
execute:frappe.delete_doc_if_exists("Print Format", "Credit Note - Negative Invoice")
|
||||
|
||||
# V6.0
|
||||
erpnext.patches.v6_0.set_default_title # 2015-09-03
|
||||
erpnext.patches.v6_0.default_activity_rate
|
||||
execute:frappe.db.set_value("Stock Settings", None, "automatically_set_serial_nos_based_on_fifo", 1)
|
||||
execute:frappe.db.sql("""update `tabProject` set percent_complete=round(percent_complete, 2) where percent_complete is not null""")
|
||||
erpnext.patches.v6_0.fix_outstanding_amount
|
||||
erpnext.patches.v6_0.fix_planned_qty
|
||||
erpnext.patches.v6_2.remove_newsletter_duplicates
|
||||
erpnext.patches.v6_2.fix_missing_default_taxes_and_lead
|
||||
erpnext.patches.v6_3.convert_applicable_territory
|
||||
erpnext.patches.v6_4.round_status_updater_percentages
|
||||
erpnext.patches.v6_4.repost_gle_for_journal_entries_where_reference_name_missing
|
||||
erpnext.patches.v6_4.fix_journal_entries_due_to_reconciliation
|
||||
erpnext.patches.v6_4.fix_status_in_sales_and_purchase_order
|
||||
erpnext.patches.v6_4.fix_modified_in_sales_order_and_purchase_order
|
||||
erpnext.patches.v6_4.fix_duplicate_bins
|
||||
erpnext.patches.v6_4.fix_sales_order_maintenance_status
|
||||
erpnext.patches.v6_4.email_digest_update
|
||||
|
||||
# delete shopping cart doctypes
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Applicable Territory")
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Shopping Cart Price List")
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Shopping Cart Taxes and Charges Master")
|
||||
|
||||
erpnext.patches.v6_4.set_user_in_contact
|
||||
erpnext.patches.v6_4.make_image_thumbnail #2015-10-20
|
||||
erpnext.patches.v6_5.show_in_website_for_template_item
|
||||
erpnext.patches.v6_4.fix_expense_included_in_valuation
|
||||
execute:frappe.delete_doc_if_exists("Report", "Item-wise Last Purchase Rate")
|
||||
erpnext.patches.v6_6.fix_website_image
|
||||
erpnext.patches.v6_6.remove_fiscal_year_from_leave_allocation
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Stock UOM Replace Utility")
|
||||
erpnext.patches.v6_8.make_webform_standard #2015-11-23
|
||||
erpnext.patches.v6_8.move_drop_ship_to_po_items
|
||||
erpnext.patches.v6_10.fix_ordered_received_billed
|
||||
erpnext.patches.v6_10.fix_jv_total_amount #2015-11-30
|
||||
erpnext.patches.v6_10.email_digest_default_quote
|
||||
erpnext.patches.v6_10.fix_billed_amount_in_drop_ship_po
|
||||
erpnext.patches.v6_10.fix_delivery_status_of_drop_ship_item #2015-12-08
|
||||
erpnext.patches.v5_8.tax_rule #2015-12-08
|
||||
erpnext.patches.v6_12.set_overdue_tasks
|
||||
erpnext.patches.v6_16.update_billing_status_in_dn_and_pr
|
||||
erpnext.patches.v6_16.create_manufacturer_records
|
||||
execute:frappe.db.sql("update `tabPricing Rule` set title=name where title='' or title is null") #2016-01-27
|
||||
erpnext.patches.v6_20.set_party_account_currency_in_orders
|
||||
erpnext.patches.v6_19.comment_feed_communication
|
||||
erpnext.patches.v6_21.fix_reorder_level
|
||||
erpnext.patches.v6_21.rename_material_request_fields
|
||||
erpnext.patches.v6_23.update_stopped_status_to_closed
|
||||
erpnext.patches.v6_24.set_recurring_id
|
||||
erpnext.patches.v6_20x.set_compact_print
|
||||
execute:frappe.delete_doc_if_exists("Web Form", "contact") #2016-03-10
|
||||
erpnext.patches.v6_20x.remove_fiscal_year_from_holiday_list
|
||||
erpnext.patches.v6_24.map_customer_address_to_shipping_address_on_po
|
||||
erpnext.patches.v6_27.fix_recurring_order_status
|
||||
erpnext.patches.v6_20x.update_product_bundle_description
|
||||
erpnext.patches.v7_0.update_party_status #2016-09-22
|
||||
erpnext.patches.v7_0.remove_features_setup
|
||||
erpnext.patches.v7_0.update_home_page
|
||||
execute:frappe.delete_doc_if_exists("Page", "financial-analytics")
|
||||
erpnext.patches.v7_0.update_project_in_gl_entry
|
||||
execute:frappe.db.sql('update tabQuotation set status="Cancelled" where docstatus=2')
|
||||
execute:frappe.rename_doc("DocType", "Payments", "Sales Invoice Payment", force=True)
|
||||
erpnext.patches.v7_0.update_mins_to_first_response
|
||||
erpnext.patches.v6_20x.repost_valuation_rate_for_negative_inventory
|
||||
erpnext.patches.v7_0.migrate_mode_of_payments_v6_to_v7
|
||||
erpnext.patches.v7_0.system_settings_setup_complete
|
||||
erpnext.patches.v7_0.set_naming_series_for_timesheet #2016-07-27
|
||||
execute:frappe.reload_doc('projects', 'doctype', 'project')
|
||||
execute:frappe.reload_doc('projects', 'doctype', 'project_user')
|
||||
erpnext.patches.v7_0.convert_timelogbatch_to_timesheet
|
||||
erpnext.patches.v7_0.convert_timelog_to_timesheet
|
||||
erpnext.patches.v7_0.move_timelogbatch_from_salesinvoiceitem_to_salesinvoicetimesheet
|
||||
erpnext.patches.v7_0.remove_doctypes_and_reports #2016-10-29
|
||||
erpnext.patches.v7_0.update_maintenance_module_in_doctype
|
||||
erpnext.patches.v7_0.update_prevdoc_values_for_supplier_quotation_item
|
||||
erpnext.patches.v7_0.rename_advance_table_fields
|
||||
erpnext.patches.v7_0.rename_salary_components
|
||||
erpnext.patches.v7_0.rename_prevdoc_fields
|
||||
erpnext.patches.v7_0.rename_time_sheet_doctype
|
||||
execute:frappe.delete_doc_if_exists("Report", "Customers Not Buying Since Long Time")
|
||||
erpnext.patches.v7_0.make_is_group_fieldtype_as_check
|
||||
execute:frappe.reload_doc('projects', 'doctype', 'timesheet') #2016-09-12
|
||||
erpnext.patches.v7_1.rename_field_timesheet
|
||||
execute:frappe.delete_doc_if_exists("Report", "Employee Holiday Attendance")
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Payment Tool")
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Payment Tool Detail")
|
||||
erpnext.patches.v7_0.setup_account_table_for_expense_claim_type_if_exists
|
||||
erpnext.patches.v7_0.migrate_schools_to_erpnext
|
||||
erpnext.patches.v7_1.update_lead_source
|
||||
erpnext.patches.v6_20x.remove_customer_supplier_roles
|
||||
erpnext.patches.v7_0.remove_administrator_role_in_doctypes
|
||||
erpnext.patches.v7_0.rename_fee_amount_to_fee_component
|
||||
erpnext.patches.v7_0.calculate_total_costing_amount
|
||||
erpnext.patches.v7_0.fix_nonwarehouse_ledger_gl_entries_for_transactions
|
||||
erpnext.patches.v7_0.remove_old_earning_deduction_doctypes
|
||||
erpnext.patches.v7_0.make_guardian
|
||||
erpnext.patches.v7_0.update_refdoc_in_landed_cost_voucher
|
||||
erpnext.patches.v7_0.set_material_request_type_in_item
|
||||
erpnext.patches.v7_0.rename_examination_to_assessment
|
||||
erpnext.patches.v7_0.set_portal_settings
|
||||
erpnext.patches.v7_0.update_change_amount_account
|
||||
erpnext.patches.v7_0.fix_duplicate_icons
|
||||
erpnext.patches.v7_0.repost_gle_for_pos_sales_return
|
||||
erpnext.patches.v7_1.update_total_billing_hours
|
||||
erpnext.patches.v7_1.update_component_type
|
||||
erpnext.patches.v7_0.repost_gle_for_pos_sales_return
|
||||
erpnext.patches.v7_0.update_missing_employee_in_timesheet
|
||||
erpnext.patches.v7_0.update_status_for_timesheet
|
||||
erpnext.patches.v7_0.set_party_name_in_payment_entry
|
||||
erpnext.patches.v7_1.set_student_guardian
|
||||
erpnext.patches.v7_0.update_conversion_factor_in_supplier_quotation_item
|
||||
erpnext.patches.v7_1.move_sales_invoice_from_parent_to_child_timesheet
|
||||
execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null")
|
||||
erpnext.patches.v7_1.fix_link_for_customer_from_lead
|
||||
execute:frappe.db.sql("delete from `tabTimesheet Detail` where NOT EXISTS (select name from `tabTimesheet` where name = `tabTimesheet Detail`.parent)")
|
||||
erpnext.patches.v7_0.update_mode_of_payment_type
|
||||
|
||||
execute:frappe.reload_doctype('Employee') #2016-10-18
|
||||
execute:frappe.db.sql("update `tabEmployee` set prefered_contact_email = IFNULL(prefered_contact_email,'') ")
|
||||
execute:frappe.reload_doc("Payroll", "doctype", "salary_slip")
|
||||
execute:frappe.db.sql("update `tabSalary Slip` set posting_date=creation")
|
||||
execute:frappe.reload_doc("stock", "doctype", "stock_settings")
|
||||
erpnext.patches.v8_0.create_domain_docs #16-05-2017
|
||||
erpnext.patches.v7_1.update_portal_roles
|
||||
erpnext.patches.v7_1.set_total_amount_currency_in_je
|
||||
finally:erpnext.patches.v7_0.update_timesheet_communications
|
||||
erpnext.patches.v7_0.update_status_of_zero_amount_sales_order
|
||||
erpnext.patches.v7_1.add_field_for_task_dependent
|
||||
erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
|
||||
erpnext.patches.v7_1.set_prefered_contact_email
|
||||
execute:frappe.reload_doc('accounts', 'doctype', 'accounts_settings')
|
||||
execute:frappe.db.set_value("Accounts Settings", "Accounts Settings", "unlink_payment_on_cancellation_of_invoice", 0)
|
||||
execute:frappe.db.sql("update `tabStock Entry` set total_amount = 0 where purpose in('Repack', 'Manufacture')")
|
||||
erpnext.patches.v7_1.save_stock_settings
|
||||
erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
|
||||
erpnext.patches.v7_1.add_account_user_role_for_timesheet
|
||||
erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table
|
||||
erpnext.patches.v7_1.update_invoice_status
|
||||
erpnext.patches.v7_0.po_status_issue_for_pr_return
|
||||
erpnext.patches.v7_1.update_missing_salary_component_type
|
||||
erpnext.patches.v7_1.rename_quality_inspection_field
|
||||
erpnext.patches.v7_0.update_autoname_field
|
||||
erpnext.patches.v7_1.update_bom_base_currency
|
||||
erpnext.patches.v7_0.update_status_of_po_so
|
||||
erpnext.patches.v7_1.set_budget_against_as_cost_center
|
||||
erpnext.patches.v7_1.set_currency_exchange_date
|
||||
erpnext.patches.v7_1.set_sales_person_status
|
||||
erpnext.patches.v7_1.repost_stock_for_deleted_bins_for_merging_items
|
||||
erpnext.patches.v7_2.update_website_for_variant
|
||||
erpnext.patches.v7_2.update_assessment_modules
|
||||
erpnext.patches.v7_2.update_doctype_status
|
||||
erpnext.patches.v7_2.update_salary_slips
|
||||
erpnext.patches.v7_2.delete_fleet_management_module_def
|
||||
erpnext.patches.v7_2.contact_address_links
|
||||
erpnext.patches.v7_2.mark_students_active
|
||||
erpnext.patches.v7_2.set_null_value_to_fields
|
||||
erpnext.patches.v7_2.update_guardian_name_in_student_master
|
||||
erpnext.patches.v7_2.update_abbr_in_salary_slips
|
||||
erpnext.patches.v7_2.rename_evaluation_criteria
|
||||
erpnext.patches.v7_2.update_party_type
|
||||
erpnext.patches.v7_2.setup_auto_close_settings
|
||||
erpnext.patches.v7_2.empty_supplied_items_for_non_subcontracted
|
||||
erpnext.patches.v7_2.arrear_leave_encashment_as_salary_component
|
||||
erpnext.patches.v7_2.rename_att_date_attendance
|
||||
erpnext.patches.v7_2.update_attendance_docstatus
|
||||
erpnext.patches.v7_2.make_all_assessment_group
|
||||
erpnext.patches.v8_0.repost_reserved_qty_for_multiple_sales_uom
|
||||
erpnext.patches.v8_0.addresses_linked_to_lead
|
||||
execute:frappe.delete_doc('DocType', 'Purchase Common')
|
||||
erpnext.patches.v8_0.update_stock_qty_value_in_purchase_invoice
|
||||
erpnext.patches.v8_0.update_supplier_address_in_stock_entry
|
||||
erpnext.patches.v8_0.rename_is_sample_item_to_allow_zero_valuation_rate
|
||||
erpnext.patches.v8_0.set_null_to_serial_nos_for_disabled_sales_invoices
|
||||
erpnext.patches.v8_0.enable_booking_asset_depreciation_automatically
|
||||
erpnext.patches.v8_0.set_project_copied_from
|
||||
erpnext.patches.v8_0.update_status_as_paid_for_completed_expense_claim
|
||||
erpnext.patches.v7_2.stock_uom_in_selling
|
||||
erpnext.patches.v8_0.revert_manufacturers_table_from_item
|
||||
erpnext.patches.v8_0.disable_instructor_role
|
||||
erpnext.patches.v8_0.merge_student_batch_and_student_group
|
||||
erpnext.patches.v8_0.rename_total_margin_to_rate_with_margin # 11-05-2017
|
||||
erpnext.patches.v8_0.fix_status_for_invoices_with_negative_outstanding
|
||||
erpnext.patches.v8_0.make_payments_table_blank_for_non_pos_invoice
|
||||
erpnext.patches.v8_0.set_sales_invoice_serial_number_from_delivery_note
|
||||
erpnext.patches.v8_0.delete_schools_depricated_doctypes
|
||||
erpnext.patches.v8_0.update_customer_pos_id
|
||||
erpnext.patches.v8_0.rename_items_in_status_field_of_material_request
|
||||
erpnext.patches.v8_0.delete_bin_indexes
|
||||
erpnext.patches.v8_0.move_account_head_from_account_to_warehouse_for_inventory
|
||||
erpnext.patches.v8_0.change_in_words_varchar_length
|
||||
erpnext.patches.v8_0.update_stock_qty_value_in_bom_item
|
||||
erpnext.patches.v8_0.update_sales_cost_in_project
|
||||
erpnext.patches.v8_0.save_system_settings
|
||||
erpnext.patches.v8_1.delete_deprecated_reports
|
||||
erpnext.patches.v9_0.remove_subscription_module
|
||||
erpnext.patches.v8_7.make_subscription_from_recurring_data
|
||||
erpnext.patches.v8_1.setup_gst_india #2017-06-27
|
||||
execute:frappe.reload_doc('regional', 'doctype', 'gst_hsn_code')
|
||||
erpnext.patches.v8_1.removed_roles_from_gst_report_non_indian_account #16-08-2018
|
||||
erpnext.patches.v8_1.gst_fixes #2017-07-06
|
||||
erpnext.patches.v8_0.update_production_orders
|
||||
erpnext.patches.v8_1.remove_sales_invoice_from_returned_serial_no
|
||||
erpnext.patches.v8_1.allow_invoice_copy_to_edit_after_submit
|
||||
erpnext.patches.v8_1.add_hsn_sac_codes
|
||||
erpnext.patches.v8_1.update_gst_state #17-07-2017
|
||||
erpnext.patches.v8_1.removed_report_support_hours
|
||||
erpnext.patches.v8_1.add_indexes_in_transaction_doctypes
|
||||
erpnext.patches.v8_3.set_restrict_to_domain_for_module_def
|
||||
erpnext.patches.v8_1.update_expense_claim_status
|
||||
erpnext.patches.v8_3.update_company_total_sales #2017-08-16
|
||||
erpnext.patches.v8_4.make_scorecard_records
|
||||
erpnext.patches.v8_1.set_delivery_date_in_so_item #2017-07-28
|
||||
erpnext.patches.v8_5.fix_tax_breakup_for_non_invoice_docs
|
||||
erpnext.patches.v8_5.remove_quotations_route_in_sidebar
|
||||
erpnext.patches.v8_5.update_existing_data_in_project_type
|
||||
erpnext.patches.v8_5.set_default_mode_of_payment
|
||||
erpnext.patches.v8_5.update_customer_group_in_POS_profile
|
||||
erpnext.patches.v8_6.update_timesheet_company_from_PO
|
||||
erpnext.patches.v8_6.set_write_permission_for_quotation_for_sales_manager
|
||||
erpnext.patches.v8_5.remove_project_type_property_setter
|
||||
erpnext.patches.v8_7.sync_india_custom_fields
|
||||
erpnext.patches.v8_7.fix_purchase_receipt_status
|
||||
erpnext.patches.v8_6.rename_bom_update_tool
|
||||
erpnext.patches.v8_9.add_setup_progress_actions #08-09-2017 #26-09-2017 #22-11-2017 #15-12-2017
|
||||
erpnext.patches.v8_9.rename_company_sales_target_field
|
||||
erpnext.patches.v8_8.set_bom_rate_as_per_uom
|
||||
erpnext.patches.v8_8.add_new_fields_in_accounts_settings
|
||||
erpnext.patches.v8_9.set_default_customer_group
|
||||
erpnext.patches.v8_9.delete_gst_doctypes_for_outside_india_accounts
|
||||
erpnext.patches.v8_9.set_default_fields_in_variant_settings
|
||||
erpnext.patches.v8_9.update_billing_gstin_for_indian_account
|
||||
erpnext.patches.v8_9.set_member_party_type
|
||||
erpnext.patches.v9_0.add_user_to_child_table_in_pos_profile
|
||||
erpnext.patches.v9_0.set_schedule_date_for_material_request_and_purchase_order
|
||||
erpnext.patches.v9_0.student_admission_childtable_migrate
|
||||
erpnext.patches.v9_0.add_healthcare_domain
|
||||
erpnext.patches.v9_0.set_variant_item_description
|
||||
erpnext.patches.v9_0.set_uoms_in_variant_field
|
||||
erpnext.patches.v9_0.copy_old_fees_field_data
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Program Fee")
|
||||
erpnext.patches.v9_0.set_pos_profile_name
|
||||
erpnext.patches.v9_0.remove_non_existing_warehouse_from_stock_settings
|
||||
execute:frappe.delete_doc_if_exists("DocType", "Program Fee")
|
||||
erpnext.patches.v8_10.change_default_customer_credit_days
|
||||
erpnext.patches.v9_0.update_employee_loan_details
|
||||
erpnext.patches.v9_2.delete_healthcare_domain_default_items
|
||||
erpnext.patches.v9_1.create_issue_opportunity_type
|
||||
erpnext.patches.v9_2.rename_translated_domains_in_en
|
||||
erpnext.patches.v9_0.set_shipping_type_for_existing_shipping_rules
|
||||
erpnext.patches.v9_0.update_multi_uom_fields_in_material_request
|
||||
erpnext.patches.v9_2.repost_reserved_qty_for_production
|
||||
erpnext.patches.v9_2.remove_company_from_patient
|
||||
erpnext.patches.v9_2.set_item_name_in_production_order
|
||||
erpnext.patches.v10_0.update_lft_rgt_for_employee
|
||||
erpnext.patches.v9_2.rename_net_weight_in_item_master
|
||||
erpnext.patches.v9_2.delete_process_payroll
|
||||
erpnext.patches.v10_0.add_agriculture_domain
|
||||
erpnext.patches.v10_0.add_non_profit_domain
|
||||
erpnext.patches.v10_0.setup_vat_for_uae_and_saudi_arabia #2017-12-28
|
||||
erpnext.patches.v10_0.set_primary_contact_for_customer
|
||||
erpnext.patches.v10_0.copy_projects_renamed_fields
|
||||
erpnext.patches.v10_0.enabled_regional_print_format_based_on_country
|
||||
erpnext.patches.v10_0.update_asset_calculate_depreciation
|
||||
erpnext.patches.v10_0.add_guardian_role_for_parent_portal
|
||||
erpnext.patches.v10_0.set_numeric_ranges_in_template_if_blank
|
||||
erpnext.patches.v10_0.update_reserved_qty_for_purchase_order
|
||||
erpnext.patches.v10_0.fichier_des_ecritures_comptables_for_france
|
||||
erpnext.patches.v10_0.update_assessment_plan
|
||||
erpnext.patches.v10_0.update_assessment_result
|
||||
erpnext.patches.v10_0.set_default_payment_terms_based_on_company
|
||||
erpnext.patches.v10_0.update_sales_order_link_to_purchase_order
|
||||
erpnext.patches.v10_0.rename_price_to_rate_in_pricing_rule
|
||||
erpnext.patches.v10_0.set_currency_in_pricing_rule
|
||||
erpnext.patches.v10_0.set_b2c_limit
|
||||
erpnext.patches.v10_0.update_translatable_fields
|
||||
erpnext.patches.v10_0.rename_offer_letter_to_job_offer
|
||||
execute:frappe.delete_doc('DocType', 'Production Planning Tool', ignore_missing=True)
|
||||
@ -496,16 +21,6 @@ erpnext.patches.v10_0.migrate_daily_work_summary_settings_to_daily_work_summary_
|
||||
erpnext.patches.v10_0.add_default_cash_flow_mappers
|
||||
erpnext.patches.v11_0.rename_duplicate_item_code_values
|
||||
erpnext.patches.v11_0.make_quality_inspection_template
|
||||
erpnext.patches.v10_0.update_status_for_multiple_source_in_po
|
||||
erpnext.patches.v10_0.set_auto_created_serial_no_in_stock_entry
|
||||
erpnext.patches.v10_0.update_territory_and_customer_group
|
||||
erpnext.patches.v10_0.update_warehouse_address_details
|
||||
erpnext.patches.v10_0.update_reserved_qty_for_purchase_order
|
||||
erpnext.patches.v10_0.update_hub_connector_domain
|
||||
erpnext.patches.v10_0.set_student_party_type
|
||||
erpnext.patches.v10_0.update_project_in_sle
|
||||
erpnext.patches.v10_0.fix_reserved_qty_for_sub_contract
|
||||
erpnext.patches.v10_0.repost_requested_qty_for_non_stock_uom_items
|
||||
erpnext.patches.v11_0.merge_land_unit_with_location
|
||||
erpnext.patches.v11_0.add_index_on_nestedset_doctypes
|
||||
erpnext.patches.v11_0.remove_modules_setup_page
|
||||
@ -514,7 +29,6 @@ erpnext.patches.v11_0.update_department_lft_rgt
|
||||
erpnext.patches.v11_0.add_default_email_template_for_leave
|
||||
erpnext.patches.v11_0.set_default_email_template_in_hr #08-06-2018
|
||||
erpnext.patches.v11_0.uom_conversion_data #30-06-2018
|
||||
erpnext.patches.v10_0.taxes_issue_with_pos
|
||||
erpnext.patches.v11_0.update_account_type_in_party_type
|
||||
erpnext.patches.v11_0.rename_healthcare_doctype_and_fields
|
||||
erpnext.patches.v11_0.rename_supplier_type_to_supplier_group
|
||||
@ -522,8 +36,6 @@ erpnext.patches.v10_1.transfer_subscription_to_auto_repeat
|
||||
erpnext.patches.v11_0.update_brand_in_item_price
|
||||
erpnext.patches.v11_0.create_default_success_action
|
||||
erpnext.patches.v11_0.add_healthcare_service_unit_tree_root
|
||||
erpnext.patches.v10_0.set_qty_in_transactions_based_on_serial_no_input
|
||||
erpnext.patches.v10_0.show_leaves_of_all_department_members_in_calendar
|
||||
erpnext.patches.v11_0.rename_field_max_days_allowed
|
||||
erpnext.patches.v11_0.create_salary_structure_assignments
|
||||
erpnext.patches.v11_0.rename_health_insurance
|
||||
@ -536,7 +48,6 @@ erpnext.patches.v11_0.move_item_defaults_to_child_table_for_multicompany #02-07-
|
||||
erpnext.patches.v11_0.refactor_erpnext_shopify #2018-09-07
|
||||
erpnext.patches.v11_0.rename_overproduction_percent_field
|
||||
erpnext.patches.v11_0.update_backflush_subcontract_rm_based_on_bom
|
||||
erpnext.patches.v10_0.update_status_in_purchase_receipt
|
||||
erpnext.patches.v11_0.inter_state_field_for_gst
|
||||
erpnext.patches.v11_0.rename_members_with_naming_series #04-06-2018
|
||||
erpnext.patches.v11_0.set_update_field_and_value_in_workflow_state
|
||||
@ -550,13 +61,10 @@ erpnext.patches.v11_0.skip_user_permission_check_for_department
|
||||
erpnext.patches.v11_0.set_department_for_doctypes
|
||||
erpnext.patches.v11_0.update_allow_transfer_for_manufacture
|
||||
erpnext.patches.v11_0.add_item_group_defaults
|
||||
erpnext.patches.v10_0.update_address_template_for_india
|
||||
erpnext.patches.v11_0.add_expense_claim_default_account
|
||||
execute:frappe.delete_doc("Page", "hub")
|
||||
erpnext.patches.v11_0.reset_publish_in_hub_for_all_items
|
||||
erpnext.patches.v11_0.update_hub_url # 2018-08-31 # 2018-09-03
|
||||
erpnext.patches.v10_0.set_discount_amount
|
||||
erpnext.patches.v10_0.recalculate_gross_margin_for_project
|
||||
erpnext.patches.v11_0.make_job_card
|
||||
erpnext.patches.v11_0.redesign_healthcare_billing_work_flow
|
||||
erpnext.patches.v10_0.delete_hub_documents # 12-08-2018
|
||||
@ -570,9 +78,6 @@ execute:frappe.delete_doc_if_exists("Page", "stock-analytics")
|
||||
execute:frappe.delete_doc_if_exists("Page", "production-analytics")
|
||||
erpnext.patches.v11_0.ewaybill_fields_gst_india #2018-11-13 #2019-01-09 #2019-04-01 #2019-04-26 #2019-05-03
|
||||
erpnext.patches.v11_0.drop_column_max_days_allowed
|
||||
erpnext.patches.v10_0.update_user_image_in_employee
|
||||
erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items
|
||||
erpnext.patches.v10_0.allow_operators_in_supplier_scorecard
|
||||
erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019
|
||||
erpnext.patches.v11_0.update_delivery_trip_status
|
||||
erpnext.patches.v11_0.set_missing_gst_hsn_code
|
||||
|
@ -1,13 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
from erpnext.stock.stock_balance import set_stock_balance_as_per_serial_no
|
||||
frappe.db.auto_commit_on_many_writes = 1
|
||||
|
||||
set_stock_balance_as_per_serial_no()
|
||||
|
||||
frappe.db.auto_commit_on_many_writes = 0
|
@ -1,13 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
domain = 'Agriculture'
|
||||
if not frappe.db.exists('Domain', domain):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Domain',
|
||||
'domain': domain
|
||||
}).insert(ignore_permissions=True)
|
@ -1,23 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
# create guardian role
|
||||
if not frappe.get_value('Role', dict(role_name='Guardian')):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Role',
|
||||
'role_name': 'Guardian',
|
||||
'desk_access': 0,
|
||||
'restrict_to_domain': 'Education'
|
||||
}).insert(ignore_permissions=True)
|
||||
|
||||
# set guardian roles in already created users
|
||||
if frappe.db.exists("Doctype", "Guardian"):
|
||||
for user in frappe.db.sql_list("""select u.name from `tabUser` u , `tabGuardian` g where g.email_address = u.name"""):
|
||||
user = frappe.get_doc('User', user)
|
||||
user.flags.ignore_validate = True
|
||||
user.flags.ignore_mandatory = True
|
||||
user.save()
|
@ -1,20 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
domain = 'Non Profit'
|
||||
if not frappe.db.exists('Domain', domain):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Domain',
|
||||
'domain': domain
|
||||
}).insert(ignore_permissions=True)
|
||||
|
||||
frappe.get_doc({
|
||||
'doctype': 'Role',
|
||||
'role_name': 'Non Profit Portal User',
|
||||
'desk_access': 0,
|
||||
'restrict_to_domain': domain
|
||||
}).insert(ignore_permissions=True)
|
@ -1,23 +0,0 @@
|
||||
# Copyright (c) 2019, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('buying', 'doctype', 'supplier_scorecard_criteria')
|
||||
frappe.reload_doc('buying', 'doctype', 'supplier_scorecard_scoring_criteria')
|
||||
frappe.reload_doc('buying', 'doctype', 'supplier_scorecard')
|
||||
|
||||
for criteria in frappe.get_all('Supplier Scorecard Criteria', fields=['name', 'formula'], limit_page_length=None):
|
||||
frappe.db.set_value('Supplier Scorecard Criteria', criteria.name,
|
||||
'formula', criteria.formula.replace('<','<').replace('>','>'))
|
||||
|
||||
for criteria in frappe.get_all('Supplier Scorecard Scoring Criteria', fields=['name', 'formula'], limit_page_length=None):
|
||||
if criteria.formula: # not mandatory
|
||||
frappe.db.set_value('Supplier Scorecard Scoring Criteria', criteria.name,
|
||||
'formula', criteria.formula.replace('<','<').replace('>','>'))
|
||||
|
||||
for sc in frappe.get_all('Supplier Scorecard', fields=['name', 'weighting_function'], limit_page_length=None):
|
||||
frappe.db.set_value('Supplier Scorecard', sc.name, 'weighting_function',
|
||||
sc.weighting_function.replace('<','<').replace('>','>'))
|
@ -1,13 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
def execute():
|
||||
""" copy data from old fields to new """
|
||||
frappe.reload_doc("projects", "doctype", "project")
|
||||
|
||||
if frappe.db.has_column('Project', 'total_sales_cost'):
|
||||
rename_field('Project', "total_sales_cost", "total_sales_amount")
|
||||
|
||||
if frappe.db.has_column('Project', 'total_billing_amount'):
|
||||
rename_field('Project', "total_billing_amount", "total_billable_amount")
|
@ -1,22 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
print_format_mapper = {
|
||||
'India': ['GST POS Invoice', 'GST Tax Invoice'],
|
||||
'Saudi Arabia': ['Simplified Tax Invoice', 'Detailed Tax Invoice', 'Tax Invoice'],
|
||||
'United Arab Emirates': ['Simplified Tax Invoice', 'Detailed Tax Invoice', 'Tax Invoice']
|
||||
}
|
||||
|
||||
frappe.db.sql(""" update `tabPrint Format` set disabled = 1 where name
|
||||
in ('GST POS Invoice', 'GST Tax Invoice', 'Simplified Tax Invoice', 'Detailed Tax Invoice')""")
|
||||
|
||||
for d in frappe.get_all('Company', fields = ["country"],
|
||||
filters={'country': ('in', ['India', 'Saudi Arabia', 'United Arab Emirates'])}):
|
||||
if print_format_mapper.get(d.country):
|
||||
print_formats = print_format_mapper.get(d.country)
|
||||
frappe.db.sql(""" update `tabPrint Format` set disabled = 0
|
||||
where name in (%s)""" % ", ".join(["%s"]*len(print_formats)), tuple(print_formats))
|
@ -1,31 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.stock.utils import get_bin
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("stock", "doctype", "bin")
|
||||
frappe.reload_doc("buying", "doctype", "purchase_order_item_supplied")
|
||||
for d in frappe.db.sql("""
|
||||
select distinct rm_item_code, reserve_warehouse
|
||||
from `tabPurchase Order Item Supplied`
|
||||
where docstatus=1 and reserve_warehouse is not null and reserve_warehouse != ''"""):
|
||||
|
||||
try:
|
||||
bin_doc = get_bin(d[0], d[1])
|
||||
bin_doc.update_reserved_qty_for_sub_contracting()
|
||||
except:
|
||||
pass
|
||||
|
||||
for d in frappe.db.sql("""select distinct item_code, source_warehouse
|
||||
from `tabWork Order Item`
|
||||
where docstatus=1 and transferred_qty > required_qty
|
||||
and source_warehouse is not null and source_warehouse != ''""", as_list=1):
|
||||
|
||||
try:
|
||||
bin_doc = get_bin(d[0], d[1])
|
||||
bin_doc.update_reserved_qty_for_production()
|
||||
except:
|
||||
pass
|
@ -1,14 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('projects', 'doctype', 'project')
|
||||
for d in frappe.db.sql(""" select name from `tabProject` where
|
||||
ifnull(total_consumed_material_cost, 0 ) > 0 and ifnull(total_billed_amount, 0) > 0""", as_dict=1):
|
||||
doc = frappe.get_doc("Project", d.name)
|
||||
doc.calculate_gross_margin()
|
||||
doc.db_set('gross_margin', doc.gross_margin)
|
||||
doc.db_set('per_gross_margin', doc.per_gross_margin)
|
@ -1,32 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
# rename the School module as Education
|
||||
|
||||
# rename the school module
|
||||
if frappe.db.exists('Module Def', 'Schools') and not frappe.db.exists('Module Def', 'Education'):
|
||||
frappe.rename_doc("Module Def", "Schools", "Education")
|
||||
|
||||
# delete the school module
|
||||
if frappe.db.exists('Module Def', 'Schools') and frappe.db.exists('Module Def', 'Education'):
|
||||
frappe.db.sql("""delete from `tabModule Def` where module_name = 'Schools'""")
|
||||
|
||||
|
||||
# rename "School Settings" to the "Education Settings
|
||||
if frappe.db.exists('DocType', 'School Settings'):
|
||||
frappe.rename_doc("DocType", "School Settings", "Education Settings", force=True)
|
||||
frappe.reload_doc("education", "doctype", "education_settings")
|
||||
|
||||
# delete the discussion web form if exists
|
||||
if frappe.db.exists('Web Form', 'Discussion'):
|
||||
frappe.db.sql("""delete from `tabWeb Form` where name = 'discussion'""")
|
||||
|
||||
# rename the select option field from "School Bus" to "Institute's Bus"
|
||||
frappe.reload_doc("education", "doctype", "Program Enrollment")
|
||||
if "mode_of_transportation" in frappe.db.get_table_columns("Program Enrollment"):
|
||||
frappe.db.sql("""update `tabProgram Enrollment` set mode_of_transportation = "Institute's Bus"
|
||||
where mode_of_transportation = "School Bus" """)
|
@ -1,32 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe, erpnext
|
||||
|
||||
def execute():
|
||||
for company in frappe.get_all("Company"):
|
||||
if not erpnext.is_perpetual_inventory_enabled(company.name):
|
||||
continue
|
||||
|
||||
acc_frozen_upto = frappe.db.get_value("Accounts Settings", None, "acc_frozen_upto") or "1900-01-01"
|
||||
pr_with_rejected_warehouse = frappe.db.sql("""
|
||||
select pr.name
|
||||
from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
|
||||
where pr.name = pr_item.parent
|
||||
and pr.posting_date > %s
|
||||
and pr.docstatus=1
|
||||
and pr.company = %s
|
||||
and pr_item.rejected_qty > 0
|
||||
""", (acc_frozen_upto, company.name), as_dict=1)
|
||||
|
||||
for d in pr_with_rejected_warehouse:
|
||||
doc = frappe.get_doc("Purchase Receipt", d.name)
|
||||
|
||||
doc.docstatus = 2
|
||||
doc.make_gl_entries_on_cancel()
|
||||
|
||||
|
||||
# update gl entries for submit state of PR
|
||||
doc.docstatus = 1
|
||||
doc.make_gl_entries()
|
@ -1,21 +0,0 @@
|
||||
# Copyright (c) 2019, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty
|
||||
|
||||
count=0
|
||||
for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse
|
||||
from `tabMaterial Request Item` where docstatus = 1 and stock_uom<>uom"""):
|
||||
try:
|
||||
count += 1
|
||||
update_bin_qty(item_code, warehouse, {
|
||||
"indented_qty": get_indented_qty(item_code, warehouse),
|
||||
})
|
||||
if count % 200 == 0:
|
||||
frappe.db.commit()
|
||||
except:
|
||||
frappe.db.rollback()
|
@ -1,56 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
serialised_items = [d.name for d in frappe.get_all("Item", filters={"has_serial_no": 1})]
|
||||
|
||||
if not serialised_items:
|
||||
return
|
||||
|
||||
for dt in ["Stock Entry Detail", "Purchase Receipt Item", "Purchase Invoice Item"]:
|
||||
cond = ""
|
||||
if dt=="Purchase Invoice Item":
|
||||
cond = """ and parent in (select name from `tabPurchase Invoice`
|
||||
where `tabPurchase Invoice`.name = `tabPurchase Invoice Item`.parent and update_stock=1)"""
|
||||
|
||||
item_rows = frappe.db.sql("""
|
||||
select name
|
||||
from `tab{0}`
|
||||
where conversion_factor != 1
|
||||
and docstatus = 1
|
||||
and ifnull(serial_no, '') = ''
|
||||
and item_code in ({1})
|
||||
{2}
|
||||
""".format(dt, ', '.join(['%s']*len(serialised_items)), cond), tuple(serialised_items))
|
||||
|
||||
if item_rows:
|
||||
sle_serial_nos = dict(frappe.db.sql("""
|
||||
select voucher_detail_no, serial_no
|
||||
from `tabStock Ledger Entry`
|
||||
where ifnull(serial_no, '') != ''
|
||||
and voucher_detail_no in (%s)
|
||||
""".format(', '.join(['%s']*len(item_rows))),
|
||||
tuple([d[0] for d in item_rows])))
|
||||
|
||||
batch_size = 100
|
||||
for i in range(0, len(item_rows), batch_size):
|
||||
batch_item_rows = item_rows[i:i + batch_size]
|
||||
when_then = []
|
||||
for item_row in batch_item_rows:
|
||||
|
||||
when_then.append('WHEN `name` = "{row_name}" THEN "{value}"'.format(
|
||||
row_name=item_row[0],
|
||||
value=sle_serial_nos.get(item_row[0])))
|
||||
|
||||
frappe.db.sql("""
|
||||
update
|
||||
`tab{doctype}`
|
||||
set
|
||||
serial_no = CASE {when_then_cond} ELSE `serial_no` END
|
||||
""".format(
|
||||
doctype = dt,
|
||||
when_then_cond=" ".join(when_then)
|
||||
))
|
@ -1,12 +0,0 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("regional", "doctype", "gst_settings")
|
||||
frappe.reload_doc("accounts", "doctype", "gst_account")
|
||||
gst_settings = frappe.get_doc("GST Settings")
|
||||
gst_settings.b2c_limit = 250000
|
||||
gst_settings.save()
|
@ -1,37 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.patches.v8_10.change_default_customer_credit_days import make_payment_term, make_template
|
||||
|
||||
def execute():
|
||||
for dt in ("Company", "Customer Group"):
|
||||
frappe.reload_doc("setup", "doctype", frappe.scrub(dt))
|
||||
|
||||
credit_records = frappe.db.sql("""
|
||||
SELECT DISTINCT `credit_days`, `credit_days_based_on`, `name`
|
||||
from `tab{0}`
|
||||
where
|
||||
((credit_days_based_on='Fixed Days' or credit_days_based_on is null) and credit_days is not null)
|
||||
or credit_days_based_on='Last Day of the Next Month'
|
||||
""".format(dt), as_dict=1)
|
||||
|
||||
for d in credit_records:
|
||||
template = create_payment_terms_template(d)
|
||||
|
||||
frappe.db.sql("""
|
||||
update `tab{0}`
|
||||
set `payment_terms` = %s
|
||||
where name = %s
|
||||
""".format(dt), (template.name, d.name))
|
||||
|
||||
def create_payment_terms_template(data):
|
||||
if data.credit_days_based_on == "Fixed Days":
|
||||
pyt_template_name = 'Default Payment Term - N{0}'.format(data.credit_days)
|
||||
else:
|
||||
pyt_template_name = 'Default Payment Term - EO2M'
|
||||
|
||||
if not frappe.db.exists("Payment Terms Template", pyt_template_name):
|
||||
payment_term = make_payment_term(data.credit_days, data.credit_days_based_on)
|
||||
template = make_template(payment_term)
|
||||
else:
|
||||
template = frappe.get_doc("Payment Terms Template", pyt_template_name)
|
||||
return template
|
@ -1,35 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("accounts", "doctype", "sales_invoice_item")
|
||||
frappe.reload_doc('accounts', 'doctype', 'purchase_invoice_item')
|
||||
frappe.reload_doc('buying', 'doctype', 'purchase_order_item')
|
||||
frappe.reload_doc('buying', 'doctype', 'supplier_quotation_item')
|
||||
frappe.reload_doc('selling', 'doctype', 'sales_order_item')
|
||||
frappe.reload_doc('selling', 'doctype', 'quotation_item')
|
||||
frappe.reload_doc('stock', 'doctype', 'delivery_note_item')
|
||||
frappe.reload_doc('stock', 'doctype', 'purchase_receipt_item')
|
||||
|
||||
selling_doctypes = ["Sales Order Item", "Sales Invoice Item", "Delivery Note Item", "Quotation Item"]
|
||||
buying_doctypes = ["Purchase Order Item", "Purchase Invoice Item", "Purchase Receipt Item", "Supplier Quotation Item"]
|
||||
|
||||
for doctype in selling_doctypes:
|
||||
frappe.db.sql('''
|
||||
UPDATE
|
||||
`tab%s`
|
||||
SET
|
||||
discount_amount = if(rate_with_margin > 0, rate_with_margin, price_list_rate) * discount_percentage / 100
|
||||
WHERE
|
||||
discount_percentage > 0
|
||||
''' % (doctype))
|
||||
for doctype in buying_doctypes:
|
||||
frappe.db.sql('''
|
||||
UPDATE
|
||||
`tab%s`
|
||||
SET
|
||||
discount_amount = price_list_rate * discount_percentage / 100
|
||||
WHERE
|
||||
discount_percentage > 0
|
||||
''' % (doctype))
|
@ -1,35 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
item_numeric_attributes = frappe.db.sql("""
|
||||
select name, numeric_values, from_range, to_range, increment
|
||||
from `tabItem Attribute`
|
||||
where numeric_values = 1
|
||||
""", as_dict=1)
|
||||
|
||||
for d in item_numeric_attributes:
|
||||
frappe.db.sql("""
|
||||
update `tabItem Variant Attribute`
|
||||
set
|
||||
from_range = CASE
|
||||
WHEN from_range = 0 THEN %(from_range)s
|
||||
ELSE from_range
|
||||
END,
|
||||
to_range = CASE
|
||||
WHEN to_range = 0 THEN %(to_range)s
|
||||
ELSE to_range
|
||||
END,
|
||||
increment = CASE
|
||||
WHEN increment = 0 THEN %(increment)s
|
||||
ELSE increment
|
||||
END,
|
||||
numeric_values = %(numeric_values)s
|
||||
where
|
||||
attribute = %(name)s
|
||||
and exists(select name from tabItem
|
||||
where name=`tabItem Variant Attribute`.parent and has_variants=1)
|
||||
""", d)
|
@ -1,21 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doctype('Customer')
|
||||
|
||||
frappe.db.sql("""
|
||||
update
|
||||
`tabCustomer`, (
|
||||
select `tabContact`.name, `tabContact`.mobile_no, `tabContact`.email_id,
|
||||
`tabDynamic Link`.link_name from `tabContact`, `tabDynamic Link`
|
||||
where `tabContact`.name = `tabDynamic Link`.parent and
|
||||
`tabDynamic Link`.link_doctype = 'Customer' and `tabContact`.is_primary_contact = 1
|
||||
) as contact
|
||||
set
|
||||
`tabCustomer`.customer_primary_contact = contact.name,
|
||||
`tabCustomer`.mobile_no = contact.mobile_no, `tabCustomer`.email_id = contact.email_id
|
||||
where `tabCustomer`.name = contact.link_name""")
|
@ -1,21 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("stock", "doctype", "stock_settings")
|
||||
|
||||
ss = frappe.get_doc("Stock Settings")
|
||||
ss.set_qty_in_transactions_based_on_serial_no_input = 1
|
||||
|
||||
if ss.default_warehouse \
|
||||
and not frappe.db.exists("Warehouse", ss.default_warehouse):
|
||||
ss.default_warehouse = None
|
||||
|
||||
if ss.stock_uom and not frappe.db.exists("UOM", ss.stock_uom):
|
||||
ss.stock_uom = None
|
||||
|
||||
ss.flags.ignore_mandatory = True
|
||||
ss.save()
|
@ -1,8 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
if not frappe.db.exists("Party Type", "Student"):
|
||||
party = frappe.new_doc("Party Type")
|
||||
party.party_type = "Student"
|
||||
party.save()
|
@ -1,13 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.setup.doctype.company.company import install_country_fixtures
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("accounts", "doctype", "account")
|
||||
frappe.reload_doc("accounts", "doctype", "payment_schedule")
|
||||
for d in frappe.get_all('Company',
|
||||
filters={'country': ('in', ['Saudi Arabia', 'United Arab Emirates'])}):
|
||||
install_country_fixtures(d.name)
|
@ -1,6 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("hr", "doctype", "hr_settings")
|
||||
frappe.db.set_value("HR Settings", None, "show_leaves_of_all_department_members_in_calendar", 1)
|
@ -1,26 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for d in frappe.get_all('Sales Invoice', fields=["name"],
|
||||
filters = {'is_pos':1, 'docstatus': 1, 'creation': ('>', '2018-04-23')}):
|
||||
doc = frappe.get_doc('Sales Invoice', d.name)
|
||||
if (not doc.taxes and doc.taxes_and_charges and doc.pos_profile and doc.outstanding_amount != 0 and
|
||||
frappe.db.get_value('POS Profile', doc.pos_profile, 'taxes_and_charges', cache=True) == doc.taxes_and_charges):
|
||||
|
||||
doc.append_taxes_from_master()
|
||||
doc.calculate_taxes_and_totals()
|
||||
for d in doc.taxes:
|
||||
d.db_update()
|
||||
|
||||
doc.db_update()
|
||||
|
||||
delete_gle_for_voucher(doc.name)
|
||||
doc.make_gl_entries()
|
||||
|
||||
def delete_gle_for_voucher(voucher_no):
|
||||
frappe.db.sql("""delete from `tabGL Entry` where voucher_no = %(voucher_no)s""",
|
||||
{'voucher_no': voucher_no})
|
@ -1,12 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.regional.address_template.setup import set_up_address_templates
|
||||
|
||||
def execute():
|
||||
if frappe.db.get_value('Company', {'country': 'India'}, 'name'):
|
||||
address_template = frappe.db.get_value('Address Template', 'India', 'template')
|
||||
if not address_template or "gstin" not in address_template:
|
||||
set_up_address_templates(default_country='India')
|
@ -1,17 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('education', 'doctype', 'assessment_plan')
|
||||
|
||||
frappe.db.sql("""
|
||||
UPDATE `tabAssessment Plan` as ap
|
||||
INNER JOIN `tabStudent Group` as sg ON sg.name = ap.student_group
|
||||
SET ap.academic_term = sg.academic_term,
|
||||
ap.academic_year = sg.academic_year,
|
||||
ap.program = sg.program
|
||||
WHERE ap.docstatus = 1
|
||||
""")
|
@ -1,20 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('education', 'doctype', 'assessment_result')
|
||||
|
||||
frappe.db.sql("""
|
||||
UPDATE `tabAssessment Result` AS ar
|
||||
INNER JOIN `tabAssessment Plan` AS ap ON ap.name = ar.assessment_plan
|
||||
SET ar.academic_term = ap.academic_term,
|
||||
ar.academic_year = ap.academic_year,
|
||||
ar.program = ap.program,
|
||||
ar.course = ap.course,
|
||||
ar.assessment_group = ap.assessment_group,
|
||||
ar.student_group = ap.student_group
|
||||
WHERE ap.docstatus = 1
|
||||
""")
|
@ -1,12 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('assets', 'doctype', 'asset')
|
||||
frappe.reload_doc('assets', 'doctype', 'depreciation_schedule')
|
||||
|
||||
frappe.db.sql("""
|
||||
update tabAsset a
|
||||
set calculate_depreciation = 1
|
||||
where exists(select ds.name from `tabDepreciation Schedule` ds where ds.parent=a.name)
|
||||
""")
|
@ -1,10 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
if frappe.db.table_exists("Data Migration Connector"):
|
||||
frappe.db.sql("""
|
||||
UPDATE `tabData Migration Connector`
|
||||
SET hostname = 'https://hubmarket.org'
|
||||
WHERE connector_name = 'Hub Connector'
|
||||
""")
|
@ -1,9 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils.nestedset import rebuild_tree
|
||||
|
||||
def execute():
|
||||
""" assign lft and rgt appropriately """
|
||||
frappe.reload_doc("hr", "doctype", "employee")
|
||||
|
||||
rebuild_tree("Employee", "reports_to")
|
@ -1,15 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for doctype in ['Sales Invoice', 'Delivery Note', 'Stock Entry']:
|
||||
frappe.db.sql(""" update
|
||||
`tabStock Ledger Entry` sle, `tab{0}` parent_doc
|
||||
set
|
||||
sle.project = parent_doc.project
|
||||
where
|
||||
sle.voucher_no = parent_doc.name and sle.voucher_type = %s and sle.project is null
|
||||
and parent_doc.project is not null and parent_doc.project != ''""".format(doctype), doctype)
|
@ -1,53 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.stock.utils import get_bin
|
||||
|
||||
def execute():
|
||||
po_item = list(frappe.db.sql(("""
|
||||
select distinct po.name as poname, poitem.rm_item_code as rm_item_code, po.company
|
||||
from `tabPurchase Order` po, `tabPurchase Order Item Supplied` poitem
|
||||
where po.name = poitem.parent
|
||||
and po.is_subcontracted = "Yes"
|
||||
and po.docstatus = 1"""), as_dict=1))
|
||||
if not po_item:
|
||||
return
|
||||
|
||||
frappe.reload_doc("stock", "doctype", "bin")
|
||||
frappe.reload_doc("buying", "doctype", "purchase_order_item_supplied")
|
||||
company_warehouse = frappe._dict(frappe.db.sql("""select company, min(name) from `tabWarehouse`
|
||||
where is_group = 0 group by company"""))
|
||||
|
||||
items = list(set([d.rm_item_code for d in po_item]))
|
||||
item_wh = frappe._dict(frappe.db.sql("""select item_code, default_warehouse
|
||||
from `tabItem` where name in ({0})""".format(", ".join(["%s"] * len(items))), items))
|
||||
|
||||
# Update reserved warehouse
|
||||
for item in po_item:
|
||||
reserve_warehouse = get_warehouse(item.rm_item_code, item.company, company_warehouse, item_wh)
|
||||
frappe.db.sql("""update `tabPurchase Order Item Supplied`
|
||||
set reserve_warehouse = %s
|
||||
where parent = %s and rm_item_code = %s
|
||||
""", (reserve_warehouse, item["poname"], item["rm_item_code"]))
|
||||
|
||||
# Update bin
|
||||
item_wh_bin = frappe.db.sql(("""
|
||||
select distinct poitemsup.rm_item_code as rm_item_code,
|
||||
poitemsup.reserve_warehouse as reserve_warehouse
|
||||
from `tabPurchase Order` po, `tabPurchase Order Item Supplied` poitemsup
|
||||
where po.name = poitemsup.parent
|
||||
and po.is_subcontracted = "Yes"
|
||||
and po.docstatus = 1"""), as_dict=1)
|
||||
for d in item_wh_bin:
|
||||
try:
|
||||
stock_bin = get_bin(d["rm_item_code"], d["reserve_warehouse"])
|
||||
stock_bin.update_reserved_qty_for_sub_contracting()
|
||||
except:
|
||||
pass
|
||||
|
||||
def get_warehouse(item_code, company, company_warehouse, item_wh):
|
||||
reserve_warehouse = item_wh.get(item_code)
|
||||
if frappe.db.get_value("Warehouse", reserve_warehouse, "company") != company:
|
||||
reserve_warehouse = None
|
||||
if not reserve_warehouse:
|
||||
reserve_warehouse = company_warehouse.get(company)
|
||||
return reserve_warehouse
|
@ -1,18 +0,0 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("buying", "doctype", "supplier_quotation_item")
|
||||
|
||||
for doctype in ['Purchase Order','Supplier Quotation']:
|
||||
frappe.db.sql("""
|
||||
Update
|
||||
`tab{doctype} Item`, `tabMaterial Request Item`
|
||||
set
|
||||
`tab{doctype} Item`.sales_order = `tabMaterial Request Item`.sales_order
|
||||
where
|
||||
`tab{doctype} Item`.material_request= `tabMaterial Request Item`.parent
|
||||
and `tab{doctype} Item`.material_request_item = `tabMaterial Request Item`.name
|
||||
and `tabMaterial Request Item`.sales_order is not null""".format(doctype=doctype))
|
@ -1,40 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
|
||||
|
||||
# update the sales order item in the material request
|
||||
frappe.reload_doc('stock', 'doctype', 'material_request_item')
|
||||
frappe.db.sql('''update `tabMaterial Request Item` mri, `tabSales Order Item` soi
|
||||
set mri.sales_order_item = soi.name
|
||||
where ifnull(mri.sales_order, "")!="" and soi.parent=mri.sales_order
|
||||
and soi.item_code=mri.item_code and mri.docstatus=1
|
||||
''')
|
||||
|
||||
# update the sales order item in the purchase order
|
||||
frappe.db.sql('''update `tabPurchase Order Item` poi, `tabSales Order Item` soi
|
||||
set poi.sales_order_item = soi.name
|
||||
where ifnull(poi.sales_order, "")!="" and soi.parent=poi.sales_order
|
||||
and soi.item_code=poi.item_code and poi.docstatus = 1
|
||||
''')
|
||||
|
||||
# Update the status in material request and sales order
|
||||
po_list = frappe.db.sql('''
|
||||
select parent from `tabPurchase Order Item` where ifnull(material_request, "")!="" and
|
||||
ifnull(sales_order, "")!="" and docstatus=1
|
||||
''',as_dict=1)
|
||||
|
||||
for po in list(set([d.get("parent") for d in po_list if d.get("parent")])):
|
||||
try:
|
||||
po_doc = frappe.get_doc("Purchase Order", po)
|
||||
|
||||
# update the so in the status updater
|
||||
po_doc.update_status_updater()
|
||||
po_doc.update_qty(update_modified=False)
|
||||
|
||||
except Exception:
|
||||
pass
|
@ -1,8 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("stock", "doctype", "purchase_receipt")
|
||||
frappe.db.sql('''
|
||||
UPDATE `tabPurchase Receipt` SET status = "Completed" WHERE per_billed = 100 AND docstatus = 1
|
||||
''')
|
@ -1,29 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.rename_doc import get_fetch_fields
|
||||
|
||||
def execute():
|
||||
ignore_doctypes = ["Lead", "Opportunity", "POS Profile", "Tax Rule", "Pricing Rule"]
|
||||
customers = frappe.get_all('Customer', fields=["name", "customer_group"])
|
||||
customer_group_fetch = get_fetch_fields('Customer', 'Customer Group', ignore_doctypes)
|
||||
|
||||
batch_size = 1000
|
||||
for i in range(0, len(customers), batch_size):
|
||||
batch_customers = customers[i:i + batch_size]
|
||||
for d in customer_group_fetch:
|
||||
when_then = []
|
||||
for customer in batch_customers:
|
||||
value = frappe.db.escape(frappe.as_unicode(customer.get("customer_group")))
|
||||
|
||||
when_then.append('''
|
||||
WHEN `%s` = %s and %s != %s
|
||||
THEN %s
|
||||
'''%(d["master_fieldname"], frappe.db.escape(frappe.as_unicode(customer.name)),
|
||||
d["linked_to_fieldname"], value, value))
|
||||
|
||||
frappe.db.sql("""
|
||||
update
|
||||
`tab%s`
|
||||
set
|
||||
%s = CASE %s ELSE `%s` END
|
||||
"""%(d['doctype'], d.linked_to_fieldname, " ".join(when_then), d.linked_to_fieldname))
|
@ -1,19 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('hr', 'doctype', 'employee')
|
||||
|
||||
frappe.db.sql("""
|
||||
UPDATE
|
||||
`tabEmployee`, `tabUser`
|
||||
SET
|
||||
`tabEmployee`.image = `tabUser`.user_image
|
||||
WHERE
|
||||
`tabEmployee`.user_id = `tabUser`.name and
|
||||
`tabEmployee`.user_id is not null and
|
||||
`tabEmployee`.user_id != '' and `tabEmployee`.image is null
|
||||
""")
|
@ -1,37 +0,0 @@
|
||||
# Copyright (c) 2017, Frappe and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
warehouse = frappe.db.sql("""select name, email_id, phone_no, mobile_no, address_line_1,
|
||||
address_line_2, city, state, pin from `tabWarehouse` where ifnull(address_line_1, '') != ''
|
||||
or ifnull(mobile_no, '') != ''
|
||||
or ifnull(email_id, '') != '' """, as_dict=1)
|
||||
|
||||
for d in warehouse:
|
||||
try:
|
||||
address = frappe.new_doc('Address')
|
||||
address.name = d.name
|
||||
address.address_title = d.name
|
||||
address.address_line1 = d.address_line_1
|
||||
address.city = d.city
|
||||
address.state = d.state
|
||||
address.pincode = d.pin
|
||||
address.db_insert()
|
||||
address.append('links',{'link_doctype':'Warehouse','link_name':d.name})
|
||||
address.links[0].db_insert()
|
||||
if d.name and (d.email_id or d.mobile_no or d.phone_no):
|
||||
contact = frappe.new_doc('Contact')
|
||||
contact.name = d.name
|
||||
contact.first_name = d.name
|
||||
contact.mobile_no = d.mobile_no
|
||||
contact.email_id = d.email_id
|
||||
contact.phone = d.phone_no
|
||||
contact.db_insert()
|
||||
contact.append('links',{'link_doctype':'Warehouse','link_name':d.name})
|
||||
contact.links[0].db_insert()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,16 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
def execute():
|
||||
""" copy subscribe field to customer """
|
||||
frappe.reload_doc("accounts","doctype","subscription")
|
||||
|
||||
if frappe.db.exists("DocType", "Subscriber"):
|
||||
if frappe.db.has_column('Subscription','subscriber'):
|
||||
frappe.db.sql("""
|
||||
update `tabSubscription` s1
|
||||
set customer=(select customer from tabSubscriber where name=s1.subscriber)
|
||||
""")
|
||||
|
||||
frappe.delete_doc("DocType", "Subscriber")
|
@ -6,6 +6,10 @@ import frappe
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
def execute():
|
||||
# updating column value to handle field change from Data to Currency
|
||||
changed_field = "base_scrap_material_cost"
|
||||
frappe.db.sql(f"update `tabBOM` set {changed_field} = '0' where trim(coalesce({changed_field}, ''))= ''")
|
||||
|
||||
for doctype in ['BOM Explosion Item', 'BOM Item', 'Work Order Item', 'Item']:
|
||||
if frappe.db.has_column(doctype, 'allow_transfer_for_manufacture'):
|
||||
if doctype != 'Item':
|
||||
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -2,6 +2,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
|
||||
|
||||
def execute():
|
||||
if frappe.db.exists('DocType', 'Lab Test') and frappe.db.exists('DocType', 'Lab Test Template'):
|
||||
# rename child doctypes
|
||||
@ -17,7 +18,12 @@ def execute():
|
||||
frappe.reload_doc('healthcare', 'doctype', 'lab_test_template')
|
||||
|
||||
for old_dt, new_dt in doctypes.items():
|
||||
if not frappe.db.table_exists(new_dt) and frappe.db.table_exists(old_dt):
|
||||
frappe.flags.link_fields = {}
|
||||
should_rename = (
|
||||
frappe.db.table_exists(old_dt)
|
||||
and not frappe.db.table_exists(new_dt)
|
||||
)
|
||||
if should_rename:
|
||||
frappe.reload_doc('healthcare', 'doctype', frappe.scrub(old_dt))
|
||||
frappe.rename_doc('DocType', old_dt, new_dt, force=True)
|
||||
frappe.reload_doc('healthcare', 'doctype', frappe.scrub(new_dt))
|
||||
|
@ -1,50 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.hr.doctype.employee.employee import EmployeeUserDisabledError
|
||||
|
||||
def execute():
|
||||
update_hr_permissions()
|
||||
update_permissions()
|
||||
remove_duplicate_user_permissions()
|
||||
frappe.clear_cache()
|
||||
|
||||
def update_hr_permissions():
|
||||
# add set user permissions rights to HR Manager
|
||||
frappe.db.sql("""update `tabDocPerm` set `set_user_permissions`=1 where parent in ('Employee', 'Leave Application')
|
||||
and role='HR Manager' and permlevel=0 and `read`=1""")
|
||||
docperm_meta = frappe.get_meta('DocPerm')
|
||||
if docperm_meta.get_field('apply_user_permissions'):
|
||||
# apply user permissions on Employee and Leave Application
|
||||
frappe.db.sql("""update `tabDocPerm` set `apply_user_permissions`=1 where parent in ('Employee', 'Leave Application')
|
||||
and role in ('Employee', 'Leave Approver') and permlevel=0 and `read`=1""")
|
||||
|
||||
frappe.clear_cache()
|
||||
|
||||
# save employees to run on_update events
|
||||
for employee in frappe.db.sql_list("""select name from `tabEmployee` where docstatus < 2"""):
|
||||
try:
|
||||
emp = frappe.get_doc("Employee", employee)
|
||||
emp.flags.ignore_mandatory = True
|
||||
emp.save()
|
||||
except EmployeeUserDisabledError:
|
||||
pass
|
||||
|
||||
def update_permissions():
|
||||
# clear match conditions other than owner
|
||||
frappe.db.sql("""update tabDocPerm set `match`=''
|
||||
where ifnull(`match`,'') not in ('', 'owner')""")
|
||||
|
||||
def remove_duplicate_user_permissions():
|
||||
# remove duplicate user_permissions (if they exist)
|
||||
for d in frappe.db.sql("""select parent, defkey, defvalue,
|
||||
count(*) as cnt from tabDefaultValue
|
||||
where parent not in ('__global', '__default')
|
||||
group by parent, defkey, defvalue""", as_dict=1):
|
||||
if d.cnt > 1:
|
||||
# order by parenttype so that user permission does not get removed!
|
||||
frappe.db.sql("""delete from tabDefaultValue where `parent`=%s and `defkey`=%s and
|
||||
`defvalue`=%s order by parenttype limit %s""", (d.parent, d.defkey, d.defvalue, d.cnt-1))
|
||||
|
@ -1,29 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("setup", 'doctype', "company")
|
||||
frappe.reload_doc("accounts", 'doctype', "account")
|
||||
|
||||
frappe.db.sql("""update tabAccount set account_type='Cash'
|
||||
where account_type='Bank or Cash' and account_name in ('Cash', 'Cash In Hand')""")
|
||||
|
||||
frappe.db.sql("""update tabAccount set account_type='Stock'
|
||||
where account_name = 'Stock Assets'""")
|
||||
|
||||
ac_types = {"Fixed Asset Account": "Fixed Asset", "Bank or Cash": "Bank"}
|
||||
for old, new in ac_types.items():
|
||||
frappe.db.sql("""update tabAccount set account_type=%s
|
||||
where account_type=%s""", (new, old))
|
||||
|
||||
try:
|
||||
frappe.db.sql("""update `tabAccount` set report_type =
|
||||
if(is_pl_account='Yes', 'Profit and Loss', 'Balance Sheet')""")
|
||||
|
||||
frappe.db.sql("""update `tabAccount` set balance_must_be=debit_or_credit
|
||||
where ifnull(allow_negative_balance, 0) = 0""")
|
||||
except:
|
||||
pass
|
@ -1,63 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_field_if_values_exist
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("stock", "doctype", "purchase_receipt")
|
||||
frappe.reload_doc("hr", "doctype", "employee")
|
||||
frappe.reload_doc("Payroll", "doctype", "salary_slip")
|
||||
|
||||
india_specific_fields = {
|
||||
"Purchase Receipt": [{
|
||||
"label": "Supplier Shipment No",
|
||||
"fieldname": "challan_no",
|
||||
"fieldtype": "Data",
|
||||
"insert_after": "is_subcontracted"
|
||||
}, {
|
||||
"label": "Supplier Shipment Date",
|
||||
"fieldname": "challan_date",
|
||||
"fieldtype": "Date",
|
||||
"insert_after": "is_subcontracted"
|
||||
}],
|
||||
"Employee": [{
|
||||
"label": "PAN Number",
|
||||
"fieldname": "pan_number",
|
||||
"fieldtype": "Data",
|
||||
"insert_after": "company_email"
|
||||
}, {
|
||||
"label": "Gratuity LIC Id",
|
||||
"fieldname": "gratuity_lic_id",
|
||||
"fieldtype": "Data",
|
||||
"insert_after": "company_email"
|
||||
}, {
|
||||
"label": "Esic Card No",
|
||||
"fieldname": "esic_card_no",
|
||||
"fieldtype": "Data",
|
||||
"insert_after": "bank_ac_no"
|
||||
}, {
|
||||
"label": "PF Number",
|
||||
"fieldname": "pf_number",
|
||||
"fieldtype": "Data",
|
||||
"insert_after": "bank_ac_no"
|
||||
}],
|
||||
"Salary Slip": [{
|
||||
"label": "Esic No",
|
||||
"fieldname": "esic_no",
|
||||
"fieldtype": "Data",
|
||||
"insert_after": "letter_head",
|
||||
"permlevel": 1
|
||||
}, {
|
||||
"label": "PF Number",
|
||||
"fieldname": "pf_no",
|
||||
"fieldtype": "Data",
|
||||
"insert_after": "letter_head",
|
||||
"permlevel": 1
|
||||
}]
|
||||
}
|
||||
|
||||
for dt, docfields in india_specific_fields.items():
|
||||
for df in docfields:
|
||||
create_custom_field_if_values_exist(dt, df)
|
@ -1,35 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils.nestedset import get_root_of
|
||||
|
||||
def execute():
|
||||
# setup not complete
|
||||
if not frappe.db.sql("""select name from tabCompany limit 1"""):
|
||||
return
|
||||
|
||||
if "shopping_cart" in frappe.get_installed_apps():
|
||||
frappe.reload_doc("shopping_cart", "doctype", "shopping_cart_settings")
|
||||
|
||||
if not frappe.db.sql("select name from `tabPrice List` where buying=1"):
|
||||
create_price_list(_("Standard Buying"), buying=1)
|
||||
|
||||
if not frappe.db.sql("select name from `tabPrice List` where selling=1"):
|
||||
create_price_list(_("Standard Selling"), selling=1)
|
||||
|
||||
def create_price_list(pl_name, buying=0, selling=0):
|
||||
price_list = frappe.get_doc({
|
||||
"doctype": "Price List",
|
||||
"price_list_name": pl_name,
|
||||
"enabled": 1,
|
||||
"buying": buying,
|
||||
"selling": selling,
|
||||
"currency": frappe.db.get_default("currency"),
|
||||
"territories": [{
|
||||
"territory": get_root_of("Territory")
|
||||
}]
|
||||
})
|
||||
price_list.insert()
|
@ -1,33 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils.nestedset import get_root_of
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("accounts", "doctype", "pricing_rule")
|
||||
|
||||
frappe.db.auto_commit_on_many_writes = True
|
||||
|
||||
default_item_group = get_root_of("Item Group")
|
||||
|
||||
for d in frappe.db.sql("""select * from `tabCustomer Discount`
|
||||
where ifnull(parent, '') != ''""", as_dict=1):
|
||||
if not d.discount:
|
||||
continue
|
||||
|
||||
frappe.get_doc({
|
||||
"doctype": "Pricing Rule",
|
||||
"apply_on": "Item Group",
|
||||
"item_group": d.item_group or default_item_group,
|
||||
"applicable_for": "Customer",
|
||||
"customer": d.parent,
|
||||
"price_or_discount": "Discount Percentage",
|
||||
"discount_percentage": d.discount,
|
||||
"selling": 1
|
||||
}).insert()
|
||||
|
||||
frappe.db.auto_commit_on_many_writes = False
|
||||
|
||||
frappe.delete_doc("DocType", "Customer Discount")
|
@ -1,109 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.utils.rename_field import rename_field
|
||||
from frappe.modules import scrub, get_doctype_module
|
||||
|
||||
rename_map = {
|
||||
"Quotation Item": [
|
||||
["ref_rate", "price_list_rate"],
|
||||
["base_ref_rate", "base_price_list_rate"],
|
||||
["adj_rate", "discount_percentage"],
|
||||
["export_rate", "rate"],
|
||||
["basic_rate", "base_rate"],
|
||||
["amount", "base_amount"],
|
||||
["export_amount", "amount"]
|
||||
],
|
||||
|
||||
"Sales Order Item": [
|
||||
["ref_rate", "price_list_rate"],
|
||||
["base_ref_rate", "base_price_list_rate"],
|
||||
["adj_rate", "discount_percentage"],
|
||||
["export_rate", "rate"],
|
||||
["basic_rate", "base_rate"],
|
||||
["amount", "base_amount"],
|
||||
["export_amount", "amount"],
|
||||
["reserved_warehouse", "warehouse"]
|
||||
],
|
||||
|
||||
"Delivery Note Item": [
|
||||
["ref_rate", "price_list_rate"],
|
||||
["base_ref_rate", "base_price_list_rate"],
|
||||
["adj_rate", "discount_percentage"],
|
||||
["export_rate", "rate"],
|
||||
["basic_rate", "base_rate"],
|
||||
["amount", "base_amount"],
|
||||
["export_amount", "amount"]
|
||||
],
|
||||
|
||||
"Sales Invoice Item": [
|
||||
["ref_rate", "price_list_rate"],
|
||||
["base_ref_rate", "base_price_list_rate"],
|
||||
["adj_rate", "discount_percentage"],
|
||||
["export_rate", "rate"],
|
||||
["basic_rate", "base_rate"],
|
||||
["amount", "base_amount"],
|
||||
["export_amount", "amount"]
|
||||
],
|
||||
|
||||
"Supplier Quotation Item": [
|
||||
["import_ref_rate", "price_list_rate"],
|
||||
["purchase_ref_rate", "base_price_list_rate"],
|
||||
["discount_rate", "discount_percentage"],
|
||||
["import_rate", "rate"],
|
||||
["purchase_rate", "base_rate"],
|
||||
["amount", "base_amount"],
|
||||
["import_amount", "amount"]
|
||||
],
|
||||
|
||||
"Purchase Order Item": [
|
||||
["import_ref_rate", "price_list_rate"],
|
||||
["purchase_ref_rate", "base_price_list_rate"],
|
||||
["discount_rate", "discount_percentage"],
|
||||
["import_rate", "rate"],
|
||||
["purchase_rate", "base_rate"],
|
||||
["amount", "base_amount"],
|
||||
["import_amount", "amount"]
|
||||
],
|
||||
|
||||
"Purchase Receipt Item": [
|
||||
["import_ref_rate", "price_list_rate"],
|
||||
["purchase_ref_rate", "base_price_list_rate"],
|
||||
["discount_rate", "discount_percentage"],
|
||||
["import_rate", "rate"],
|
||||
["purchase_rate", "base_rate"],
|
||||
["amount", "base_amount"],
|
||||
["import_amount", "amount"]
|
||||
],
|
||||
|
||||
"Purchase Invoice Item": [
|
||||
["import_ref_rate", "price_list_rate"],
|
||||
["purchase_ref_rate", "base_price_list_rate"],
|
||||
["discount_rate", "discount_percentage"],
|
||||
["import_rate", "rate"],
|
||||
["rate", "base_rate"],
|
||||
["amount", "base_amount"],
|
||||
["import_amount", "amount"],
|
||||
["expense_head", "expense_account"]
|
||||
],
|
||||
|
||||
"Item": [
|
||||
["purchase_account", "expense_account"],
|
||||
["default_sales_cost_center", "selling_cost_center"],
|
||||
["cost_center", "buying_cost_center"],
|
||||
["default_income_account", "income_account"],
|
||||
],
|
||||
"Item Price": [
|
||||
["ref_rate", "price_list_rate"]
|
||||
]
|
||||
}
|
||||
|
||||
def execute():
|
||||
for dn in rename_map:
|
||||
frappe.reload_doc(get_doctype_module(dn), "doctype", scrub(dn))
|
||||
|
||||
for dt, field_list in rename_map.items():
|
||||
for field in field_list:
|
||||
rename_field(dt, field[0], field[1])
|
@ -1,12 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
missing_line = """{{ address_line1 }}<br>"""
|
||||
for name, template in frappe.db.sql("select name, template from `tabAddress Template`"):
|
||||
if missing_line not in template:
|
||||
d = frappe.get_doc("Address Template", name)
|
||||
d.template = missing_line + d.template
|
||||
d.save()
|
@ -1,13 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
hr = frappe.db.get_value("Module Def", "HR")
|
||||
if hr == "Hr":
|
||||
frappe.rename_doc("Module Def", "Hr", "HR")
|
||||
frappe.db.set_value("Module Def", "HR", "module_name", "HR")
|
||||
|
||||
frappe.clear_cache()
|
||||
frappe.setup_module_map()
|
@ -1,13 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("website", "doctype", "contact_us_settings")
|
||||
address = frappe.db.get_value("Contact Us Settings", None, "address")
|
||||
if address:
|
||||
address = frappe.get_doc("Address", address)
|
||||
contact = frappe.get_doc("Contact Us Settings", "Contact Us Settings")
|
||||
for f in ("address_title", "address_line1", "address_line2", "city", "state", "country", "pincode"):
|
||||
contact.set(f, address.get(f))
|
||||
|
||||
contact.save()
|
@ -1,23 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from frappe.utils import get_fullname
|
||||
|
||||
def execute():
|
||||
for user_id in frappe.db.sql_list("""select distinct user_id from `tabEmployee`
|
||||
where ifnull(user_id, '')!=''
|
||||
group by user_id having count(name) > 1"""):
|
||||
|
||||
fullname = get_fullname(user_id)
|
||||
employee = frappe.db.get_value("Employee", {"employee_name": fullname, "user_id": user_id})
|
||||
|
||||
if employee:
|
||||
frappe.db.sql("""update `tabEmployee` set user_id=null
|
||||
where user_id=%s and name!=%s""", (user_id, employee))
|
||||
else:
|
||||
count = frappe.db.sql("""select count(*) from `tabEmployee` where user_id=%s""", user_id)[0][0]
|
||||
frappe.db.sql("""update `tabEmployee` set user_id=null
|
||||
where user_id=%s limit %s""", (user_id, count - 1))
|
@ -1,39 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# MIT License. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from collections import Counter
|
||||
from frappe.core.doctype.user.user import STANDARD_USERS
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("core", "doctype", "system_settings")
|
||||
system_settings = frappe.get_doc("System Settings")
|
||||
|
||||
# set values from global_defauls
|
||||
global_defaults = frappe.db.get_value("Global Defaults", None,
|
||||
["time_zone", "date_format", "number_format", "float_precision", "session_expiry"], as_dict=True)
|
||||
|
||||
if global_defaults:
|
||||
for key, val in global_defaults.items():
|
||||
if not system_settings.get(key):
|
||||
system_settings.set(key, val)
|
||||
|
||||
# language
|
||||
if not system_settings.get("language"):
|
||||
# find most common language
|
||||
lang = frappe.db.sql_list("""select language from `tabUser`
|
||||
where ifnull(language, '')!='' and language not like "Loading%%" and name not in ({standard_users})""".format(
|
||||
standard_users=", ".join(["%s"]*len(STANDARD_USERS))), tuple(STANDARD_USERS))
|
||||
lang = Counter(lang).most_common(1)
|
||||
lang = (len(lang) > 0) and lang[0][0] or "english"
|
||||
|
||||
system_settings.language = lang
|
||||
|
||||
system_settings.flags.ignore_mandatory = True
|
||||
system_settings.save()
|
||||
|
||||
global_defaults = frappe.get_doc("Global Defaults")
|
||||
global_defaults.flags.ignore_mandatory = True
|
||||
global_defaults.save()
|
@ -1,15 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# MIT License. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.geo.country_info import get_all
|
||||
from frappe.utils.install import import_country_and_currency
|
||||
|
||||
from six import iteritems
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("setup", "doctype", "country")
|
||||
import_country_and_currency()
|
||||
for name, country in iteritems(get_all()):
|
||||
frappe.set_value("Country", name, "code", country.get("code"))
|
@ -1,16 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
# update sales cycle
|
||||
for d in ['Sales Invoice', 'Sales Order', 'Quotation', 'Delivery Note']:
|
||||
frappe.db.sql("""update `tab%s` set taxes_and_charges=charge""" % d)
|
||||
|
||||
# update purchase cycle
|
||||
for d in ['Purchase Invoice', 'Purchase Order', 'Supplier Quotation', 'Purchase Receipt']:
|
||||
frappe.db.sql("""update `tab%s` set taxes_and_charges=purchase_other_charges""" % d)
|
||||
|
||||
frappe.db.sql("""update `tabPurchase Taxes and Charges` set parentfield='other_charges'""")
|
@ -1,13 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import frappe.permissions
|
||||
|
||||
def execute():
|
||||
for warehouse, user in frappe.db.sql("""select parent, user from `tabWarehouse User`"""):
|
||||
frappe.permissions.add_user_permission("Warehouse", warehouse, user)
|
||||
|
||||
frappe.delete_doc_if_exists("DocType", "Warehouse User")
|
||||
frappe.reload_doc("stock", "doctype", "warehouse")
|
@ -1,14 +0,0 @@
|
||||
from __future__ import print_function, unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("utilities", "doctype", "address_template")
|
||||
if not frappe.db.sql("select name from `tabAddress Template`"):
|
||||
try:
|
||||
d = frappe.new_doc("Address Template")
|
||||
d.update({"country":frappe.db.get_default("country") or
|
||||
frappe.db.get_value("Global Defaults", "Global Defaults", "country")})
|
||||
d.insert()
|
||||
except:
|
||||
print(frappe.get_traceback())
|
||||
|
@ -1,8 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('accounts', 'Print Format', 'POS Invoice')
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user