Fixed merge conflict

This commit is contained in:
Nabin Hait 2015-08-27 14:55:34 +05:30
commit 13d8835b75
101 changed files with 15913 additions and 4308 deletions

View File

@ -1,2 +1,2 @@
from __future__ import unicode_literals
__version__ = '5.7.5'
__version__ = '5.8.2'

View File

@ -214,144 +214,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:inList([\"Credit Note\", \"Debit Note\"], doc.voucher_type)",
"fieldname": "stock_entry",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Stock Entry",
"no_copy": 0,
"options": "Stock Entry",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_debit",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Total Debit",
"no_copy": 1,
"oldfieldname": "total_debit",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_credit",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Total Credit",
"no_copy": 1,
"oldfieldname": "total_credit",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "difference",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Difference (Dr - Cr)",
"no_copy": 1,
"oldfieldname": "difference",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "get_balance",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Make Difference Entry",
"no_copy": 0,
"oldfieldtype": "Button",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break99",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -422,6 +284,165 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break99",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_debit",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Total Debit",
"no_copy": 1,
"oldfieldname": "total_debit",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_credit",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Total Credit",
"no_copy": 1,
"oldfieldname": "total_credit",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "difference",
"fieldname": "difference",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Difference (Dr - Cr)",
"no_copy": 1,
"oldfieldname": "difference",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "difference",
"fieldname": "get_balance",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Make Difference Entry",
"no_copy": 0,
"oldfieldtype": "Button",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_amount",
"fieldtype": "Currency",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount",
"no_copy": 1,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_amount_in_words",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount in Words",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -580,6 +601,120 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Write Off",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Accounts Receivable",
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_based_on",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Write Off Based On",
"no_copy": 0,
"options": "Accounts Receivable\nAccounts Payable",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "get_outstanding_invoices",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Outstanding Invoices",
"no_copy": 0,
"options": "get_outstanding_invoices",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_30",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Write Off Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -602,6 +737,48 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pay_to_recd_from",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Pay To / Recd From",
"no_copy": 1,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_35",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
@ -658,7 +835,7 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Details",
"label": "More Information",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-file-text",
@ -671,212 +848,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "No",
"description": "",
"fieldname": "is_opening",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Is Opening",
"no_copy": 0,
"oldfieldname": "is_opening",
"oldfieldtype": "Select",
"options": "No\nYes",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Accounts Receivable",
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_based_on",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Write Off Based On",
"no_copy": 0,
"options": "Accounts Receivable\nAccounts Payable",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "write_off_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Write Off Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.voucher_type == 'Write Off Entry'",
"fieldname": "get_outstanding_invoices",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Outstanding Invoices",
"no_copy": 0,
"options": "get_outstanding_invoices",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "Amended From",
"no_copy": 1,
"oldfieldname": "amended_from",
"oldfieldtype": "Link",
"options": "Journal Entry",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pay_to_recd_from",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Pay To / Recd From",
"no_copy": 1,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_amount",
"fieldtype": "Currency",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount",
"no_copy": 1,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_amount_in_words",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount in Words",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -924,6 +895,102 @@
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "No",
"description": "",
"fieldname": "is_opening",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Is Opening",
"no_copy": 0,
"oldfieldname": "is_opening",
"oldfieldtype": "Select",
"options": "No\nYes",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:inList([\"Credit Note\", \"Debit Note\"], doc.voucher_type)",
"fieldname": "stock_entry",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Stock Entry",
"no_copy": 0,
"options": "Stock Entry",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "Amended From",
"no_copy": 1,
"oldfieldname": "amended_from",
"oldfieldtype": "Link",
"options": "Journal Entry",
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
@ -935,7 +1002,7 @@
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"modified": "2015-08-26 12:47:53.107439",
"modified": "2015-08-27 03:19:18.634225",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Journal Entry",

View File

@ -33,7 +33,6 @@ class JournalEntry(AccountsController):
self.set_against_account()
self.create_remarks()
self.set_print_format_fields()
self.check_due_date()
self.validate_expense_claim()
self.validate_credit_debit_note()
self.validate_empty_accounts_table()
@ -84,20 +83,6 @@ class JournalEntry(AccountsController):
for customer in customers:
check_credit_limit(customer, self.company)
def check_due_date(self):
if self.cheque_date:
for d in self.get("accounts"):
if d.party_type and d.party and d.get("credit" if d.party_type=="Customer" else "debit") > 0:
due_date = None
if d.reference_type in ("Sales Invoice", "Purchase Invoice"):
due_date = frappe.db.get_value(d.reference_type, d.reference_name, "due_date")
if due_date and getdate(self.cheque_date) > getdate(due_date):
diff = date_diff(self.cheque_date, due_date)
if diff > 0:
msgprint(_("Note: Reference Date exceeds invoice due date by {0} days for {1} {2}")
.format(diff, d.party_type, d.party))
def validate_cheque_info(self):
if self.voucher_type in ['Bank Entry']:
if not self.cheque_no or not self.cheque_date:

View File

@ -130,7 +130,11 @@ def get_pricing_rule_for_item(args):
return item_details
if not (args.item_group and args.brand):
args.item_group, args.brand = frappe.db.get_value("Item", args.item_code, ["item_group", "brand"])
try:
args.item_group, args.brand = frappe.db.get_value("Item", args.item_code, ["item_group", "brand"])
except TypeError:
# invalid item_code
return item_details
if not args.item_group:
frappe.throw(_("Item Group not mentioned in item master for item {0}").format(args.item_code))

View File

@ -169,12 +169,22 @@ cur_frm.fields_dict['items'].grid.get_field("item_code").get_query = function(do
}
cur_frm.fields_dict['credit_to'].get_query = function(doc) {
return{
filters:{
'account_type': 'Payable',
'root_type': 'Liability',
'is_group': 0,
'company': doc.company
// filter on Account
if (doc.supplier) {
return {
filters: {
'account_type': 'Payable',
'is_group': 0,
'company': doc.company
}
}
} else {
return {
filters: {
'report_type': 'Balance Sheet',
'is_group': 0,
'company': doc.company
}
}
}
}

View File

@ -1710,7 +1710,7 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Details",
"label": "More Information",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-file-text",
@ -2175,7 +2175,7 @@
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"modified": "2015-08-26 12:33:12.303959",
"modified": "2015-08-27 03:21:24.432106",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",

View File

@ -91,8 +91,12 @@ class PurchaseInvoice(BuyingController):
throw(_("Conversion rate cannot be 0 or 1"))
def validate_credit_to_acc(self):
account_type = frappe.db.get_value("Account", self.credit_to, "account_type")
if account_type != "Payable":
account = frappe.db.get_value("Account", self.credit_to, ["account_type", "report_type"], as_dict=True)
if account.report_type != "Balance Sheet":
frappe.throw(_("Credit To account must be a Balance Sheet account"))
if self.supplier and account.account_type != "Payable":
frappe.throw(_("Credit To account must be a Payable account"))
def check_for_stopped_status(self):
@ -127,7 +131,7 @@ class PurchaseInvoice(BuyingController):
}
})
if cint(frappe.db.get_single_value('Buying Settings', 'maintain_same_rate')):
if cint(frappe.db.get_single_value('Buying Settings', 'maintain_same_rate')) and not self.is_return:
self.validate_rate_with_reference_doc([
["Purchase Order", "purchase_order", "po_detail"],
["Purchase Receipt", "purchase_receipt", "pr_detail"]

View File

@ -7,7 +7,7 @@ frappe.listview_settings['Purchase Invoice'] = {
"currency", "is_return"],
get_indicator: function(doc) {
if(cint(doc.is_return)==1) {
return [__("Return"), "darkgrey", "is_return,=,1"];
return [__("Return"), "darkgrey", "is_return,=,Yes"];
} else if(flt(doc.outstanding_amount) > 0 && doc.docstatus==1) {
if(frappe.datetime.get_diff(doc.due_date) < 0) {
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<,Today"];

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -32,6 +34,28 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -53,14 +77,18 @@
},
{
"allow_on_submit": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"bold": 0,
"collapsible": 1,
"fieldname": "description_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
@ -71,6 +99,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -94,6 +124,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@ -114,6 +146,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -135,6 +169,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@ -154,6 +190,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@ -175,6 +213,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -193,6 +233,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@ -213,6 +255,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@ -232,6 +276,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
@ -250,6 +296,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -270,6 +318,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "price_list_rate",
"fieldname": "discount_percentage",
"fieldtype": "Percent",
@ -290,6 +340,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -308,6 +360,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -328,6 +382,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sec_break2",
"fieldtype": "Section Break",
"hidden": 0,
@ -346,6 +402,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@ -368,6 +426,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@ -390,6 +450,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@ -408,6 +470,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -430,6 +494,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -452,6 +518,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"hidden": 0,
@ -472,6 +540,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_22",
"fieldtype": "Section Break",
"hidden": 0,
@ -491,6 +561,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -512,6 +584,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -533,6 +607,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_25",
"fieldtype": "Column Break",
"hidden": 0,
@ -552,6 +628,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -573,6 +651,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -594,6 +674,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "accounting",
"fieldtype": "Section Break",
"hidden": 0,
@ -613,6 +695,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
@ -637,6 +721,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@ -655,6 +741,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "project_name",
"fieldtype": "Link",
"hidden": 0,
@ -675,6 +763,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
@ -700,6 +790,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "reference",
"fieldtype": "Section Break",
"hidden": 0,
@ -719,6 +811,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "brand",
"fieldtype": "Data",
"hidden": 1,
@ -740,6 +834,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@ -763,6 +859,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
@ -785,6 +883,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_tax_amount",
"fieldtype": "Currency",
"hidden": 1,
@ -807,6 +907,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "purchase_order",
"fieldtype": "Link",
"hidden": 0,
@ -829,6 +931,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break6",
"fieldtype": "Column Break",
"hidden": 0,
@ -847,6 +951,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "po_detail",
"fieldtype": "Data",
"hidden": 1,
@ -868,6 +974,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "purchase_receipt",
"fieldtype": "Link",
"hidden": 0,
@ -890,6 +998,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@ -909,6 +1019,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pr_detail",
"fieldtype": "Data",
"hidden": 1,
@ -930,6 +1042,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 1,
@ -950,6 +1064,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rm_supp_cost",
"fieldtype": "Currency",
"hidden": 1,
@ -977,7 +1093,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:45:54.213558",
"modified": "2015-08-26 12:28:16.728059",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",

View File

@ -64,6 +64,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
if(doc.outstanding_amount!=0 && !cint(doc.is_return)) {
cur_frm.add_custom_button(__('Payment'), cur_frm.cscript.make_bank_entry).addClass("btn-primary");
}
}
// Show buttons only when pos view is active
@ -132,8 +133,8 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
},
is_pos: function(doc, dt, dn, callback_fn) {
if(cur_frm.doc.__missing_values_set) return;
cur_frm.cscript.hide_fields(this.frm.doc);
if(cur_frm.doc.__missing_values_set) return;
if(cint(this.frm.doc.is_pos)) {
if(!this.frm.doc.company) {
this.frm.set_value("is_pos", 0);
@ -426,10 +427,22 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
}
cur_frm.set_query("debit_to", function(doc) {
return{
filters: [
['Account', 'root_type', '=', 'Asset'],
['Account', 'account_type', '=', 'Receivable']
]
// filter on Account
if (doc.customer) {
return {
filters: {
'account_type': 'Receivable',
'is_group': 0,
'company': doc.company
}
}
} else {
return {
filters: {
'report_type': 'Balance Sheet',
'is_group': 0,
'company': doc.company
}
}
}
});

View File

@ -1983,7 +1983,7 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Properties",
"label": "More Information",
"no_copy": 0,
"options": "icon-bullhorn",
"permlevel": 0,
@ -2882,7 +2882,7 @@
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"modified": "2015-08-27 01:33:40.206780",
"modified": "2015-08-27 03:29:14.270731",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",

View File

@ -81,9 +81,14 @@ class SalesInvoice(SellingController):
self.check_prev_docstatus()
if self.is_return:
# NOTE status updating bypassed for is_return
self.status_updater = []
self.update_status_updater_args()
self.update_prevdoc_status()
if not self.is_return:
self.update_status_updater_args()
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Sales Order")
self.check_credit_limit()
@ -107,9 +112,14 @@ class SalesInvoice(SellingController):
from erpnext.accounts.utils import remove_against_link_from_jv
remove_against_link_from_jv(self.doctype, self.name)
if self.is_return:
# NOTE status updating bypassed for is_return
self.status_updater = []
self.update_status_updater_args()
self.update_prevdoc_status()
if not self.is_return:
self.update_status_updater_args()
self.update_prevdoc_status()
self.update_billing_status_for_zero_amount_refdoc("Sales Order")
self.validate_c_form_on_cancel()
@ -118,7 +128,7 @@ class SalesInvoice(SellingController):
def update_status_updater_args(self):
if cint(self.update_stock):
self.status_updater.append({
self.status_updater.extend([{
'source_dt':'Sales Invoice Item',
'target_dt':'Sales Order Item',
'target_parent_dt':'Sales Order',
@ -136,7 +146,21 @@ class SalesInvoice(SellingController):
'overflow_type': 'delivery',
'extra_cond': """ and exists(select name from `tabSales Invoice`
where name=`tabSales Invoice Item`.parent and ifnull(update_stock, 0) = 1)"""
})
},
{
'source_dt': 'Sales Invoice Item',
'target_dt': 'Sales Order Item',
'join_field': 'so_detail',
'target_field': 'returned_qty',
'target_parent_dt': 'Sales Order',
# 'target_parent_field': 'per_delivered',
# 'target_ref_field': 'qty',
'source_field': '-1 * qty',
# 'percent_join_field': 'sales_order',
# 'overflow_type': 'delivery',
'extra_cond': """ and exists (select name from `tabSales Invoice` where name=`tabSales Invoice Item`.parent and update_stock=1 and is_return=1)"""
}
])
def set_missing_values(self, for_validate=False):
pos = self.set_pos_fields(for_validate)
@ -247,8 +271,12 @@ class SalesInvoice(SellingController):
reconcile_against_document(lst)
def validate_debit_to_acc(self):
account_type = frappe.db.get_value("Account", self.debit_to, "account_type")
if account_type != "Receivable":
account = frappe.db.get_value("Account", self.debit_to, ["account_type", "report_type"], as_dict=True)
if account.report_type != "Balance Sheet":
frappe.throw(_("Debit To account must be a Balance Sheet account"))
if self.customer and account.account_type != "Receivable":
frappe.throw(_("Debit To account must be a Receivable account"))
def validate_fixed_asset_account(self):
@ -273,7 +301,7 @@ class SalesInvoice(SellingController):
},
})
if cint(frappe.db.get_single_value('Selling Settings', 'maintain_same_sales_rate')):
if cint(frappe.db.get_single_value('Selling Settings', 'maintain_same_sales_rate')) and not self.is_return:
self.validate_rate_with_reference_doc([
["Sales Order", "sales_order", "so_detail"],
["Delivery Note", "delivery_note", "dn_detail"]
@ -294,8 +322,6 @@ class SalesInvoice(SellingController):
def so_dn_required(self):
"""check in manage account if sales order / delivery note required or not."""
if self.is_return:
return
dic = {'Sales Order':'so_required','Delivery Note':'dn_required'}
for i in dic:
if frappe.db.get_value('Selling Settings', None, dic[i]) == 'Yes':
@ -415,35 +441,11 @@ class SalesInvoice(SellingController):
def check_prev_docstatus(self):
for d in self.get('items'):
if d.sales_order:
submitted = frappe.db.sql("""select name from `tabSales Order`
where docstatus = 1 and name = %s""", d.sales_order)
if not submitted:
frappe.throw(_("Sales Order {0} is not submitted").format(d.sales_order))
if d.sales_order and frappe.db.get_value("Sales Order", d.sales_order, "docstatus") != 1:
frappe.throw(_("Sales Order {0} is not submitted").format(d.sales_order))
if d.delivery_note:
submitted = frappe.db.sql("""select name from `tabDelivery Note`
where docstatus = 1 and name = %s""", d.delivery_note)
if not submitted:
throw(_("Delivery Note {0} is not submitted").format(d.delivery_note))
def update_stock_ledger(self):
sl_entries = []
for d in self.get_item_list():
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 and d.warehouse and flt(d['qty']):
self.update_reserved_qty(d)
incoming_rate = 0
if cint(self.is_return) and self.return_against and self.docstatus==1:
incoming_rate = self.get_incoming_rate_for_sales_return(d.item_code,
self.return_against)
sl_entries.append(self.get_sl_entries(d, {
"actual_qty": -1*flt(d.qty),
"stock_uom": frappe.db.get_value("Item", d.item_code, "stock_uom"),
"incoming_rate": incoming_rate
}))
self.make_sl_entries(sl_entries)
if d.delivery_note and frappe.db.get_value("Delivery Note", d.delivery_note, "docstatus") != 1:
throw(_("Delivery Note {0} is not submitted").format(d.delivery_note))
def make_gl_entries(self, repost_future_gle=True):
gl_entries = self.get_gl_entries()

View File

@ -7,7 +7,7 @@ frappe.listview_settings['Sales Invoice'] = {
"currency", "is_return"],
get_indicator: function(doc) {
if(cint(doc.is_return)==1) {
return [__("Return"), "darkgrey", "is_return,=,1"];
return [__("Return"), "darkgrey", "is_return,=,Yes"];
} else if(flt(doc.outstanding_amount)==0) {
return [__("Paid"), "green", "outstanding_amount,=,0"]
} else if (flt(doc.outstanding_amount) > 0 && doc.due_date > frappe.datetime.get_today()) {

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
@ -29,6 +31,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -51,6 +55,28 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -72,24 +98,8 @@
},
{
"allow_on_submit": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
@ -109,6 +119,30 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Edit Description",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -132,13 +166,14 @@
},
{
"allow_on_submit": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_8",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Image",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -152,6 +187,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -173,13 +210,37 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Image",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Quantity and Rate",
"label": "",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
@ -192,6 +253,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@ -213,6 +276,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -235,6 +300,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "price_list_rate",
"fieldname": "discount_percentage",
"fieldtype": "Percent",
@ -257,6 +324,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -275,6 +344,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@ -295,6 +366,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -317,6 +390,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break1",
"fieldtype": "Section Break",
"hidden": 0,
@ -335,6 +410,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@ -357,6 +434,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@ -379,6 +458,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -397,6 +478,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -419,6 +502,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -441,6 +526,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"hidden": 0,
@ -461,6 +548,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_21",
"fieldtype": "Section Break",
"hidden": 0,
@ -480,6 +569,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -501,6 +592,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -522,6 +615,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_24",
"fieldtype": "Column Break",
"hidden": 0,
@ -541,6 +636,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -562,6 +659,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -583,13 +682,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "accounting",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Accounting",
"label": "Accounting Details",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
@ -602,6 +703,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "income_account",
"fieldtype": "Link",
"hidden": 0,
@ -626,6 +729,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
@ -647,6 +752,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@ -665,6 +772,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
@ -690,13 +799,16 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "eval:doc.serial_no || doc.batch_no",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Warehouse and Reference",
"label": "Stock Details",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
@ -709,6 +821,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -731,6 +845,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "serial_no",
"fieldtype": "Small Text",
"hidden": 0,
@ -752,6 +868,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@ -772,6 +890,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@ -795,6 +915,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "brand",
"fieldtype": "Data",
"hidden": 1,
@ -816,6 +938,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
"hidden": 1,
@ -837,6 +961,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@ -855,6 +981,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "actual_batch_qty",
"fieldtype": "Float",
"hidden": 0,
@ -877,6 +1005,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
@ -898,6 +1028,30 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "edit_references",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "References",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "time_log_batch",
"fieldtype": "Link",
"hidden": 0,
@ -918,6 +1072,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sales_order",
"fieldtype": "Link",
"hidden": 0,
@ -940,6 +1096,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "so_detail",
"fieldtype": "Data",
"hidden": 1,
@ -961,6 +1119,29 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_50",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "delivery_note",
"fieldtype": "Link",
"hidden": 0,
@ -983,6 +1164,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "dn_detail",
"fieldtype": "Data",
"hidden": 1,
@ -1004,6 +1187,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "delivered_qty",
"fieldtype": "Float",
"hidden": 0,
@ -1023,8 +1208,31 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_54",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@ -1051,7 +1259,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:45:54.989734",
"modified": "2015-08-20 17:18:52.752064",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

View File

@ -1,17 +0,0 @@
{
"creation": "2015-07-22 17:45:22.220567",
"custom_format": 1,
"disabled": 0,
"doc_type": "Sales Invoice",
"docstatus": 0,
"doctype": "Print Format",
"font": "Default",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 6in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ doc.company }}<br>\n\t{{ doc.select_print_heading or _(\"Credit Note\") }}<br>\n</p>\n\n<hr>\n\n{%- for label, value in (\n (_(\"Receipt No\"), doc.name),\n (_(\"Date\"), doc.get_formatted(\"posting_date\")),\n\t(_(\"Customer\"), doc.customer_name),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"grand_total\", absolute_value=True) + \"</strong><br>\" + (doc.in_words or \"\")),\n\t(_(\"Against\"), doc.return_against),\n (_(\"Remarks\"), doc.remarks)\n) -%}\n\n\t\t<div class=\"row\">\n\t\t <div class=\"col-xs-4\"><label class=\"text-right\">{{ label }}</label></div>\n\t\t <div class=\"col-xs-8\">{{ value }}</div>\n\t\t</div>\n{%- endfor -%}\n\n<hr>\n<br>\n<p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n</p>",
"modified": "2015-07-22 17:45:22.220567",
"modified_by": "Administrator",
"name": "Credit Note - Negative Invoice",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"standard": "Yes"
}

View File

@ -18,7 +18,7 @@ frappe.query_reports["Accounts Payable"] = {
},
{
"fieldname":"report_date",
"label": __("Date"),
"label": __("As on Date"),
"fieldtype": "Date",
"default": get_today()
},

View File

@ -18,7 +18,7 @@ frappe.query_reports["Accounts Receivable"] = {
},
{
"fieldname":"report_date",
"label": __("Date"),
"label": __("As on Date"),
"fieldtype": "Date",
"default": get_today()
},

View File

@ -61,7 +61,7 @@ def get_result(filters, account_details):
return result
def get_gl_entries(filters):
group_by_condition = "group by voucher_type, voucher_no, account" \
group_by_condition = "group by voucher_type, voucher_no, account, cost_center" \
if filters.get("group_by_voucher") else "group by name"
gl_entries = frappe.db.sql("""select posting_date, account, party_type, party,

View File

@ -1,76 +1,209 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2013-06-25 11:04:03",
"custom": 0,
"description": "Settings for Buying Module",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Other",
"fields": [
{
"allow_on_submit": 0,
"default": "Supplier Name",
"fieldname": "supp_master_name",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Supplier Naming By",
"no_copy": 0,
"options": "Supplier Name\nNaming Series",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "supplier_type",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Supplier Type",
"no_copy": 0,
"options": "Supplier Type",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "buying_price_list",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Buying Price List",
"no_copy": 0,
"options": "Price List",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"fieldname": "maintain_same_rate",
"fieldtype": "Check",
"label": "Maintain same rate throughout purchase cycle",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "po_required",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Purchase Order Required",
"no_copy": 0,
"options": "No\nYes",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "pr_required",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Purchase Receipt Required",
"no_copy": 0,
"options": "No\nYes",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "maintain_same_rate",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Maintain same rate throughout purchase cycle",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "allow_multiple_items",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Allow Item to be added multiple times in a transaction",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-cog",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"modified": "2015-02-05 05:11:35.373253",
"istable": 0,
"modified": "2015-08-25 04:55:06.052342",
"modified_by": "Administrator",
"module": "Buying",
"name": "Buying Settings",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
]
],
"read_only": 0,
"read_only_onload": 0
}

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cstr
from frappe.utils import flt, cstr, cint
from frappe import _
from erpnext.stock.doctype.item.item import get_last_purchase_details
@ -72,7 +72,8 @@ class PurchaseCommon(BuyingController):
frappe.throw(_("{0} must be a Purchased or Sub-Contracted Item in row {1}").format(d.item_code, d.idx))
items.append(cstr(d.item_code))
if items and len(items) != len(set(items)):
if items and len(items) != len(set(items)) and \
not cint(frappe.db.get_single_value("Buying Settings", "allow_multiple_items") or 0):
frappe.msgprint(_("Warning: Same item has been entered multiple times."))

View File

@ -32,7 +32,8 @@ erpnext.buying.PurchaseOrderController = erpnext.buying.BuyingController.extend(
cur_frm.add_custom_button(__('Receive'), this.make_purchase_receipt).addClass("btn-primary");
if(doc.is_subcontracted==="Yes") {
cur_frm.add_custom_button(__('Transfer Material to Supplier'), this.make_stock_entry);
cur_frm.add_custom_button(__('Transfer Material to Supplier'),
function() { me.make_stock_entry(); });
}
}

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@ from frappe import msgprint, _, throw
from frappe.model.mapper import get_mapped_doc
from erpnext.controllers.buying_controller import BuyingController
from erpnext.stock.doctype.item.item import get_last_purchase_details
from erpnext.stock.stock_balance import update_bin_qty, get_ordered_qty
form_grid_templates = {
@ -136,20 +137,6 @@ class PurchaseOrder(BuyingController):
def update_ordered_qty(self, po_item_rows=None):
"""update requested qty (before ordered_qty is updated)"""
from erpnext.stock.utils import get_bin
def _update_ordered_qty(item_code, warehouse):
ordered_qty = frappe.db.sql("""
select sum((po_item.qty - ifnull(po_item.received_qty, 0))*po_item.conversion_factor)
from `tabPurchase Order Item` po_item, `tabPurchase Order` po
where po_item.item_code=%s and po_item.warehouse=%s
and po_item.qty > ifnull(po_item.received_qty, 0) and po_item.parent=po.name
and po.status!='Stopped' and po.docstatus=1""", (item_code, warehouse))
bin_doc = get_bin(item_code, warehouse)
bin_doc.ordered_qty = flt(ordered_qty[0][0]) if ordered_qty else 0
bin_doc.save()
item_wh_list = []
for d in self.get("items"):
if (not po_item_rows or d.name in po_item_rows) and [d.item_code, d.warehouse] not in item_wh_list \
@ -157,7 +144,9 @@ class PurchaseOrder(BuyingController):
item_wh_list.append([d.item_code, d.warehouse])
for item_code, warehouse in item_wh_list:
_update_ordered_qty(item_code, warehouse)
update_bin_qty(item_code, warehouse, {
"ordered_qty": get_ordered_qty(item_code, warehouse)
})
def check_modified_date(self):
mod_db = frappe.db.sql("select modified from `tabPurchase Order` where name = %s",
@ -176,6 +165,7 @@ class PurchaseOrder(BuyingController):
self.update_ordered_qty()
msgprint(_("Status of {0} {1} is now {2}").format(self.doctype, self.name, status))
self.notify_modified()
def on_submit(self):
super(PurchaseOrder, self).on_submit()
@ -248,8 +238,6 @@ def stop_or_unstop_purchase_orders(names, status):
if po.status == "Stopped":
po.update_status("Submitted")
po.notify_modified()
frappe.local.message_log = []

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -32,7 +34,9 @@
},
{
"allow_on_submit": 0,
"description": "If Supplier Part Number exists for given Item, it gets stored here",
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "supplier_part_no",
"fieldtype": "Data",
"hidden": 1,
@ -52,6 +56,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -73,6 +79,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_4",
"fieldtype": "Column Break",
"hidden": 0,
@ -92,6 +100,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "schedule_date",
"fieldtype": "Date",
"hidden": 0,
@ -113,12 +123,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -132,6 +145,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -155,6 +170,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -173,6 +190,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@ -193,6 +212,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -214,6 +235,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@ -233,6 +256,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@ -256,6 +281,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@ -280,6 +307,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -298,6 +327,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@ -322,6 +353,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@ -345,6 +378,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
@ -363,6 +398,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -383,6 +420,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "price_list_rate",
"fieldname": "discount_percentage",
"fieldtype": "Percent",
@ -403,6 +442,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -421,6 +462,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -441,6 +484,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sec_break2",
"fieldtype": "Section Break",
"hidden": 0,
@ -459,6 +504,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@ -481,6 +528,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@ -503,6 +552,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@ -521,6 +572,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -545,6 +598,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -567,6 +622,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"hidden": 0,
@ -587,6 +644,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_29",
"fieldtype": "Section Break",
"hidden": 0,
@ -606,6 +665,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -627,6 +688,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -648,6 +711,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_32",
"fieldtype": "Column Break",
"hidden": 0,
@ -667,6 +732,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -688,6 +755,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -709,6 +778,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@ -728,6 +799,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -750,6 +823,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "project_name",
"fieldtype": "Link",
"hidden": 0,
@ -770,6 +845,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_doctype",
"fieldtype": "Data",
"hidden": 1,
@ -791,6 +868,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_docname",
"fieldtype": "Link",
"hidden": 0,
@ -815,6 +894,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_detail_docname",
"fieldtype": "Data",
"hidden": 1,
@ -836,6 +917,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "supplier_quotation",
"fieldtype": "Link",
"hidden": 0,
@ -856,6 +939,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "supplier_quotation_item",
"fieldtype": "Link",
"hidden": 1,
@ -876,6 +961,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@ -894,6 +981,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@ -917,6 +1006,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@ -939,6 +1030,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "bom",
"fieldtype": "Link",
"hidden": 0,
@ -960,6 +1053,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@ -983,6 +1078,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "received_qty",
"fieldtype": "Float",
"hidden": 0,
@ -1004,6 +1101,31 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "returned_qty",
"fieldname": "returned_qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Returned Qty",
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "billed_amt",
"fieldtype": "Currency",
"hidden": 0,
@ -1024,6 +1146,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
@ -1046,6 +1170,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@ -1074,7 +1200,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:46:32.384796",
"modified": "2015-08-27 02:29:53.767477",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -32,7 +34,9 @@
},
{
"allow_on_submit": 0,
"description": "If Supplier Part Number exists for given Item, it gets stored here",
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "supplier_part_no",
"fieldtype": "Data",
"hidden": 1,
@ -52,6 +56,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
@ -71,6 +77,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -85,19 +93,22 @@
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -111,6 +122,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -134,6 +147,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -152,6 +167,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@ -172,6 +189,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -193,6 +212,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@ -212,6 +233,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@ -235,6 +258,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -255,6 +280,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "price_list_rate",
"fieldname": "discount_percentage",
"fieldtype": "Percent",
@ -275,6 +302,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -293,6 +322,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@ -317,6 +348,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -337,6 +370,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
@ -355,6 +390,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@ -377,6 +414,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@ -399,6 +438,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -417,6 +458,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -441,6 +484,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -463,6 +508,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"hidden": 0,
@ -483,6 +530,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_24",
"fieldtype": "Section Break",
"hidden": 0,
@ -502,6 +551,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -522,6 +573,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -543,6 +596,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_27",
"fieldtype": "Column Break",
"hidden": 0,
@ -562,6 +617,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -583,6 +640,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -604,6 +663,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@ -623,6 +684,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -645,6 +708,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "project_name",
"fieldtype": "Link",
"hidden": 0,
@ -665,6 +730,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_doctype",
"fieldtype": "Data",
"hidden": 1,
@ -686,6 +753,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_docname",
"fieldtype": "Link",
"hidden": 0,
@ -710,6 +779,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@ -728,6 +799,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_detail_docname",
"fieldtype": "Data",
"hidden": 1,
@ -749,6 +822,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 0,
@ -771,6 +846,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@ -794,6 +871,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
@ -816,6 +895,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@ -844,7 +925,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:46:33.355334",
"modified": "2015-08-26 11:51:55.140967",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Item",

View File

@ -0,0 +1,2 @@
- Most transaction forms will now have collapsibe sections so that forms appear to be more organized and you can easily locate parts to be edited.
- The document title on most transactions can be edited so that you can set meaningful titles to all transactions like Sales Invoice and also edit it to denote status.

View File

@ -0,0 +1,5 @@
- Fixes in Sales and Purchase Return
- Update Delivered, Ordered and Returned Quantity based on Return transaction
- Allow different Rate in Return transaction
- Set default Finished Goods and Work-in-Progress Warehouse in Manufacturing Settings
- Fixed range validation for numeric attributes in Item Variants

View File

@ -205,10 +205,10 @@ def get_project_name(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select `tabProject`.name from `tabProject`
where `tabProject`.status not in ("Completed", "Cancelled")
and %(cond)s `tabProject`.name like "%(txt)s" %(mcond)s
and {cond} `tabProject`.name like %s {match_cond}
order by `tabProject`.name asc
limit %(start)s, %(page_len)s """ % {'cond': cond,'txt': "%%%s%%" % frappe.db.escape(txt),
'mcond':get_match_cond(doctype),'start': start, 'page_len': page_len})
limit {start}, {page_len}""".format(cond=cond, match_cond=get_match_cond(doctype),
start=start, page_len=page_len), "%{0}%".format(txt))
def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""select `tabDelivery Note`.name, `tabDelivery Note`.customer_name
@ -232,7 +232,7 @@ def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
cond = ""
if filters.get("posting_date"):
cond = "and (ifnull(batch.expiry_date, '')='' or batch.expiry_date >= %(posting_date)s)"
batch_nos = None
args = {
'item_code': filters.get("item_code"),

View File

@ -11,10 +11,10 @@ class StockOverReturnError(frappe.ValidationError): pass
def validate_return(doc):
if not doc.meta.get_field("is_return") or not doc.is_return:
return
validate_return_against(doc)
validate_returned_items(doc)
def validate_return_against(doc):
if not doc.return_against:
frappe.throw(_("{0} is mandatory for Return").format(doc.meta.get_label("return_against")))
@ -24,49 +24,49 @@ def validate_return_against(doc):
filters["customer"] = doc.customer
elif doc.meta.get_field("supplier"):
filters["supplier"] = doc.supplier
if not frappe.db.exists(filters):
frappe.throw(_("Invalid {0}: {1}")
.format(doc.meta.get_label("return_against"), doc.return_against))
else:
ref_doc = frappe.get_doc(doc.doctype, doc.return_against)
# validate posting date time
return_posting_datetime = "%s %s" % (doc.posting_date, doc.get("posting_time") or "00:00:00")
ref_posting_datetime = "%s %s" % (ref_doc.posting_date, ref_doc.get("posting_time") or "00:00:00")
if get_datetime(return_posting_datetime) < get_datetime(ref_posting_datetime):
frappe.throw(_("Posting timestamp must be after {0}").format(format_datetime(ref_posting_datetime)))
# validate same exchange rate
if doc.conversion_rate != ref_doc.conversion_rate:
frappe.throw(_("Exchange Rate must be same as {0} {1} ({2})")
.format(doc.doctype, doc.return_against, ref_doc.conversion_rate))
# validate update stock
if doc.doctype == "Sales Invoice" and doc.update_stock and not ref_doc.update_stock:
frappe.throw(_("'Update Stock' can not be checked because items are not delivered via {0}")
.format(doc.return_against))
def validate_returned_items(doc):
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
valid_items = frappe._dict()
select_fields = "item_code, sum(qty) as qty, rate" if doc.doctype=="Purchase Invoice" \
else "item_code, sum(qty) as qty, rate, serial_no, batch_no"
for d in frappe.db.sql("""select {0} from `tab{1} Item` where parent = %s
for d in frappe.db.sql("""select {0} from `tab{1} Item` where parent = %s
group by item_code""".format(select_fields, doc.doctype), doc.return_against, as_dict=1):
valid_items.setdefault(d.item_code, d)
valid_items.setdefault(d.item_code, d)
if doc.doctype in ("Delivery Note", "Sales Invoice"):
for d in frappe.db.sql("""select item_code, sum(qty) as qty, serial_no, batch_no from `tabPacked Item`
for d in frappe.db.sql("""select item_code, sum(qty) as qty, serial_no, batch_no from `tabPacked Item`
where parent = %s group by item_code""".format(doc.doctype), doc.return_against, as_dict=1):
valid_items.setdefault(d.item_code, d)
already_returned_items = get_already_returned_items(doc)
items_returned = False
for d in doc.get("items"):
if flt(d.qty) < 0:
@ -77,15 +77,12 @@ def validate_returned_items(doc):
ref = valid_items.get(d.item_code, frappe._dict())
already_returned_qty = flt(already_returned_items.get(d.item_code))
max_return_qty = flt(ref.qty) - already_returned_qty
if already_returned_qty >= ref.qty:
frappe.throw(_("Item {0} has already been returned").format(d.item_code), StockOverReturnError)
elif abs(d.qty) > max_return_qty:
frappe.throw(_("Row # {0}: Cannot return more than {1} for Item {2}")
.format(d.idx, ref.qty, d.item_code), StockOverReturnError)
elif ref.rate and flt(d.rate) != ref.rate:
frappe.throw(_("Row # {0}: Rate must be same as {1} {2}")
.format(d.idx, doc.doctype, doc.return_against))
elif ref.batch_no and d.batch_no != ref.batch_no:
frappe.throw(_("Row # {0}: Batch No must be same as {1} {2}")
.format(d.idx, doc.doctype, doc.return_against))
@ -99,24 +96,24 @@ def validate_returned_items(doc):
if s not in ref_serial_nos:
frappe.throw(_("Row # {0}: Serial No {1} does not match with {2} {3}")
.format(d.idx, s, doc.doctype, doc.return_against))
items_returned = True
if not items_returned:
frappe.throw(_("Atleast one item should be entered with negative quantity in return document"))
def get_already_returned_items(doc):
return frappe._dict(frappe.db.sql("""
select
select
child.item_code, sum(abs(child.qty)) as qty
from
`tab{0} Item` child, `tab{1}` par
where
from
`tab{0} Item` child, `tab{1}` par
where
child.parent = par.name and par.docstatus = 1
and ifnull(par.is_return, 0) = 1 and par.return_against = %s and child.qty < 0
and ifnull(par.is_return, 0) = 1 and par.return_against = %s and child.qty < 0
group by item_code
""".format(doc.doctype, doc.doctype), doc.return_against))
def make_return_doc(doctype, source_name, target_doc=None):
from frappe.model.mapper import get_mapped_doc
def set_missing_values(source, target):
@ -126,25 +123,50 @@ def make_return_doc(doctype, source_name, target_doc=None):
doc.ignore_pricing_rule = 1
if doctype == "Sales Invoice":
doc.is_pos = 0
# look for Print Heading "Credit Note"
if not doc.select_print_heading:
doc.select_print_heading = frappe.db.get_value("Print Heading", _("Credit Note"))
elif doctype == "Purchase Invoice":
# look for Print Heading "Debit Note"
doc.select_print_heading = frappe.db.get_value("Print Heading", _("Debit Note"))
for tax in doc.get("taxes"):
if tax.charge_type == "Actual":
tax.tax_amount = -1 * tax.tax_amount
doc.run_method("calculate_taxes_and_totals")
def update_item(source_doc, target_doc, source_parent):
target_doc.qty = -1* source_doc.qty
if doctype == "Purchase Receipt":
target_doc.received_qty = -1* source_doc.qty
target_doc.prevdoc_doctype = source_doc.prevdoc_doctype
target_doc.prevdoc_docname = source_doc.prevdoc_docname
target_doc.prevdoc_detail_docname = source_doc.prevdoc_detail_docname
elif doctype == "Purchase Invoice":
target_doc.purchase_order = source_doc.purchase_order
target_doc.purchase_receipt = source_doc.purchase_receipt
target_doc.po_detail = source_doc.po_detail
target_doc.pr_detail = source_doc.pr_detail
elif doctype == "Delivery Note":
target_doc.against_sales_order = source_doc.against_sales_order
target_doc.against_sales_invoice = source_doc.against_sales_invoice
target_doc.so_detail = source_doc.so_detail
target_doc.si_detail = source_doc.si_detail
target_doc.expense_account = source_doc.expense_account
elif doctype == "Sales Invoice":
target_doc.sales_order = source_doc.sales_order
target_doc.delivery_note = source_doc.delivery_note
target_doc.so_detail = source_doc.so_detail
target_doc.dn_detail = source_doc.dn_detail
target_doc.expense_account = source_doc.expense_account
doclist = get_mapped_doc(doctype, source_name, {
doctype: {
"doctype": doctype,
"validation": {
"docstatus": ["=", 1],
}
@ -152,8 +174,6 @@ def make_return_doc(doctype, source_name, target_doc=None):
doctype +" Item": {
"doctype": doctype + " Item",
"field_map": {
"purchase_order": "purchase_order",
"purchase_receipt": "purchase_receipt",
"serial_no": "serial_no",
"batch_no": "batch_no"
},

View File

@ -163,42 +163,17 @@ class SellingController(StockController):
def get_item_list(self):
il = []
for d in self.get("items"):
reserved_warehouse = ""
reserved_qty_for_main_item = 0
if d.qty is None:
frappe.throw(_("Row {0}: Qty is mandatory").format(d.idx))
if self.doctype == "Sales Order":
reserved_warehouse = d.warehouse
if flt(d.qty) > flt(d.delivered_qty):
reserved_qty_for_main_item = flt(d.qty) - flt(d.delivered_qty)
elif (((self.doctype == "Delivery Note" and d.against_sales_order)
or (self.doctype == "Sales Invoice" and d.sales_order and self.update_stock))
and not self.is_return):
# if SO qty is 10 and there is tolerance of 20%, then it will allow DN of 12.
# But in this case reserved qty should only be reduced by 10 and not 12
already_delivered_qty = self.get_already_delivered_qty(self.name,
d.against_sales_order if self.doctype=="Delivery Note" else d.sales_order, d.so_detail)
so_qty, reserved_warehouse = self.get_so_qty_and_warehouse(d.so_detail)
if already_delivered_qty + d.qty > so_qty:
reserved_qty_for_main_item = -(so_qty - already_delivered_qty)
else:
reserved_qty_for_main_item = -flt(d.qty)
if self.has_product_bundle(d.item_code):
for p in self.get("packed_items"):
if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
# the packing details table's qty is already multiplied with parent's qty
il.append(frappe._dict({
'warehouse': p.warehouse,
'reserved_warehouse': reserved_warehouse,
'item_code': p.item_code,
'qty': flt(p.qty),
'reserved_qty': (flt(p.qty)/flt(d.qty)) * reserved_qty_for_main_item,
'uom': p.uom,
'batch_no': cstr(p.batch_no).strip(),
'serial_no': cstr(p.serial_no).strip(),
@ -207,10 +182,8 @@ class SellingController(StockController):
else:
il.append(frappe._dict({
'warehouse': d.warehouse,
'reserved_warehouse': reserved_warehouse,
'item_code': d.item_code,
'qty': d.qty,
'reserved_qty': reserved_qty_for_main_item,
'uom': d.stock_uom,
'stock_uom': d.stock_uom,
'batch_no': cstr(d.get("batch_no")).strip(),

View File

@ -90,6 +90,10 @@ class StatusUpdater(Document):
self.global_tolerance = None
for args in self.status_updater:
if "target_ref_field" not in args:
# if target_ref_field is not specified, the programmer does not want to validate qty / amount
continue
# get unique transactions to update
for d in self.get_all_children():
if d.doctype == args['source_dt'] and d.get(args["join_field"]):
@ -140,8 +144,9 @@ class StatusUpdater(Document):
.format(_(item["target_ref_field"].title()), item["reduce_by"]))
def update_qty(self, change_modified=True):
"""
Updates qty at row level
"""Updates qty or amount at row level
:param change_modified: If true, updates `modified` and `modified_by` for target parent doc
"""
for args in self.status_updater:
# condition to include current record (if submit or no if cancel)
@ -150,58 +155,74 @@ class StatusUpdater(Document):
else:
args['cond'] = ' and parent!="%s"' % self.name.replace('"', '\"')
args['modified_cond'] = ''
args['set_modified'] = ''
if change_modified:
args['modified_cond'] = ', modified = now()'
args['set_modified'] = ', modified = now(), modified_by = "{0}"'\
.format(frappe.db.escape(frappe.session.user))
# update quantities in child table
for d in self.get_all_children():
if d.doctype == args['source_dt']:
# updates qty in the child table
args['detail_id'] = d.get(args['join_field'])
self._update_children(args)
args['second_source_condition'] = ""
if args.get('second_source_dt') and args.get('second_source_field') \
and args.get('second_join_field'):
if not args.get("second_source_extra_cond"):
args["second_source_extra_cond"] = ""
if "percent_join_field" in args:
self._update_percent_field(args)
args['second_source_condition'] = """ + ifnull((select sum(%(second_source_field)s)
from `tab%(second_source_dt)s`
where `%(second_join_field)s`="%(detail_id)s"
and (`tab%(second_source_dt)s`.docstatus=1) %(second_source_extra_cond)s), 0) """ % args
def _update_children(self, args):
"""Update quantities or amount in child table"""
for d in self.get_all_children():
if d.doctype != args['source_dt']:
continue
if args['detail_id']:
if not args.get("extra_cond"): args["extra_cond"] = ""
# updates qty in the child table
args['detail_id'] = d.get(args['join_field'])
frappe.db.sql("""update `tab%(target_dt)s`
set %(target_field)s = (select sum(%(source_field)s)
from `tab%(source_dt)s` where `%(join_field)s`="%(detail_id)s"
and (docstatus=1 %(cond)s) %(extra_cond)s) %(second_source_condition)s
where name='%(detail_id)s'""" % args)
args['second_source_condition'] = ""
if args.get('second_source_dt') and args.get('second_source_field') \
and args.get('second_join_field'):
if not args.get("second_source_extra_cond"):
args["second_source_extra_cond"] = ""
# get unique transactions to update
for name in set([d.get(args['percent_join_field']) for d in self.get_all_children(args['source_dt'])]):
if name:
args['name'] = name
args['second_source_condition'] = """ + ifnull((select sum(%(second_source_field)s)
from `tab%(second_source_dt)s`
where `%(second_join_field)s`="%(detail_id)s"
and (`tab%(second_source_dt)s`.docstatus=1) %(second_source_extra_cond)s), 0) """ % args
# update percent complete in the parent table
if args.get('target_parent_field'):
frappe.db.sql("""update `tab%(target_parent_dt)s`
set %(target_parent_field)s = (select sum(if(%(target_ref_field)s >
ifnull(%(target_field)s, 0), %(target_field)s,
%(target_ref_field)s))/sum(%(target_ref_field)s)*100
from `tab%(target_dt)s` where parent="%(name)s") %(modified_cond)s
where name='%(name)s'""" % args)
if args['detail_id']:
if not args.get("extra_cond"): args["extra_cond"] = ""
# update field
if args.get('status_field'):
frappe.db.sql("""update `tab%(target_parent_dt)s`
set %(status_field)s = if(ifnull(%(target_parent_field)s,0)<0.001,
'Not %(keyword)s', if(%(target_parent_field)s>=99.99,
'Fully %(keyword)s', 'Partly %(keyword)s'))
where name='%(name)s'""" % args)
frappe.db.sql("""update `tab%(target_dt)s`
set %(target_field)s = (select sum(%(source_field)s)
from `tab%(source_dt)s` where `%(join_field)s`="%(detail_id)s"
and (docstatus=1 %(cond)s) %(extra_cond)s) %(second_source_condition)s
where name='%(detail_id)s'""" % args)
def _update_percent_field(self, args):
"""Update percent field in parent transaction"""
unique_transactions = set([d.get(args['percent_join_field']) for d in self.get_all_children(args['source_dt'])])
for name in unique_transactions:
if not name:
continue
args['name'] = name
# update percent complete in the parent table
if args.get('target_parent_field'):
frappe.db.sql("""update `tab%(target_parent_dt)s`
set %(target_parent_field)s = (select sum(if(%(target_ref_field)s >
ifnull(%(target_field)s, 0), %(target_field)s,
%(target_ref_field)s))/sum(%(target_ref_field)s)*100
from `tab%(target_dt)s` where parent="%(name)s") %(set_modified)s
where name='%(name)s'""" % args)
# update field
if args.get('status_field'):
frappe.db.sql("""update `tab%(target_parent_dt)s`
set %(status_field)s = if(ifnull(%(target_parent_field)s,0)<0.001,
'Not %(keyword)s', if(%(target_parent_field)s>=99.99,
'Fully %(keyword)s', 'Partly %(keyword)s'))
where name='%(name)s'""" % args)
if args.get("set_modified"):
frappe.get_doc(args["target_parent_dt"], name).notify_modified()
def update_billing_status_for_zero_amount_refdoc(self, ref_dt):
ref_fieldname = ref_dt.lower().replace(" ", "_")

View File

@ -6,11 +6,9 @@ import frappe
from frappe.utils import cint, flt, cstr
from frappe import msgprint, _
import frappe.defaults
from erpnext.accounts.general_ledger import make_gl_entries, delete_gl_entries, process_gl_map
from erpnext.controllers.accounts_controller import AccountsController
from erpnext.accounts.general_ledger import make_gl_entries, delete_gl_entries, process_gl_map
from erpnext.stock.utils import update_bin
class StockController(AccountsController):
def make_gl_entries(self, repost_future_gle=True):
@ -230,22 +228,44 @@ class StockController(AccountsController):
return incoming_rate
def update_reserved_qty(self, d):
if d['reserved_qty'] < 0 :
# Reduce reserved qty from reserved warehouse mentioned in so
if not d["reserved_warehouse"]:
frappe.throw(_("Delivery Warehouse is missing in Sales Order"))
def update_reserved_qty(self):
so_map = {}
for d in self.get("items"):
if d.so_detail:
if self.doctype == "Delivery Note" and d.against_sales_order:
so_map.setdefault(d.against_sales_order, []).append(d.so_detail)
elif self.doctype == "Sales Invoice" and d.sales_order and self.update_stock:
so_map.setdefault(d.sales_order, []).append(d.so_detail)
args = {
"item_code": d['item_code'],
"warehouse": d["reserved_warehouse"],
"voucher_type": self.doctype,
"voucher_no": self.name,
"reserved_qty": (self.docstatus==1 and 1 or -1)*flt(d['reserved_qty']),
"posting_date": self.posting_date,
"is_amended": self.amended_from and 'Yes' or 'No'
}
update_bin(args)
for so, so_item_rows in so_map.items():
if so and so_item_rows:
sales_order = frappe.get_doc("Sales Order", so)
if sales_order.status in ["Stopped", "Cancelled"]:
frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Sales Order"), so),
frappe.InvalidStatusError)
sales_order.update_reserved_qty(so_item_rows)
def update_stock_ledger(self):
self.update_reserved_qty()
sl_entries = []
for d in self.get_item_list():
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 \
and d.warehouse and flt(d['qty']):
incoming_rate = 0
if cint(self.is_return) and self.return_against and self.docstatus==1:
incoming_rate = self.get_incoming_rate_for_sales_return(d.item_code, self.return_against)
sl_entries.append(self.get_sl_entries(d, {
"actual_qty": -1*flt(d['qty']),
"stock_uom": frappe.db.get_value("Item", d.item_code, "stock_uom"),
"incoming_rate": incoming_rate
}))
self.make_sl_entries(sl_entries)
def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for_items=None,
warehouse_account=None):

View File

@ -1,74 +1,160 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 0,
"autoname": "naming_series:",
"creation": "2013-04-10 11:45:37",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "lead_details",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"options": "icon-user",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Series",
"no_copy": 1,
"oldfieldname": "naming_series",
"oldfieldtype": "Select",
"options": "LEAD-",
"permlevel": 0,
"reqd": 0
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "lead_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Person Name",
"no_copy": 0,
"oldfieldname": "lead_name",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Organization Name",
"no_copy": 0,
"oldfieldname": "company_name",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "email_id",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Email Id",
"no_copy": 0,
"oldfieldname": "email_id",
"oldfieldtype": "Data",
"options": "Email",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break123",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Lead",
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Status",
@ -77,12 +163,22 @@
"oldfieldtype": "Select",
"options": "Lead\nOpen\nReplied\nOpportunity\nInterested\nConverted\nDo Not Contact",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "source",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Source",
@ -91,260 +187,628 @@
"oldfieldtype": "Select",
"options": "\nAdvertisement\nBlog Post\nCampaign\nCall\nCustomer\nExhibition\nSupplier\nWebsite\nEmail",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.source == 'Customer'",
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "From Customer",
"no_copy": 0,
"oldfieldname": "customer",
"oldfieldtype": "Link",
"options": "Customer",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.source == 'Campaign'",
"description": "",
"fieldname": "campaign_name",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Campaign Name",
"no_copy": 0,
"oldfieldname": "campaign_name",
"oldfieldtype": "Link",
"options": "Campaign",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_12",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": ""
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "__user",
"fieldname": "lead_owner",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Lead Owner",
"no_copy": 0,
"oldfieldname": "lead_owner",
"oldfieldtype": "Link",
"options": "User",
"permlevel": 0,
"search_index": 1
},
{
"fieldname": "column_break_14",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_14",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_by",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Next Contact By",
"no_copy": 0,
"oldfieldname": "contact_by",
"oldfieldtype": "Link",
"options": "User",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "100px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Add to calendar on this date",
"fieldname": "contact_date",
"fieldtype": "Datetime",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Next Contact Date",
"no_copy": 1,
"oldfieldname": "contact_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "100px"
},
{
"fieldname": "fold",
"fieldtype": "Fold",
"label": "fold",
"permlevel": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "contact_info",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Address & Contact",
"no_copy": 0,
"oldfieldtype": "Column Break",
"options": "icon-map-marker",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.__islocal",
"fieldname": "address_desc",
"fieldtype": "HTML",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Address Desc",
"no_copy": 0,
"options": "<em>Addresses will appear only when you save the lead</em>",
"permlevel": 0,
"print_hide": 1
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "address_html",
"fieldtype": "HTML",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Address HTML",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 1
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break2",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "phone",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Phone",
"no_copy": 0,
"oldfieldname": "contact_no",
"oldfieldtype": "Data",
"permlevel": 0,
"reqd": 0
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "mobile_no",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Mobile No.",
"no_copy": 0,
"oldfieldname": "mobile_no",
"oldfieldtype": "Data",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fax",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Fax",
"no_copy": 0,
"oldfieldname": "fax",
"oldfieldtype": "Data",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "website",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Website",
"no_copy": 0,
"oldfieldname": "website",
"oldfieldtype": "Data",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Territory",
"no_copy": 0,
"oldfieldname": "territory",
"oldfieldtype": "Link",
"options": "Territory",
"permlevel": 0,
"print_hide": 1
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Info",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Information",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-file-text",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Lead Type",
"no_copy": 0,
"oldfieldname": "type",
"oldfieldtype": "Select",
"options": "\nClient\nChannel Partner\nConsultant",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "market_segment",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Market Segment",
"no_copy": 0,
"oldfieldname": "market_segment",
"oldfieldtype": "Select",
"options": "\nLower Income\nMiddle Income\nUpper Income",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "industry",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Industry",
"no_copy": 0,
"oldfieldname": "industry",
"oldfieldtype": "Link",
"options": "Industry Type",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "request_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Request Type",
"no_copy": 0,
"oldfieldname": "request_type",
"oldfieldtype": "Select",
"options": "\nProduct Enquiry\nRequest for Information\nSuggestions\nOther",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"reqd": 0
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "unsubscribed",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Unsubscribed",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "blog_subscriber",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Blog Subscriber",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-user",
"idx": 1,
"modified": "2015-07-03 03:26:18.579905",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-08-27 03:26:48.324207",
"modified_by": "Administrator",
"module": "CRM",
"name": "Lead",
@ -352,86 +816,127 @@
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 1,
"print": 0,
"read": 1,
"report": 1,
"role": "All",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"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": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 1,
"print": 0,
"read": 1,
"report": 1,
"role": "Sales Manager",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 1,
"print": 0,
"read": 1,
"report": 1,
"role": "Sales User",
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
],
"read_only": 0,
"read_only_onload": 0,
"search_fields": "lead_name,lead_owner,status",
"sort_field": "modified",
"sort_order": "DESC",

View File

@ -1,15 +1,23 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.ui.form.on_change("Opportunity", "customer", function(frm) {
erpnext.utils.get_party_details(frm) });
frappe.ui.form.on_change("Opportunity", "customer_address", erpnext.utils.get_address_display);
frappe.ui.form.on_change("Opportunity", "contact_person", erpnext.utils.get_contact_details);
frappe.provide("erpnext.crm");
frappe.require("assets/erpnext/js/utils.js");
cur_frm.email_field = "contact_email";
frappe.ui.form.on("Opportunity", {
customer: function(frm) {
erpnext.utils.get_party_details(frm);
},
customer_address: erpnext.utils.get_address_display,
contact_person: erpnext.utils.get_contact_details,
enquiry_from: function(frm) {
frm.toggle_reqd("lead", frm.doc.enquiry_from==="Lead");
frm.toggle_reqd("customer", frm.doc.enquiry_from==="Customer");
},
refresh: function(frm) {
frm.events.enquiry_from(frm);
}
})
// TODO commonify this code
erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
@ -21,14 +29,11 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
if(!this.frm.doc.status)
set_multiple(cdt, cdn, { status:'Draft' });
if(!this.frm.doc.date)
this.frm.doc.transaction_date = date.obj_to_str(new Date());
if(!this.frm.doc.company && frappe.defaults.get_user_default("company"))
set_multiple(cdt, cdn, { company:frappe.defaults.get_user_default("company") });
if(!this.frm.doc.fiscal_year && sys_defaults.fiscal_year)
set_multiple(cdt, cdn, { fiscal_year:sys_defaults.fiscal_year });
this.setup_queries();
},

View File

@ -12,6 +12,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "from_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -32,6 +34,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@ -54,6 +58,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "enquiry_from",
"fieldtype": "Select",
"hidden": 0,
@ -76,6 +82,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"depends_on": "eval:doc.enquiry_from===\"Customer\"",
"fieldname": "customer",
"fieldtype": "Link",
@ -99,6 +107,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"depends_on": "eval:doc.enquiry_from===\"Lead\"",
"fieldname": "lead",
"fieldtype": "Link",
@ -122,6 +132,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "customer_name",
"fieldtype": "Data",
@ -142,6 +154,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
@ -162,14 +176,17 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Title",
"no_copy": 0,
"options": "[{status}] {enquiry_type} from {customer}",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -182,6 +199,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Sales",
"fieldname": "enquiry_type",
"fieldtype": "Select",
@ -205,6 +224,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Open",
"fieldname": "status",
"fieldtype": "Select",
@ -228,6 +249,30 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.status===\"Lost\"",
"fieldname": "order_lost_reason",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Lost Reason",
"no_copy": 1,
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "with_items",
"fieldtype": "Check",
"hidden": 0,
@ -248,6 +293,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "with_items",
"fieldname": "items_section",
"fieldtype": "Section Break",
@ -270,6 +317,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "items",
"fieldtype": "Table",
@ -293,24 +342,9 @@
},
{
"allow_on_submit": 0,
"fieldname": "fold",
"fieldtype": "Fold",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "next_contact_by",
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_info",
"fieldtype": "Section Break",
@ -332,6 +366,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.customer || doc.lead",
"fieldname": "customer_address",
"fieldtype": "Link",
@ -353,6 +389,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 1,
@ -374,6 +412,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "customer",
"description": "",
"fieldname": "territory",
@ -396,6 +436,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "customer",
"description": "",
"fieldname": "customer_group",
@ -420,6 +462,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -438,6 +482,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_person",
"fieldtype": "Link",
@ -459,6 +505,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "customer",
"fieldname": "contact_display",
"fieldtype": "Small Text",
@ -479,6 +527,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_email",
"fieldtype": "Small Text",
@ -499,6 +549,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.lead || doc.customer",
"fieldname": "contact_mobile",
"fieldtype": "Small Text",
@ -519,13 +571,16 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "",
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Info",
"label": "Source",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-file-text",
@ -540,71 +595,8 @@
},
{
"allow_on_submit": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"default": "Today",
"fieldname": "transaction_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Opportunity Date",
"no_copy": 0,
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50px"
},
{
"allow_on_submit": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "source",
"fieldtype": "Select",
"hidden": 0,
@ -627,6 +619,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Enter name of campaign if source of enquiry is campaign",
"fieldname": "campaign",
"fieldtype": "Link",
@ -650,6 +644,79 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Today",
"fieldname": "transaction_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Opportunity Date",
"no_copy": 0,
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
@ -672,18 +739,21 @@
},
{
"allow_on_submit": 0,
"depends_on": "eval:!doc.__islocal",
"fieldname": "order_lost_reason",
"fieldtype": "Text",
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "contact_by",
"fieldname": "next_contact",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Lost Reason",
"no_copy": 1,
"label": "Next Contact",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -692,26 +762,8 @@
},
{
"allow_on_submit": 0,
"fieldname": "column_break2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Your sales person who will contact the customer in future",
"fieldname": "contact_by",
"fieldtype": "Link",
@ -736,6 +788,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Your sales person will get a reminder on this date to contact the customer",
"fieldname": "contact_date",
"fieldtype": "Datetime",
@ -758,6 +812,30 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "to_discuss",
"fieldtype": "Small Text",
"hidden": 0,
@ -779,6 +857,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@ -810,7 +890,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-08-07 17:11:33.955441",
"modified": "2015-08-26 06:56:09.914606",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity",

View File

@ -27,7 +27,7 @@ blogs.
"""
app_icon = "icon-th"
app_color = "#e74c3c"
app_version = "5.7.5"
app_version = "5.8.2"
github_link = "https://github.com/frappe/erpnext"
error_report_email = "support@erpnext.com"

View File

@ -1,123 +1,320 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2014-11-27 14:12:07.542534",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2014-11-27 14:12:07.542534",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
"fields": [
{
"fieldname": "capacity_planning",
"fieldtype": "Section Break",
"label": "Capacity Planning",
"permlevel": 0,
"precision": ""
},
"allow_on_submit": 0,
"fieldname": "capacity_planning",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Capacity Planning",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"description": "Disables creation of time logs against Production Orders.\nOperations shall not be tracked against Production Order",
"fieldname": "disable_capacity_planning",
"fieldtype": "Check",
"label": "Disable Capacity Planning and Time Tracking",
"permlevel": 0,
"precision": ""
},
"allow_on_submit": 0,
"description": "Disables creation of time logs against Production Orders.\nOperations shall not be tracked against Production Order",
"fieldname": "disable_capacity_planning",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Disable Capacity Planning and Time Tracking",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"description": "Plan time logs outside Workstation Working Hours.",
"fieldname": "allow_overtime",
"fieldtype": "Check",
"label": "Allow Overtime",
"permlevel": 0,
"precision": ""
},
"allow_on_submit": 0,
"description": "Plan time logs outside Workstation Working Hours.",
"fieldname": "allow_overtime",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Allow Overtime",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"default": "",
"fieldname": "allow_production_on_holidays",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Allow Production on Holidays",
"options": "",
"permlevel": 0,
"precision": ""
},
"allow_on_submit": 0,
"default": "",
"fieldname": "allow_production_on_holidays",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Allow Production on Holidays",
"no_copy": 0,
"options": "",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"default": "BOM",
"fieldname": "backflush_raw_materials_based_on",
"fieldtype": "Select",
"label": "Backflush Raw Materials Based On",
"options": "BOM\nMaterial Transferred for Manufacture",
"permlevel": 0,
"precision": ""
},
"allow_on_submit": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"permlevel": 0,
"precision": ""
},
"allow_on_submit": 0,
"default": "30",
"description": "Try planning operations for X days in advance.",
"fieldname": "capacity_planning_for_days",
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Capacity Planning For (Days)",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"default": "30",
"description": "Try planning operations for X days in advance.",
"fieldname": "capacity_planning_for_days",
"fieldtype": "Int",
"label": "Capacity Planning For (Days)",
"permlevel": 0,
"precision": ""
},
"allow_on_submit": 0,
"description": "Default 10 mins",
"fieldname": "mins_between_operations",
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Time Between Operations (in mins)",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"description": "Default 10 mins",
"fieldname": "mins_between_operations",
"fieldtype": "Int",
"label": "Time Between Operations (in mins)",
"permlevel": 0,
"precision": ""
},
"allow_on_submit": 0,
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"fieldname": "over_production_allowance_percentage",
"fieldtype": "Percent",
"label": "Over Production Allowance Percentage",
"permlevel": 0,
"precision": ""
"allow_on_submit": 0,
"fieldname": "over_production_allowance_percentage",
"fieldtype": "Percent",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Over Production Allowance Percentage",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"default": "BOM",
"fieldname": "backflush_raw_materials_based_on",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Backflush Raw Materials Based On",
"no_copy": 0,
"options": "BOM\nMaterial Transferred for Manufacture",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "column_break_11",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "default_wip_warehouse",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Work In Progress Warehouse",
"no_copy": 0,
"options": "Warehouse",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "default_fg_warehouse",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Default Finished Goods Warehouse",
"no_copy": 0,
"options": "Warehouse",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-wrench",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"modified": "2015-08-12 08:12:33.889753",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Manufacturing Settings",
"name_case": "",
"owner": "Administrator",
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-wrench",
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"modified": "2015-08-21 08:27:03.794133",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Manufacturing Settings",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 0,
"export": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Manufacturing Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 0,
"role": "Manufacturing Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
],
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC"
}
}

View File

@ -12,6 +12,7 @@ frappe.ui.form.on("Production Order", "onload", function(frm) {
"actual_start_date": "",
"actual_end_date": ""
});
erpnext.production_order.set_default_warehouse(frm);
}
erpnext.production_order.set_custom_buttons(frm);
@ -138,10 +139,22 @@ erpnext.production_order = {
}
} else msgprint(__("Please enter Production Item first"));
});
},
set_default_warehouse: function(frm) {
frappe.call({
method: "erpnext.manufacturing.doctype.production_order.production_order.get_default_warehouse",
callback: function(r) {
if(!r.exe) {
frm.set_value("wip_warehouse", r.message.wip_warehouse);
frm.set_value("fg_warehouse", r.message.fg_warehouse)
}
}
});
}
}
$.extend(cur_frm.cscript, {
before_submit: function() {
cur_frm.toggle_reqd(["fg_warehouse", "wip_warehouse"], true);

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item",
"fieldtype": "Section Break",
"hidden": 0,
@ -30,6 +32,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "PRO-",
"fieldname": "naming_series",
"fieldtype": "Select",
@ -51,6 +55,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Draft",
"depends_on": "eval:!doc.__islocal",
"fieldname": "status",
@ -75,6 +81,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "production_item",
"fieldtype": "Link",
"hidden": 0,
@ -97,6 +105,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"description": "",
"fieldname": "bom_no",
@ -121,6 +131,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "1",
"description": "Plan material for sub-assemblies",
"fieldname": "use_multi_level_bom",
@ -142,6 +154,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -162,6 +176,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "qty",
"fieldtype": "Float",
@ -184,6 +200,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "0",
"depends_on": "eval:doc.docstatus==1",
"description": "",
@ -207,6 +225,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "0",
"depends_on": "eval:doc.docstatus==1",
"description": "",
@ -231,6 +251,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouses",
"fieldtype": "Section Break",
"hidden": 0,
@ -251,6 +273,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "wip_warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -271,6 +295,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_12",
"fieldtype": "Column Break",
"hidden": 0,
@ -289,6 +315,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"description": "",
"fieldname": "fg_warehouse",
@ -311,6 +339,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "time",
"fieldtype": "Section Break",
"hidden": 0,
@ -332,6 +362,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "expected_delivery_date",
"fieldtype": "Date",
@ -352,6 +384,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "now",
"fieldname": "planned_start_date",
"fieldtype": "Datetime",
@ -373,6 +407,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "planned_end_date",
"fieldtype": "Datetime",
"hidden": 0,
@ -393,6 +429,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_13",
"fieldtype": "Column Break",
"hidden": 0,
@ -412,6 +450,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "actual_start_date",
"fieldtype": "Datetime",
"hidden": 0,
@ -432,6 +472,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "actual_end_date",
"fieldtype": "Datetime",
"hidden": 0,
@ -452,6 +494,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "operations_section",
"fieldtype": "Section Break",
@ -474,6 +518,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "operations",
"fieldtype": "Table",
@ -496,6 +542,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "operations",
"fieldname": "section_break_22",
"fieldtype": "Section Break",
@ -518,6 +566,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "planned_operating_cost",
"fieldtype": "Currency",
"hidden": 0,
@ -539,6 +589,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "actual_operating_cost",
"fieldtype": "Currency",
"hidden": 0,
@ -560,6 +612,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "additional_operating_cost",
"fieldtype": "Currency",
"hidden": 0,
@ -581,6 +635,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_24",
"fieldtype": "Column Break",
"hidden": 0,
@ -600,6 +656,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_operating_cost",
"fieldtype": "Currency",
"hidden": 0,
@ -621,13 +679,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Info",
"label": "More Information",
"no_copy": 0,
"options": "icon-file-text",
"permlevel": 0,
@ -641,6 +701,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Small Text",
"hidden": 0,
@ -660,6 +722,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "stock_uom",
"fieldtype": "Link",
@ -683,6 +747,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -702,6 +768,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "project_name",
"fieldtype": "Link",
"hidden": 0,
@ -724,6 +792,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Manufacture against Sales Order",
"fieldname": "sales_order",
"fieldtype": "Link",
@ -745,6 +815,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
@ -767,6 +839,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@ -797,7 +871,7 @@
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"modified": "2015-08-12 08:50:32.803526",
"modified": "2015-08-27 03:27:08.064900",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order",

View File

@ -42,6 +42,8 @@ class ProductionOrder(Document):
self.validate_warehouse()
self.calculate_operating_cost()
self.validate_delivery_date()
self.validate_qty()
self.validate_operation_time()
from erpnext.utilities.transaction_base import validate_uom_is_integer
validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])
@ -327,6 +329,15 @@ class ProductionOrder(Document):
frappe.throw(_("Production Order cannot be raised against a Item Template"), ItemHasVariantError)
validate_end_of_life(self.production_item)
def validate_qty(self):
if not self.qty > 0:
frappe.throw(_("Quantity to Manufacture must be greater than 0."))
def validate_operation_time(self):
for d in self.operations:
if not d.time_in_mins > 0:
frappe.throw(_("Operation Time must be greater than 0 for Operation {0}".format(d.operation)))
@frappe.whitelist()
def get_item_details(item):
@ -411,3 +422,9 @@ def make_time_log(name, operation, from_time=None, to_time=None, qty=None, proj
if from_time and to_time :
time_log.calculate_total_hours()
return time_log
@frappe.whitelist()
def get_default_warehouse():
wip_warehouse = frappe.db.get_single_value("Manufacturing Settings", "default_wip_warehouse")
fg_warehouse = frappe.db.get_single_value("Manufacturing Settings", "default_fg_warehouse")
return {"wip_warehouse": wip_warehouse, "fg_warehouse": fg_warehouse}

View File

@ -276,7 +276,7 @@
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@ -476,7 +476,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:45:53.834920",
"modified": "2015-08-21 07:17:18.185276",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Order Operation",

View File

@ -200,15 +200,19 @@ class ProductionPlanningTool(Document):
def create_production_order(self, items):
"""Create production order. Called from Production Planning Tool"""
from erpnext.manufacturing.doctype.production_order.production_order import OverProductionError
from erpnext.manufacturing.doctype.production_order.production_order import OverProductionError, get_default_warehouse
warehouse = get_default_warehouse()
pro_list = []
for key in items:
pro = frappe.new_doc("Production Order")
pro.update(items[key])
pro.set_production_order_operations()
if warehouse:
pro.wip_warehouse = warehouse.get('wip_warehouse')
if not pro.fg_warehouse:
pro.fg_warehouse = warehouse.get('fg_warehouse')
frappe.flags.mute_messages = True
try:
pro.insert()
pro_list.append(pro.name)
@ -216,7 +220,6 @@ class ProductionPlanningTool(Document):
pass
frappe.flags.mute_messages = False
return pro_list
def download_raw_materials(self):

View File

@ -191,6 +191,14 @@ erpnext.patches.v5_4.stock_entry_additional_costs
erpnext.patches.v5_4.cleanup_journal_entry #2015-08-14
execute:frappe.db.sql("update `tabProduction Order` pro set description = (select description from tabItem where name=pro.production_item) where ifnull(description, '') = ''")
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 #2015-08-20
erpnext.patches.v5_4.update_purchase_cost_against_project
erpnext.patches.v6_0.multi_currency
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
erpnext.patches.v6_0.multi_currency

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe
def execute():
from erpnext.utilities.repost_stock import set_stock_balance_as_per_serial_no
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()

View File

@ -6,7 +6,7 @@ import frappe
from frappe.utils import flt
def execute():
from erpnext.utilities.repost_stock import repost
from erpnext.stock.stock_balance import repost
repost(allow_zero_rate=True, only_actual=True)
frappe.reload_doctype("Account")

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from erpnext.utilities.repost_stock import update_bin_qty, get_reserved_qty
from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
def execute():
repost_for = frappe.db.sql("""

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe
def execute():
from erpnext.utilities.repost_stock import update_bin_qty, get_indented_qty, get_ordered_qty
from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty, get_ordered_qty
count=0
for item_code, warehouse in frappe.db.sql("""select distinct item_code, warehouse from

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe
def execute():
from erpnext.utilities.repost_stock import update_bin_qty, get_indented_qty
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

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from erpnext.utilities.repost_stock import repost_actual_qty
from erpnext.stock.stock_balance import repost_actual_qty
def execute():
cancelled_invoices = frappe.db.sql_list("""select name from `tabSales Invoice`

View File

@ -10,12 +10,6 @@ def execute():
frappe.reload_doctype("Stock Entry Detail")
frappe.reload_doctype("Landed Cost Taxes and Charges")
frappe.db.sql("""update `tabStock Entry Detail` sed, `tabStock Entry` se
set sed.valuation_rate=sed.incoming_rate, sed.basic_rate=sed.incoming_rate, sed.basic_amount=sed.amount
where sed.parent = se.name
and (se.purpose not in ('Manufacture', 'Repack') or ifnull(additional_operating_cost, 0)=0)
""")
stock_entry_db_columns = frappe.db.get_table_columns("Stock Entry")
if "additional_operating_cost" in stock_entry_db_columns:
operating_cost_fieldname = "additional_operating_cost"
@ -25,6 +19,13 @@ def execute():
return
frappe.db.sql("""update `tabStock Entry Detail` sed, `tabStock Entry` se
set sed.valuation_rate=sed.incoming_rate, sed.basic_rate=sed.incoming_rate, sed.basic_amount=sed.amount
where sed.parent = se.name
and (se.purpose not in ('Manufacture', 'Repack') or ifnull({0}, 0)=0)
""".format(operating_cost_fieldname))
stock_entries = frappe.db.sql_list("""select name from `tabStock Entry`
where purpose in ('Manufacture', 'Repack') and ifnull({0}, 0)!=0
and docstatus < 2""".format(operating_cost_fieldname))

View File

@ -55,9 +55,6 @@ def migrate_manage_variants():
template.set('attributes', attributes)
template.save()
frappe.delete_doc("DocType", "Manage Variants")
frappe.delete_doc("DocType", "Manage Variants Item")
# patch old style
def migrate_item_variants():
for item in frappe.get_all("Item", filters={"has_variants": 1}):

View File

@ -0,0 +1 @@
from __future__ import unicode_literals

View File

@ -0,0 +1,14 @@
# 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
from frappe import _
def execute():
for print_heading in (_("Credit Note"), _("Debit Note")):
if not frappe.db.exists("Print Heading", print_heading):
frappe.get_doc({
"doctype": "Print Heading",
"print_heading": print_heading
}).insert()

View File

@ -0,0 +1,88 @@
# 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_doctype("Sales Order Item")
frappe.reload_doctype("Purchase Order Item")
# sales return
return_entries = list(frappe.db.sql("""
select dn.name as name, dn_item.name as row_id, dn.return_against,
dn_item.item_code, "Delivery Note" as doctype
from `tabDelivery Note Item` dn_item, `tabDelivery Note` dn
where dn_item.parent=dn.name and dn.is_return=1 and dn.docstatus < 2
""", as_dict=1))
return_entries += list(frappe.db.sql("""
select si.name as name, si_item.name as row_id, si.return_against,
si_item.item_code, "Sales Invoice" as doctype, update_stock
from `tabSales Invoice Item` si_item, `tabSales Invoice` si
where si_item.parent=si.name and si.is_return=1 and si.docstatus < 2
""", as_dict=1))
for d in return_entries:
ref_field = "against_sales_order" if d.doctype == "Delivery Note" else "sales_order"
order_details = frappe.db.sql("""
select {ref_field} as sales_order, so_detail,
(select transaction_date from `tabSales Order` where name=item.{ref_field}) as sales_order_date
from `tab{doctype} Item` item
where
parent=%s
and item_code=%s
and ifnull(so_detail, '') !=''
order by sales_order_date DESC limit 1
""".format(ref_field=ref_field, doctype=d.doctype), (d.return_against, d.item_code), as_dict=1)
if order_details:
frappe.db.sql("""
update `tab{doctype} Item`
set {ref_field}=%s, so_detail=%s
where name=%s
""".format(doctype=d.doctype, ref_field=ref_field),
(order_details[0].sales_order, order_details[0].so_detail, d.row_id))
if (d.doctype=="Sales Invoice" and d.update_stock) or d.doctype=="Delivery Note":
doc = frappe.get_doc(d.doctype, d.name)
doc.update_reserved_qty()
if d.doctype=="Sales Invoice":
doc.status_updater = []
doc.update_status_updater_args()
doc.update_prevdoc_status()
#--------------------------
# purchase return
return_entries = frappe.db.sql("""
select pr.name as name, pr_item.name as row_id, pr.return_against, pr_item.item_code
from `tabPurchase Receipt Item` pr_item, `tabPurchase Receipt` pr
where pr_item.parent=pr.name and pr.is_return=1 and pr.docstatus < 2
""", as_dict=1)
for d in return_entries:
order_details = frappe.db.sql("""
select prevdoc_docname as purchase_order, prevdoc_detail_docname as po_detail,
(select transaction_date from `tabPurchase Order` where name=item.prevdoc_detail_docname) as purchase_order_date
from `tabPurchase Receipt Item` item
where
parent=%s
and item_code=%s
and ifnull(prevdoc_detail_docname, '') !=''
and ifnull(prevdoc_doctype, '') = 'Purchase Order' and ifnull(prevdoc_detail_docname, '') != ''
order by purchase_order_date DESC limit 1
""", (d.return_against, d.item_code), as_dict=1)
if order_details:
frappe.db.sql("""
update `tabPurchase Receipt Item`
set prevdoc_doctype='Purchase Order', prevdoc_docname=%s, prevdoc_detail_docname=%s
where name=%s
""", (order_details[0].purchase_order, order_details[0].po_detail, d.row_id))
pr = frappe.get_doc("Purchase Receipt", d.name)
pr.update_ordered_qty()
pr.update_prevdoc_status()

View File

@ -0,0 +1,32 @@
import frappe
def execute():
frappe.reload_doctype("Quotation")
frappe.db.sql("""update tabQuotation set title = customer_name""")
frappe.reload_doctype("Sales Order")
frappe.db.sql("""update `tabSales Order` set title = customer_name""")
frappe.reload_doctype("Delivery Note")
frappe.db.sql("""update `tabDelivery Note` set title = customer_name""")
frappe.reload_doctype("Material Request")
frappe.db.sql("""update `tabMaterial Request` set title = material_request_type""")
frappe.reload_doctype("Supplier Quotation")
frappe.db.sql("""update `tabSupplier Quotation` set title = supplier_name""")
frappe.reload_doctype("Purchase Order")
frappe.db.sql("""update `tabPurchase Order` set title = supplier_name""")
frappe.reload_doctype("Purchase Receipt")
frappe.db.sql("""update `tabPurchase Receipt` set title = supplier_name""")
frappe.reload_doctype("Purchase Invoice")
frappe.db.sql("""update `tabPurchase Invoice` set title = supplier_name""")
frappe.reload_doctype("Stock Entry")
frappe.db.sql("""update `tabStock Entry` set title = purpose""")
frappe.reload_doctype("Sales Invoice")
frappe.db.sql("""update `tabSales Invoice` set title = customer_name""")

View File

@ -83,11 +83,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
refresh: function() {
erpnext.toggle_naming_series();
erpnext.hide_company();
this.hide_currency_and_price_list()
this.show_item_wise_taxes();
this.set_dynamic_labels();
erpnext.pos.make_pos_btn(this.frm);
this.setup_sms();
this.make_show_payments_btn();
},
apply_default_taxes: function() {
@ -123,11 +123,19 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
var sms_man = new SMSManager(this.frm.doc);
},
hide_currency_and_price_list: function() {
if(this.frm.doc.conversion_rate == 1 && this.frm.doc.docstatus > 0) {
hide_field("currency_and_price_list");
} else {
unhide_field("currency_and_price_list");
make_show_payments_btn: function() {
var me = this;
if (in_list(["Purchase Invoice", "Sales Invoice"], this.frm.doctype)) {
if(this.frm.doc.outstanding_amount !== this.frm.doc.base_grand_total) {
this.frm.add_custom_button(__("Show Payments"), function() {
frappe.route_options = {
"Journal Entry Account.reference_type": me.frm.doc.doctype,
"Journal Entry Account.reference_name": me.frm.doc.name
};
frappe.set_route("List", "Journal Entry");
});
}
}
},
@ -701,7 +709,8 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}).join("\n");
if(!rows) return "";
return '<p><a href="#" onclick="$(\'.tax-break-up\').toggleClass(\'hide\'); return false;">Show / Hide tax break-up</a><br><br></p>\
return '<p><a class="h6 text-muted" href="#" onclick="$(\'.tax-break-up\').toggleClass(\'hide\'); return false;">'
+ __("Show tax break-up") + '</a><br><br></p>\
<div class="tax-break-up hide" style="overflow-x: auto;"><table class="table table-bordered table-hover">\
<thead><tr>' + headings + '</tr></thead> \
<tbody>' + rows + '</tbody> \

View File

@ -1,18 +1,20 @@
<p><button class="btn btn-sm btn-default btn-address">
<i class="icon-plus"></i> New Address</button></p>
<p><button class="btn btn-xs btn-default btn-address">New Address</button></p>
<div class="clearfix"></div>
{% for(var i=0, l=addr_list.length; i<l; i++) { %}
<hr>
<a href="#Form/Address/{%= addr_list[i].name %}" class="btn btn-sm btn-default pull-right">
{%= __("Edit") %}</a>
<p><b>{%= i+1 %}. {%= addr_list[i].address_type %}</b></p>
<p class="h6">
{%= i+1 %}. {%= addr_list[i].address_type %}
{% if(addr_list[i].is_primary_address) { %}
<span class="text-muted">({%= __("Primary") %})</span>{% } %}
{% if(addr_list[i].is_shipping_address) { %}
<span class="text-muted">({%= __("Shipping") %})</span>{% } %}
<a href="#Form/Address/{%= addr_list[i].name %}"
class="btn btn-default btn-xs pull-right">
{%= __("Edit") %}</a>
</p>
<div style="padding-left: 15px;">
<div>
{% if(addr_list[i].is_primary_address) { %}<span class="label label-info">
{%= __("Primary") %}</span>{% } %}
{% if(addr_list[i].is_shipping_address) { %}<span class="label label-default">
{%= __("Shipping") %}</span>{% } %}
</div>
<p style="margin-top: 5px;">{%= addr_list[i].display %}</p>
<p style="margin-top: 5px; font-size: 12px;">
{%= addr_list[i].display %}</p>
</div>
{% } %}
{% if(!addr_list.length) { %}

View File

@ -1,25 +1,29 @@
<p><button class="btn btn-sm btn-default btn-contact">
<i class="icon-plus"></i> New Contact</button></p>
<p><button class="btn btn-xs btn-default btn-contact">
New Contact</button></p>
<div class="clearfix"></div>
{% for(var i=0, l=contact_list.length; i<l; i++) { %}
<hr>
<a href="#Form/Contact/{%= contact_list[i].name %}" class="btn btn-sm btn-default pull-right">
{%= __("Edit") %}</a>
<p><b>{%= i+1 %}. {%= contact_list[i].first_name %} {%= contact_list[i].last_name %}</b></p>
<p class="h6">
{%= i+1 %}. {%= contact_list[i].first_name %} {%= contact_list[i].last_name %}
{% if(contact_list[i].is_primary_contact) { %}
<span class="text-muted">({%= __("Primary") %})</span>
{% } %}
<a href="#Form/Contact/{%= contact_list[i].name %}"
class="btn btn-xs btn-default pull-right">
{%= __("Edit") %}</a>
</p>
<div style="padding-left: 15px;">
<div>
{% if(contact_list[i].is_primary_contact) { %}<span class="label label-info">
{%= __("Primary") %}</span>{% } %}
</div>
<p style="padding-top: 5px;">
{% if(contact_list[i].phone) { %}
{%= __("Phone") %}: {%= contact_list[i].phone %}<br>
{% } %}
{% if(contact_list[i].mobile_no) { %}
{%= __("Mobile No.") %}: {%= contact_list[i].mobile_no %}<br>
{% } %}
{% if(contact_list[i].email_id) { %}
{%= __("Email ID") %}: {%= contact_list[i].email_id %}
{% } %}
<p style="padding-top: 5px; font-size: 12px;">
{% if(contact_list[i].phone) { %}
{%= __("Phone") %}: {%= contact_list[i].phone %}<br>
{% } %}
{% if(contact_list[i].mobile_no) { %}
{%= __("Mobile No.") %}: {%= contact_list[i].mobile_no %}<br>
{% } %}
{% if(contact_list[i].email_id) { %}
{%= __("Email ID") %}: {%= contact_list[i].email_id %}
{% } %}
</p>
</div>
{% } %}

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -34,6 +36,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
@ -53,6 +57,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -71,6 +77,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -94,6 +102,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
@ -113,6 +123,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -136,6 +148,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_7",
"fieldtype": "Column Break",
"hidden": 0,
@ -155,6 +169,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@ -175,6 +191,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -196,6 +214,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@ -215,6 +235,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@ -238,6 +260,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -262,6 +286,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "price_list_rate",
"fieldname": "discount_percentage",
"fieldtype": "Percent",
@ -286,6 +312,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -304,6 +332,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@ -328,6 +358,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -352,6 +384,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break1",
"fieldtype": "Section Break",
"hidden": 0,
@ -370,6 +404,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@ -394,6 +430,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -414,6 +452,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@ -438,6 +478,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -459,6 +501,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -477,6 +521,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -501,6 +547,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -521,6 +569,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -545,6 +595,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -566,6 +618,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"hidden": 0,
@ -586,6 +640,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "reference",
"fieldtype": "Section Break",
"hidden": 0,
@ -605,6 +661,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_doctype",
"fieldtype": "Link",
"hidden": 1,
@ -629,6 +687,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_docname",
"fieldtype": "Dynamic Link",
"hidden": 0,
@ -653,6 +713,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
"hidden": 1,
@ -674,6 +736,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@ -692,6 +756,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@ -713,6 +779,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@ -736,6 +804,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@ -767,7 +837,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:34:45.335386",
"modified": "2015-08-26 03:05:10.048137",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation Item",

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,10 @@ from __future__ import unicode_literals
import frappe
import json
import frappe.utils
from frappe.utils import cstr, flt, getdate, comma_and
from frappe.utils import cstr, flt, getdate, comma_and, cint
from frappe import _
from frappe.model.mapper import get_mapped_doc
from erpnext.stock.stock_balance import update_bin_qty, get_reserved_qty
from erpnext.controllers.selling_controller import SellingController
@ -33,8 +34,9 @@ class SalesOrder(SellingController):
so = frappe.db.sql("select name from `tabSales Order` \
where ifnull(po_no, '') = %s and name != %s and docstatus < 2\
and customer = %s", (self.po_no, self.name, self.customer))
if so and so[0][0]:
frappe.msgprint(_("Warning: Sales Order {0} already exists against same Purchase Order number").format(so[0][0]))
if so and so[0][0] and not \
cint(frappe.db.get_single_value("Selling Settings", "allow_against_multiple_purchase_orders")):
frappe.msgprint(_("Warning: Sales Order {0} already exists against Customer's Purchase Order {1}").format(so[0][0], self.po_no))
def validate_for_items(self):
check_list = []
@ -53,8 +55,11 @@ class SalesOrder(SellingController):
tot_avail_qty = frappe.db.sql("select projected_qty from `tabBin` \
where item_code = %s and warehouse = %s", (d.item_code,d.warehouse))
d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
# check for same entry multiple times
unique_chk_list = set(check_list)
if len(unique_chk_list) != len(check_list):
if len(unique_chk_list) != len(check_list) and \
not cint(frappe.db.get_single_value("Selling Settings", "allow_multiple_items")):
frappe.msgprint(_("Warning: Same item has been entered multiple times."))
def product_bundle_has_stock_item(self, product_bundle):
@ -151,7 +156,7 @@ class SalesOrder(SellingController):
super(SalesOrder, self).on_submit()
self.check_credit_limit()
self.update_stock_ledger(update_stock = 1)
self.update_reserved_qty()
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.base_grand_total, self)
@ -164,7 +169,7 @@ class SalesOrder(SellingController):
frappe.throw(_("Stopped order cannot be cancelled. Unstop to cancel."))
self.check_nextdoc_docstatus()
self.update_stock_ledger(update_stock = -1)
self.update_reserved_qty()
self.update_prevdoc_status('cancel')
@ -213,32 +218,38 @@ class SalesOrder(SellingController):
def stop_sales_order(self):
self.check_modified_date()
self.update_stock_ledger(-1)
frappe.db.set(self, 'status', 'Stopped')
self.update_reserved_qty()
frappe.msgprint(_("{0} {1} status is Stopped").format(self.doctype, self.name))
self.notify_modified()
def unstop_sales_order(self):
self.check_modified_date()
self.update_stock_ledger(1)
frappe.db.set(self, 'status', 'Submitted')
self.update_reserved_qty()
frappe.msgprint(_("{0} {1} status is Unstopped").format(self.doctype, self.name))
def update_reserved_qty(self, so_item_rows=None):
"""update requested qty (before ordered_qty is updated)"""
item_wh_list = []
def _valid_for_reserve(item_code, warehouse):
if item_code and warehouse and [item_code, warehouse] not in item_wh_list \
and frappe.db.get_value("Item", item_code, "is_stock_item"):
item_wh_list.append([item_code, warehouse])
def update_stock_ledger(self, update_stock):
from erpnext.stock.utils import update_bin
for d in self.get_item_list():
if frappe.db.get_value("Item", d['item_code'], "is_stock_item")==1:
args = {
"item_code": d['item_code'],
"warehouse": d['reserved_warehouse'],
"reserved_qty": flt(update_stock) * flt(d['reserved_qty']),
"posting_date": self.transaction_date,
"voucher_type": self.doctype,
"voucher_no": self.name,
"is_amended": self.amended_from and 'Yes' or 'No'
}
update_bin(args)
for d in self.get("items"):
if (not so_item_rows or d.name in so_item_rows):
_valid_for_reserve(d.item_code, d.warehouse)
if self.has_product_bundle(d.item_code):
for p in self.get("packed_items"):
if p.parent_detail_docname == d.name and p.parent_item == d.item_code:
_valid_for_reserve(p.item_code, p.warehouse)
for item_code, warehouse in item_wh_list:
update_bin_qty(item_code, warehouse, {
"reserved_qty": get_reserved_qty(item_code, warehouse)
})
def on_update(self):
pass

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -34,6 +36,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
@ -53,6 +57,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -71,6 +77,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -94,12 +102,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -113,6 +124,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -136,6 +149,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_7",
"fieldtype": "Column Break",
"hidden": 0,
@ -155,6 +170,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@ -175,6 +192,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -196,6 +215,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@ -215,6 +236,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@ -238,6 +261,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -262,6 +287,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "price_list_rate",
"fieldname": "discount_percentage",
"fieldtype": "Percent",
@ -286,6 +313,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -304,6 +333,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@ -328,6 +359,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -352,6 +385,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_simple1",
"fieldtype": "Section Break",
"hidden": 0,
@ -370,6 +405,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@ -394,6 +431,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@ -418,6 +457,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -436,6 +477,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -460,6 +503,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -484,6 +529,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"hidden": 0,
@ -504,6 +551,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_24",
"fieldtype": "Section Break",
"hidden": 0,
@ -523,6 +572,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -544,6 +595,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -565,6 +618,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_27",
"fieldtype": "Column Break",
"hidden": 0,
@ -584,6 +639,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -605,6 +662,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -626,6 +685,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@ -645,6 +706,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -669,6 +732,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_docname",
"fieldtype": "Link",
"hidden": 0,
@ -691,6 +756,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@ -713,6 +780,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@ -736,6 +805,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@ -757,6 +828,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@ -775,6 +848,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "projected_qty",
"fieldtype": "Float",
"hidden": 0,
@ -798,6 +873,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
@ -819,6 +896,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "delivered_qty",
"fieldtype": "Float",
"hidden": 0,
@ -842,6 +921,31 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "returned_qty",
"fieldname": "returned_qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Returned Qty",
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "billed_amt",
"fieldtype": "Currency",
"hidden": 0,
@ -862,6 +966,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "For Production",
"fieldname": "planned_qty",
"fieldtype": "Float",
@ -886,6 +992,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "For Production",
"fieldname": "produced_qty",
"fieldtype": "Float",
@ -910,6 +1018,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
"hidden": 1,
@ -931,6 +1041,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Used for Production Plan",
"fieldname": "transaction_date",
"fieldtype": "Date",
@ -960,7 +1072,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:46:32.930498",
"modified": "2015-08-27 02:29:20.603580",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order Item",

View File

@ -11,6 +11,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Customer Name",
"fieldname": "cust_master_name",
"fieldtype": "Select",
@ -32,6 +34,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "campaign_naming_by",
"fieldtype": "Select",
"hidden": 0,
@ -52,6 +56,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "customer_group",
"fieldtype": "Link",
@ -73,6 +79,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
@ -94,6 +102,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "selling_price_list",
"fieldtype": "Link",
"hidden": 0,
@ -114,6 +124,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_5",
"fieldtype": "Column Break",
"hidden": 0,
@ -132,6 +144,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "so_required",
"fieldtype": "Select",
"hidden": 0,
@ -152,6 +166,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "dn_required",
"fieldtype": "Select",
"hidden": 0,
@ -172,6 +188,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "maintain_same_sales_rate",
"fieldtype": "Check",
"hidden": 0,
@ -191,6 +209,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "editable_price_list_rate",
"fieldtype": "Check",
"hidden": 0,
@ -207,6 +227,50 @@
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "allow_multiple_items",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Allow Item to be added multiple times in a transaction",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "allow_against_multiple_purchase_orders",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Allow multiple Sales Orders against a Customer's Purchase Order",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
@ -218,7 +282,7 @@
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"modified": "2015-08-03 12:59:51.829458",
"modified": "2015-08-27 02:42:56.512460",
"modified_by": "Administrator",
"module": "Selling",
"name": "Selling Settings",

View File

@ -1,17 +1,19 @@
{
"apply_user_permissions": 1,
"creation": "2012-10-04 18:45:27",
"docstatus": 0,
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2014-07-14 07:18:17.006732",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer Addresses and Contacts",
"owner": "Administrator",
"query": "SELECT\n\t`tabCustomer`.name as customer_id,\n\t`tabCustomer`.customer_name,\n\t`tabCustomer`.customer_group,\n\t`tabAddress`.address_line1,\n\t`tabAddress`.address_line2,\n\t`tabAddress`.city,\n\t`tabAddress`.state,\n\t`tabAddress`.pincode,\n\t`tabAddress`.country,\n\t`tabAddress`.is_primary_address, \n\t`tabContact`.first_name,\n\t`tabContact`.last_name,\n\t`tabContact`.phone,\n\t`tabContact`.mobile_no,\n\t`tabContact`.email_id,\n\t`tabContact`.is_primary_contact\nFROM\n\t`tabCustomer`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.customer=`tabCustomer`.name\n\t)\n\tleft join `tabContact` on (\n\t\t`tabContact`.customer=`tabCustomer`.name\n\t)\nWHERE\n\t`tabCustomer`.docstatus<2\nORDER BY\n\t`tabCustomer`.name asc",
"ref_doctype": "Customer",
"report_name": "Customer Addresses And Contacts",
"add_total_row": 0,
"apply_user_permissions": 1,
"creation": "2012-10-04 18:45:27",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 1,
"is_standard": "Yes",
"modified": "2015-08-24 11:44:00.711112",
"modified_by": "Administrator",
"module": "Selling",
"name": "Customer Addresses And Contacts",
"owner": "Administrator",
"query": "SELECT\n\t`tabCustomer`.name as \"Customer ID:Link/Customer\",\n\t`tabCustomer`.customer_name as \"Customer Name\",\n\t`tabCustomer`.customer_group as \"Customer Group:Link/Customer Group\",\n\t`tabAddress`.address_line1 as \"Address Line 1\",\n\t`tabAddress`.address_line2 as \"Address Line 2\",\n\t`tabAddress`.city as \"City\",\n\t`tabAddress`.state as \"State\",\n\t`tabAddress`.pincode as \"Postal Code\",\n\t`tabAddress`.country as \"Country\",\n\t`tabAddress`.is_primary_address as \"Is Primary Address:Check\", \n\t`tabContact`.first_name as \"First Name\",\n\t`tabContact`.last_name as \"Last Name\",\n\t`tabContact`.phone as \"Phone\",\n\t`tabContact`.mobile_no as \"Mobile No\",\n\t`tabContact`.email_id as \"Email Id\",\n\t`tabContact`.is_primary_contact as \"Is Primary Contact:Check\"\nFROM\n\t`tabCustomer`\n\tleft join `tabAddress` on (\n\t\t`tabAddress`.customer=`tabCustomer`.name\n\t)\n\tleft join `tabContact` on (\n\t\t`tabContact`.customer=`tabCustomer`.name\n\t)\nWHERE\n\t`tabCustomer`.docstatus<2\nORDER BY\n\t`tabCustomer`.name asc",
"ref_doctype": "Customer",
"report_name": "Customer Addresses And Contacts",
"report_type": "Query Report"
}
}

View File

@ -1,211 +1,667 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"creation": "2012-12-20 12:50:49",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "materials",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Materials",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "To track item in sales and purchase documents based on their serial nos. This is can also used to track warranty details of the product.",
"fieldname": "fs_item_serial_nos",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Item Serial Nos",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "To track items in sales and purchase documents with batch nos. \"Preferred Industry: Chemicals\"",
"fieldname": "fs_item_batch_nos",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Item Batch Nos",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "To track brand name in the following documents Delivery Note, Opportunity, Material Request, Item, Purchase Order, Purchase Voucher, Purchaser Receipt, Quotation, Sales Invoice, Product Bundle, Sales Order, Serial No",
"fieldname": "fs_brands",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Brands",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "To track items using barcode. You will be able to enter items in Delivery Note and Sales Invoice by scanning barcode of item.",
"fieldname": "fs_item_barcode",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Item Barcode",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "1. To maintain the customer wise item code and to make them searchable based on their code use this option",
"fieldname": "fs_item_advanced",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Item Advanced",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "To get Item Group in details table",
"fieldname": "fs_item_group_in_details",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Item Groups in Details",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sales_and_purchase",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales and Purchase",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "All export related fields like currency, conversion rate, export total, export grand total etc are available in Delivery Note, POS, Quotation, Sales Invoice, Sales Order etc.",
"fieldname": "fs_exports",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Exports",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "All import related fields like currency, conversion rate, import total, import grand total etc are available in Purchase Receipt, Supplier Quotation, Purchase Invoice, Purchase Order etc.",
"fieldname": "fs_imports",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Imports",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Field available in Delivery Note, Quotation, Sales Invoice, Sales Order",
"fieldname": "fs_discounts",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Discounts",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Discount Fields will be available in Purchase Order, Purchase Receipt, Purchase Invoice",
"fieldname": "fs_purchase_discounts",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Purchase Discounts",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "To track any installation or commissioning related work after sales",
"fieldname": "fs_after_sales_installations",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "After Sale Installations",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Available in BOM, Delivery Note, Purchase Invoice, Production Order, Purchase Order, Purchase Receipt, Sales Invoice, Sales Order, Stock Entry, Timesheet",
"fieldname": "fs_projects",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Projects",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If you have Sales Team and Sale Partners (Channel Partners) they can be tagged and maintain their contribution in the sales activity",
"fieldname": "fs_sales_extras",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Extras",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "accounts",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Accounts",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Check if you need automatic recurring invoices. After submitting any sales invoice, Recurring section will be visible.",
"fieldname": "fs_recurring_invoice",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Recurring Invoice",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break2",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "To enable \"Point of Sale\" features",
"fieldname": "fs_pos",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Point of Sale",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "To enable \"Point of Sale\" view",
"fieldname": "fs_pos_view",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "POS View",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "production",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Manufacturing",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If you involve in manufacturing activity. Enables Item 'Is Manufactured'",
"fieldname": "fs_manufacturing",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Manufacturing",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break3",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If you follow Quality Inspection. Enables Item QA Required and QA No in Purchase Receipt",
"fieldname": "fs_quality",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Quality",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "miscelleneous",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Miscelleneous",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If you have long print formats, this feature can be used to split the page to be printed on multiple pages with all headers and footers on each page",
"fieldname": "fs_page_break",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Page Break",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break4",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fs_more_info",
"fieldtype": "Check",
"label": "More Info",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Information",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-glass",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"modified": "2015-07-06 06:11:10.534423",
"istable": 0,
"modified": "2015-08-27 03:27:35.694800",
"modified_by": "Administrator",
"module": "Setup",
"name": "Features Setup",
@ -213,28 +669,46 @@
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "System Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "Administrator",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
]
}
],
"read_only": 0,
"read_only_onload": 0
}

View File

@ -41,15 +41,15 @@ def install(country=None):
{'doctype': 'Expense Claim Type', 'name': _('Travel'), 'expense_type': _('Travel')},
# leave type
{'doctype': 'Leave Type', 'leave_type_name': _('Casual Leave'), 'name': _('Casual Leave'),
{'doctype': 'Leave Type', 'leave_type_name': _('Casual Leave'), 'name': _('Casual Leave'),
'is_encash': 1, 'is_carry_forward': 1, 'max_days_allowed': '3', 'include_holiday': 1},
{'doctype': 'Leave Type', 'leave_type_name': _('Compensatory Off'), 'name': _('Compensatory Off'),
{'doctype': 'Leave Type', 'leave_type_name': _('Compensatory Off'), 'name': _('Compensatory Off'),
'is_encash': 0, 'is_carry_forward': 0, 'include_holiday': 1},
{'doctype': 'Leave Type', 'leave_type_name': _('Sick Leave'), 'name': _('Sick Leave'),
{'doctype': 'Leave Type', 'leave_type_name': _('Sick Leave'), 'name': _('Sick Leave'),
'is_encash': 0, 'is_carry_forward': 0, 'include_holiday': 1},
{'doctype': 'Leave Type', 'leave_type_name': _('Privilege Leave'), 'name': _('Privilege Leave'),
{'doctype': 'Leave Type', 'leave_type_name': _('Privilege Leave'), 'name': _('Privilege Leave'),
'is_encash': 0, 'is_carry_forward': 0, 'include_holiday': 1},
{'doctype': 'Leave Type', 'leave_type_name': _('Leave Without Pay'), 'name': _('Leave Without Pay'),
{'doctype': 'Leave Type', 'leave_type_name': _('Leave Without Pay'), 'name': _('Leave Without Pay'),
'is_encash': 0, 'is_carry_forward': 0, 'is_lwp':1, 'include_holiday': 1},
# Employment Type
@ -173,6 +173,8 @@ def install(country=None):
{"doctype": "Offer Term", "offer_term": _("Notice Period")},
{"doctype": "Offer Term", "offer_term": _("Incentives")},
{'doctype': "Print Heading", 'print_heading': _("Credit Note")},
{'doctype': "Print Heading", 'print_heading': _("Debit Note")}
]
from erpnext.setup.page.setup_wizard.fixtures import industry_type

View File

@ -12,7 +12,7 @@ def make_sample_data():
to help the user get started"""
selling_items = frappe.get_all("Item", filters = {"is_sales_item": 1})
buying_items = frappe.get_all("Item", filters = {"is_sales_item": 0})
buying_items = frappe.get_all("Item", filters = {"is_purchase_item": 1})
if selling_items:
for i in range(3):

View File

@ -7,10 +7,12 @@
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Transaction",
"document_type": "Document",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "delivery_to_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -31,6 +33,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
@ -50,8 +54,33 @@
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"default": "{customer_name}",
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Title",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@ -74,6 +103,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
@ -96,6 +127,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "customer",
"fieldname": "customer_name",
"fieldtype": "Data",
@ -116,6 +149,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "customer",
"fieldname": "customer_address",
"fieldtype": "Link",
@ -137,6 +172,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 1,
@ -156,6 +193,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "shipping_address_name",
"fieldtype": "Link",
"hidden": 0,
@ -176,6 +215,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "shipping_address",
"fieldtype": "Small Text",
"hidden": 1,
@ -195,6 +236,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_display",
"fieldtype": "Small Text",
"hidden": 1,
@ -214,6 +257,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_mobile",
"fieldtype": "Small Text",
"hidden": 1,
@ -233,6 +278,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_email",
"fieldtype": "Small Text",
"hidden": 1,
@ -252,6 +299,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -271,6 +320,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@ -295,6 +346,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "company",
"fieldtype": "Link",
@ -320,6 +373,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Today",
"fieldname": "posting_date",
"fieldtype": "Date",
@ -344,6 +399,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "po_no",
"fieldtype": "Data",
"hidden": 0,
@ -367,6 +424,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.po_no",
"fieldname": "po_date",
"fieldtype": "Date",
@ -391,6 +450,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "is_return",
"fieldtype": "Check",
"hidden": 0,
@ -411,6 +472,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "is_return",
"fieldname": "return_against",
"fieldtype": "Link",
@ -433,13 +496,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "currency_and_price_list",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"label": "Currency and Price List",
"no_copy": 0,
"options": "icon-tag",
"permlevel": 0,
@ -453,6 +518,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "currency",
"fieldtype": "Link",
"hidden": 0,
@ -475,6 +542,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Rate at which customer's currency is converted to company's base currency",
"fieldname": "conversion_rate",
"fieldtype": "Float",
@ -498,6 +567,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break23",
"fieldtype": "Column Break",
"hidden": 0,
@ -516,6 +587,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "selling_price_list",
"fieldtype": "Link",
"hidden": 0,
@ -538,6 +611,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "price_list_currency",
"fieldtype": "Link",
"hidden": 0,
@ -558,6 +633,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Rate at which Price list currency is converted to company's base currency",
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",
@ -579,6 +656,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "ignore_pricing_rule",
"fieldtype": "Check",
"hidden": 0,
@ -598,6 +677,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "items_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -619,6 +700,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "items",
"fieldtype": "Table",
"hidden": 0,
@ -641,6 +724,9 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "packed_items",
"fieldname": "packing_list",
"fieldtype": "Section Break",
"hidden": 0,
@ -662,6 +748,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "packed_items",
"fieldtype": "Table",
"hidden": 0,
@ -684,6 +772,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "product_bundle_help",
"fieldtype": "HTML",
"hidden": 0,
@ -703,6 +793,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_31",
"fieldtype": "Section Break",
"hidden": 0,
@ -721,6 +813,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_total",
"fieldtype": "Currency",
"hidden": 0,
@ -742,6 +836,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_total",
"fieldtype": "Currency",
"hidden": 0,
@ -766,6 +862,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_33",
"fieldtype": "Column Break",
"hidden": 0,
@ -784,6 +882,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total",
"fieldtype": "Currency",
"hidden": 0,
@ -805,6 +905,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_total",
"fieldtype": "Currency",
"hidden": 0,
@ -825,6 +927,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "taxes_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -846,6 +950,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "If you have created a standard template in Sales Taxes and Charges Template, select one and click on the button below.",
"fieldname": "taxes_and_charges",
"fieldtype": "Link",
@ -869,6 +975,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_39",
"fieldtype": "Column Break",
"hidden": 0,
@ -887,6 +995,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "shipping_rule",
"fieldtype": "Link",
"hidden": 0,
@ -908,6 +1018,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_41",
"fieldtype": "Section Break",
"hidden": 0,
@ -926,6 +1038,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "taxes",
"fieldtype": "Table",
"hidden": 0,
@ -948,6 +1062,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "other_charges_calculation",
"fieldtype": "HTML",
"hidden": 0,
@ -968,6 +1084,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_44",
"fieldtype": "Section Break",
"hidden": 0,
@ -986,6 +1104,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_total_taxes_and_charges",
"fieldtype": "Currency",
"hidden": 0,
@ -1010,6 +1130,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_47",
"fieldtype": "Column Break",
"hidden": 0,
@ -1029,6 +1151,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_taxes_and_charges",
"fieldtype": "Currency",
"hidden": 0,
@ -1049,12 +1173,16 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "discount_amount",
"fieldname": "section_break_49",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Additional Discount",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -1068,6 +1196,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Grand Total",
"fieldname": "apply_discount_on",
"fieldtype": "Select",
@ -1080,7 +1210,7 @@
"options": "\nGrand Total\nNet Total",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@ -1090,6 +1220,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_51",
"fieldtype": "Column Break",
"hidden": 0,
@ -1108,6 +1240,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -1128,6 +1262,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_discount_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -1149,6 +1285,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "totals",
"fieldtype": "Section Break",
"hidden": 0,
@ -1170,6 +1308,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_grand_total",
"fieldtype": "Currency",
"hidden": 0,
@ -1194,6 +1334,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_rounded_total",
"fieldtype": "Currency",
"hidden": 0,
@ -1218,6 +1360,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "In Words will be visible once you save the Delivery Note.",
"fieldname": "base_in_words",
"fieldtype": "Data",
@ -1242,6 +1386,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -1261,6 +1407,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "grand_total",
"fieldtype": "Currency",
"hidden": 0,
@ -1285,6 +1433,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rounded_total",
"fieldtype": "Currency",
"hidden": 0,
@ -1309,6 +1459,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "In Words (Export) will be visible once you save the Delivery Note.",
"fieldname": "in_words",
"fieldtype": "Data",
@ -1333,24 +1485,9 @@
},
{
"allow_on_submit": 0,
"fieldname": "fold",
"fieldtype": "Fold",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "terms",
"fieldname": "terms_section_break",
"fieldtype": "Section Break",
"hidden": 0,
@ -1372,6 +1509,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "tc_name",
"fieldtype": "Link",
"hidden": 0,
@ -1394,6 +1533,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "terms",
"fieldtype": "Text Editor",
"hidden": 0,
@ -1415,6 +1556,9 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "transporter_name",
"fieldname": "transporter_info",
"fieldtype": "Section Break",
"hidden": 0,
@ -1435,6 +1579,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "transporter_name",
"fieldtype": "Data",
"hidden": 0,
@ -1458,6 +1604,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break34",
"fieldtype": "Column Break",
"hidden": 0,
@ -1478,7 +1626,9 @@
},
{
"allow_on_submit": 0,
"description": "Transporter lorry number",
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "lr_no",
"fieldtype": "Data",
"hidden": 0,
@ -1502,8 +1652,10 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Today",
"description": "Date on which lorry started from your warehouse",
"description": "",
"fieldname": "lr_date",
"fieldtype": "Date",
"hidden": 0,
@ -1527,6 +1679,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"depends_on": "customer",
"fieldname": "contact_info",
"fieldtype": "Section Break",
@ -1534,7 +1688,7 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Contact Info",
"label": "Contact Details",
"no_copy": 0,
"options": "icon-bullhorn",
"permlevel": 0,
@ -1548,6 +1702,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
@ -1569,6 +1725,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "customer_group",
"fieldtype": "Link",
@ -1590,6 +1748,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break21",
"fieldtype": "Column Break",
"hidden": 0,
@ -1610,6 +1770,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_person",
"fieldtype": "Link",
"hidden": 0,
@ -1630,13 +1792,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Info",
"label": "More Information",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-file-text",
@ -1651,6 +1815,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Track this Delivery Note against any Project",
"fieldname": "project_name",
"fieldtype": "Link",
@ -1674,6 +1840,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.source == 'Campaign'",
"fieldname": "campaign",
"fieldtype": "Link",
@ -1697,6 +1865,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "source",
"fieldtype": "Select",
"hidden": 0,
@ -1719,6 +1889,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break5",
"fieldtype": "Column Break",
"hidden": 0,
@ -1740,6 +1912,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Time at which items were delivered from warehouse",
"fieldname": "posting_time",
"fieldtype": "Time",
@ -1764,6 +1938,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
@ -1786,8 +1962,32 @@
"unique": 0,
"width": "150px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "printing_details",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Printing Details",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "letter_head",
"fieldtype": "Link",
"hidden": 0,
@ -1810,6 +2010,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"hidden": 0,
@ -1830,8 +2032,31 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_88",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "print_without_amount",
"fieldtype": "Check",
"hidden": 0,
@ -1853,12 +2078,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "section_break_83",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Status",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
@ -1871,6 +2099,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Draft",
"fieldname": "status",
"fieldtype": "Select",
@ -1896,6 +2126,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:!doc.__islocal",
"description": "% of materials delivered against this Delivery Note",
"fieldname": "per_installed",
@ -1919,6 +2151,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "installation_status",
"fieldtype": "Select",
"hidden": 1,
@ -1938,6 +2172,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_89",
"fieldtype": "Column Break",
"hidden": 0,
@ -1956,6 +2192,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Required only for sample item.",
"fieldname": "to_warehouse",
"fieldtype": "Link",
@ -1979,6 +2217,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "excise_page",
"fieldtype": "Data",
"hidden": 1,
@ -2000,6 +2240,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "instructions",
"fieldtype": "Text",
"hidden": 0,
@ -2021,13 +2263,16 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "total_commission",
"fieldname": "sales_team_section_break",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Team",
"label": "Commission",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-group",
@ -2042,6 +2287,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sales_partner",
"fieldtype": "Link",
"hidden": 0,
@ -2066,6 +2313,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break7",
"fieldtype": "Column Break",
"hidden": 0,
@ -2086,6 +2335,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "commission_rate",
"fieldtype": "Float",
"hidden": 0,
@ -2109,6 +2360,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_commission",
"fieldtype": "Currency",
"hidden": 0,
@ -2131,12 +2384,16 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"collapsible_depends_on": "sales_team",
"fieldname": "section_break1",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Team",
"no_copy": 0,
"permlevel": 0,
"print_hide": 1,
@ -2149,6 +2406,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sales_team",
"fieldtype": "Table",
"hidden": 0,
@ -2179,7 +2438,7 @@
"is_submittable": 1,
"issingle": 0,
"istable": 0,
"modified": "2015-08-04 11:56:59.782517",
"modified": "2015-08-27 03:29:47.032037",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note",
@ -2311,5 +2570,5 @@
"search_fields": "status,customer,customer_name, territory,base_grand_total",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "customer_name"
"title_field": "title"
}

View File

@ -47,6 +47,19 @@ class DeliveryNote(SellingController):
'source_field': 'qty',
'percent_join_field': 'against_sales_invoice',
'overflow_type': 'delivery'
},
{
'source_dt': 'Delivery Note Item',
'target_dt': 'Sales Order Item',
'join_field': 'so_detail',
'target_field': 'returned_qty',
'target_parent_dt': 'Sales Order',
# 'target_parent_field': 'per_delivered',
# 'target_ref_field': 'qty',
'source_field': '-1 * qty',
# 'percent_join_field': 'against_sales_order',
# 'overflow_type': 'delivery',
'extra_cond': """ and exists (select name from `tabDelivery Note` where name=`tabDelivery Note Item`.parent and is_return=1)"""
}]
def onload(self):
@ -66,7 +79,7 @@ class DeliveryNote(SellingController):
item_meta = frappe.get_meta("Delivery Note Item")
print_hide_fields = {
"parent": ["grand_total", "rounded_total", "in_words", "currency", "net_total"],
"parent": ["grand_total", "rounded_total", "in_words", "currency", "total", "taxes"],
"items": ["rate", "amount", "price_list_rate", "discount_percentage"]
}
@ -83,7 +96,7 @@ class DeliveryNote(SellingController):
def so_required(self):
"""check in manage account if sales order required or not"""
if not self.is_return and frappe.db.get_value("Selling Settings", None, 'so_required') == 'Yes':
if frappe.db.get_value("Selling Settings", None, 'so_required') == 'Yes':
for d in self.get('items'):
if not d.against_sales_order:
frappe.throw(_("Sales Order required for Item {0}").format(d.item_code))
@ -118,7 +131,7 @@ class DeliveryNote(SellingController):
},
})
if cint(frappe.db.get_single_value('Selling Settings', 'maintain_same_sales_rate')):
if cint(frappe.db.get_single_value('Selling Settings', 'maintain_same_sales_rate')) and not self.is_return:
self.validate_rate_with_reference_doc([["Sales Order", "sales_order", "so_detail"],
["Sales Invoice", "sales_invoice", "si_detail"]])
@ -133,6 +146,9 @@ class DeliveryNote(SellingController):
def validate_for_items(self):
check_list, chk_dupl_itm = [], []
if cint(frappe.db.get_single_value("Selling Settings", "allow_multiple_items")):
return
for d in self.get('items'):
e = [d.item_code, d.description, d.warehouse, d.against_sales_order or d.against_sales_invoice, d.batch_no or '']
f = [d.item_code, d.description, d.against_sales_order or d.against_sales_invoice]
@ -174,10 +190,10 @@ class DeliveryNote(SellingController):
# Check for Approving Authority
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)
if not self.is_return:
# update delivered qty in sales order
self.update_prevdoc_status()
# update delivered qty in sales order
self.update_prevdoc_status()
if not self.is_return:
self.check_credit_limit()
self.update_stock_ledger()
@ -190,8 +206,7 @@ class DeliveryNote(SellingController):
self.check_stop_sales_order("against_sales_order")
self.check_next_docstatus()
if not self.is_return:
self.update_prevdoc_status()
self.update_prevdoc_status()
self.update_stock_ledger()
@ -242,18 +257,17 @@ class DeliveryNote(SellingController):
ps.cancel()
frappe.msgprint(_("Packing Slip(s) cancelled"))
def update_stock_ledger(self):
sl_entries = []
for d in self.get_item_list():
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1 \
and d.warehouse and flt(d['qty']):
self.update_reserved_qty(d)
incoming_rate = 0
if cint(self.is_return) and self.return_against and self.docstatus==1:
incoming_rate = self.get_incoming_rate_for_sales_return(d.item_code, self.return_against)
sl_entries.append(self.get_sl_entries(d, {
"actual_qty": -1*flt(d['qty']),
"incoming_rate": incoming_rate
@ -374,8 +388,8 @@ def make_packing_slip(source_name, target_doc=None):
return doclist
@frappe.whitelist()
def make_sales_return(source_name, target_doc=None):
from erpnext.controllers.sales_and_purchase_return import make_return_doc
return make_return_doc("Delivery Note", source_name, target_doc)
return make_return_doc("Delivery Note", source_name, target_doc)

View File

@ -3,7 +3,7 @@ frappe.listview_settings['Delivery Note'] = {
"transporter_name", "grand_total", "is_return"],
get_indicator: function(doc) {
if(cint(doc.is_return)==1) {
return [__("Return"), "darkgrey", "is_return,=,1"];
return [__("Return"), "darkgrey", "is_return,=,Yes"];
}
}
};

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
@ -29,6 +31,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -53,6 +57,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -76,6 +82,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -94,6 +102,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
@ -113,12 +123,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "section_break_6",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -132,6 +145,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -155,6 +170,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_8",
"fieldtype": "Column Break",
"hidden": 0,
@ -174,6 +191,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@ -194,6 +213,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -215,6 +236,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@ -234,6 +257,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@ -257,6 +282,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -281,6 +308,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "price_list_rate",
"fieldname": "discount_percentage",
"fieldtype": "Float",
@ -305,6 +334,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -323,6 +354,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@ -347,6 +380,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -371,6 +406,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_1",
"fieldtype": "Section Break",
"hidden": 0,
@ -389,6 +426,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@ -413,6 +452,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@ -437,6 +478,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -455,6 +498,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -479,6 +524,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -503,6 +550,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"hidden": 0,
@ -523,6 +572,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_25",
"fieldtype": "Section Break",
"hidden": 0,
@ -542,6 +593,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -563,6 +616,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -584,6 +639,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_28",
"fieldtype": "Column Break",
"hidden": 0,
@ -603,6 +660,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -624,6 +683,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -645,6 +706,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@ -664,6 +727,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -688,6 +753,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "serial_no",
"fieldtype": "Text",
"hidden": 0,
@ -709,6 +776,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@ -729,8 +798,60 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Available Qty at Warehouse",
"no_copy": 1,
"oldfieldname": "actual_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"depends_on": "batch_no",
"fieldname": "actual_batch_qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Available Batch Qty at Warehouse",
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@ -754,6 +875,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@ -778,6 +901,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
"hidden": 1,
@ -799,6 +924,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@ -815,53 +942,10 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"fieldname": "actual_batch_qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Available Batch Qty at Warehouse",
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
{
"allow_on_submit": 1,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Available Qty at Warehouse",
"no_copy": 1,
"oldfieldname": "actual_qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "expense_account",
"fieldtype": "Link",
"hidden": 0,
@ -883,6 +967,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": ":Company",
"fieldname": "cost_center",
"fieldtype": "Link",
@ -905,6 +991,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "against_sales_order",
"fieldtype": "Link",
"hidden": 0,
@ -925,6 +1013,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "against_sales_invoice",
"fieldtype": "Link",
"hidden": 0,
@ -945,6 +1035,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "so_detail",
"fieldtype": "Data",
"hidden": 1,
@ -968,6 +1060,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "si_detail",
"fieldtype": "Data",
"hidden": 1,
@ -988,6 +1082,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "installed_qty",
"fieldtype": "Float",
"hidden": 0,
@ -1011,6 +1107,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@ -1039,7 +1137,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:46:31.447022",
"modified": "2015-08-26 08:33:03.676574",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note Item",

View File

@ -59,6 +59,10 @@ frappe.ui.form.on("Item", {
erpnext.item.toggle_reqd(frm);
erpnext.item.toggle_attributes(frm);
if (frm.is_new() && frm.doc.is_stock_item) {
frm.fields_dict.inventory.collapse(false);
}
},
validate: function(frm){
@ -91,6 +95,7 @@ frappe.ui.form.on("Item", {
},
is_stock_item: function(frm) {
frm.is_new() && frm.fields_dict.inventory.collapse(!frm.doc.is_stock_item);
erpnext.item.toggle_reqd(frm);
},

File diff suppressed because it is too large Load Diff

View File

@ -269,7 +269,7 @@ class Item(WebsiteGenerator):
frappe.db.set_value("Item", newdn, "last_purchase_rate", last_purchase_rate)
def recalculate_bin_qty(self, newdn):
from erpnext.utilities.repost_stock import repost_stock
from erpnext.stock.stock_balance import repost_stock
frappe.db.auto_commit_on_many_writes = 1
existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
@ -513,12 +513,10 @@ def validate_item_variant_attributes(item, args):
filters={"parent": ["in", args.keys()]}):
(attribute_values.setdefault(t.parent, [])).append(t.attribute_value)
numeric_attributes = frappe._dict((t.name, t) for t in frappe.get_list("Item Attribute", filters={"numeric_values":1,
"name": ["in", args.keys()]}, fields=["name", "from_range", "to_range", "increment"]))
template_item = frappe.get_doc("Item", item)
template_item_attributes = frappe._dict((d.attribute, d) for d in template_item.attributes)
numeric_attributes = frappe._dict((t.attribute, t) for t in \
frappe.db.sql("""select attribute, from_range, to_range, increment from `tabItem Variant Attribute`
where parent = %s and numeric_values=1""", (item), as_dict=1))
for attribute, value in args.items():
if attribute in numeric_attributes:
@ -531,10 +529,17 @@ def validate_item_variant_attributes(item, args):
if increment == 0:
# defensive validation to prevent ZeroDivisionError
frappe.throw(_("Increment for Attribute {0} cannot be 0").format(attribute))
is_in_range = from_range <= flt(value) <= to_range
precision = len(cstr(increment).split(".")[-1].rstrip("0"))
#avoid precision error by rounding the remainder
remainder = flt((flt(value) - from_range) % increment, precision)
is_incremental = remainder==0 or remainder==0 or remainder==increment
if not ( (from_range <= flt(value) <= to_range) and (flt(value) - from_range) % increment == 0 ):
frappe.throw(_("Value for Attribute {0} must be within the range of {1} to {2} in the increments of {3}").format(attribute, from_range, to_range, increment), InvalidItemAttributeValueError)
if not (is_in_range and is_incremental):
frappe.throw(_("Value for Attribute {0} must be within the range of {1} to {2} in the increments of {3}")\
.format(attribute, from_range, to_range, increment), InvalidItemAttributeValueError)
elif value not in attribute_values[attribute]:
frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values").format(
@ -567,7 +572,7 @@ def find_variant(item, args):
for attribute, value in args.items():
for row in variant.attributes:
if row.attribute==attribute and row.attribute_value==value:
if row.attribute==attribute and row.attribute_value== cstr(value):
# this row matches
match_count += 1
break

View File

@ -6,9 +6,8 @@ import unittest
import frappe
from frappe.test_runner import make_test_records
from erpnext.stock.doctype.item.item import (WarehouseNotSet, ItemTemplateCannotHaveStock, create_variant,
from erpnext.stock.doctype.item.item import (WarehouseNotSet, create_variant,
ItemVariantExistsError, InvalidItemAttributeValueError)
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
test_ignore = ["BOM"]
test_dependencies = ["Warehouse"]
@ -129,8 +128,16 @@ class TestItem(unittest.TestCase):
# make template item
make_item("_Test Numeric Template Item", {
"attributes": [
{"attribute": "Test Size"},
{"attribute": "Test Item Length"}
{
"attribute": "Test Size"
},
{
"attribute": "Test Item Length",
"numeric_values": 1,
"from_range": 0.0,
"to_range": 100.0,
"increment": 0.5
}
],
"default_warehouse": "_Test Warehouse - _TC"
})

View File

@ -10,7 +10,6 @@ class ItemPriceDuplicateItem(frappe.ValidationError): pass
from frappe.model.document import Document
class ItemPrice(Document):
def validate(self):
self.validate_item()
self.validate_price_list()

View File

@ -1,34 +1,110 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 0,
"autoname": "naming_series:",
"creation": "2013-03-07 14:48:38",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "type_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"options": "icon-pushpin",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"default": "{material_request_type}",
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Title",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "material_request_type",
"fieldtype": "Select",
"in_list_view": 1,
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Type",
"no_copy": 0,
"options": "Purchase\nMaterial Transfer\nMaterial Issue",
"permlevel": 0,
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Series",
"no_copy": 1,
"oldfieldname": "naming_series",
@ -36,12 +112,23 @@
"options": "MREQ-",
"permlevel": 0,
"print_hide": 1,
"reqd": 1
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "Amended From",
"no_copy": 1,
"oldfieldname": "amended_from",
@ -51,97 +138,187 @@
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"print_width": "150px",
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "items_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-shopping-cart",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "items",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Items",
"no_copy": 0,
"oldfieldname": "indent_details",
"oldfieldtype": "Table",
"options": "Material Request Item",
"permlevel": 0
},
{
"fieldname": "view_details",
"fieldtype": "Fold",
"label": "View Details",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Info",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Information",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-file-text",
"permlevel": 0
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_width": "50%",
"width": "50%"
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "requested_by",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Requested For",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "transaction_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Transaction Date",
"no_copy": 1,
"oldfieldname": "transaction_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 0,
"print_width": "100px",
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0,
"width": "100px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break2",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"print_width": "50%",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Status",
@ -153,75 +330,187 @@
"print_hide": 1,
"print_width": "100px",
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0,
"width": "100px"
},
{
"allow_on_submit": 1,
"fieldname": "letter_head",
"fieldtype": "Link",
"label": "Letter Head",
"oldfieldname": "letter_head",
"oldfieldtype": "Select",
"options": "Letter Head",
"permlevel": 0,
"print_hide": 1
},
{
"allow_on_submit": 1,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"label": "Print Heading",
"options": "Print Heading",
"permlevel": 0,
"print_hide": 1
},
{
"description": "% of materials ordered against this Material Request",
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "per_ordered",
"fieldtype": "Percent",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "% Completed",
"label": "% Ordered",
"no_copy": 1,
"oldfieldname": "per_ordered",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "printing_details",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Printing Details",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "letter_head",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Letter Head",
"no_copy": 0,
"oldfieldname": "letter_head",
"oldfieldtype": "Select",
"options": "Letter Head",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Print Heading",
"no_copy": 0,
"options": "Print Heading",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "terms",
"fieldname": "terms_section_break",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Terms and Conditions",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-legal",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "tc_name",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Terms",
"no_copy": 0,
"oldfieldname": "tc_name",
"oldfieldtype": "Link",
"options": "Terms and Conditions",
"permlevel": 0,
"print_hide": 1,
"report_hide": 1
"read_only": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "terms",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Terms and Conditions Content",
"no_copy": 0,
"oldfieldname": "terms",
"oldfieldtype": "Text Editor",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-ticket",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
"modified": "2015-07-13 05:28:25.935998",
"issingle": 0,
"istable": 0,
"modified": "2015-08-27 03:40:16.238465",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request",
@ -229,30 +518,40 @@
"permissions": [
{
"amend": 1,
"apply_user_permissions": 0,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 1,
"write": 1
},
{
"amend": 1,
"apply_user_permissions": 0,
"cancel": 1,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Stock Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 1,
"write": 1
@ -264,11 +563,15 @@
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Stock User",
"set_user_permissions": 0,
"share": 1,
"submit": 1,
"write": 1
@ -280,19 +583,24 @@
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase User",
"set_user_permissions": 0,
"share": 1,
"submit": 1,
"write": 1
}
],
"read_only": 0,
"read_only_onload": 1,
"search_fields": "status,transaction_date",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "material_request_type"
"title_field": "title"
}

View File

@ -10,9 +10,11 @@ import frappe
from frappe.utils import cstr, flt, getdate
from frappe import _
from frappe.model.mapper import get_mapped_doc
from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty
from erpnext.controllers.buying_controller import BuyingController
form_grid_templates = {
"items": "templates/form_grid/material_request_grid.html"
}
@ -136,19 +138,6 @@ class MaterialRequest(BuyingController):
def update_requested_qty(self, mr_item_rows=None):
"""update requested qty (before ordered_qty is updated)"""
from erpnext.stock.utils import get_bin
def _update_requested_qty(item_code, warehouse):
requested_qty = frappe.db.sql("""select sum(mr_item.qty - ifnull(mr_item.ordered_qty, 0))
from `tabMaterial Request Item` mr_item, `tabMaterial Request` mr
where mr_item.item_code=%s and mr_item.warehouse=%s
and mr_item.qty > ifnull(mr_item.ordered_qty, 0) and mr_item.parent=mr.name
and mr.status!='Stopped' and mr.docstatus=1""", (item_code, warehouse))
bin_doc = get_bin(item_code, warehouse)
bin_doc.indented_qty = flt(requested_qty[0][0]) if requested_qty else 0
bin_doc.save()
item_wh_list = []
for d in self.get("items"):
if (not mr_item_rows or d.name in mr_item_rows) and [d.item_code, d.warehouse] not in item_wh_list \
@ -156,7 +145,9 @@ class MaterialRequest(BuyingController):
item_wh_list.append([d.item_code, d.warehouse])
for item_code, warehouse in item_wh_list:
_update_requested_qty(item_code, warehouse)
update_bin_qty(item_code, warehouse, {
"indented_qty": get_indented_qty(item_code, warehouse)
})
def update_completed_and_requested_qty(stock_entry, method):
if stock_entry.doctype == "Stock Entry":
@ -171,7 +162,8 @@ def update_completed_and_requested_qty(stock_entry, method):
mr_obj = frappe.get_doc("Material Request", mr)
if mr_obj.status in ["Stopped", "Cancelled"]:
frappe.throw(_("Material Request {0} is cancelled or stopped").format(mr), frappe.InvalidStatusError)
frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Material Request"), mr),
frappe.InvalidStatusError)
mr_obj.update_completed_qty(mr_item_rows)
mr_obj.update_requested_qty(mr_item_rows)

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -34,6 +36,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -52,6 +56,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -75,12 +81,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "section_break_4",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -94,6 +103,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -117,6 +128,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_6",
"fieldtype": "Column Break",
"hidden": 0,
@ -136,6 +149,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@ -156,6 +171,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -177,6 +194,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quantity_and_warehouse",
"fieldtype": "Section Break",
"hidden": 0,
@ -196,6 +215,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@ -219,6 +240,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@ -243,6 +266,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -267,6 +292,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -285,6 +312,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "schedule_date",
"fieldtype": "Date",
"hidden": 0,
@ -308,13 +337,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Info",
"label": "More Information",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
@ -327,6 +358,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@ -350,6 +383,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 0,
@ -374,6 +409,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "lead_time_date",
"fieldtype": "Date",
"hidden": 0,
@ -395,6 +432,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sales_order_no",
"fieldtype": "Link",
"hidden": 0,
@ -415,6 +454,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -433,6 +474,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "min_order_qty",
"fieldtype": "Float",
"hidden": 0,
@ -456,6 +499,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "projected_qty",
"fieldtype": "Float",
"hidden": 0,
@ -479,6 +524,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "ordered_qty",
"fieldtype": "Float",
"hidden": 0,
@ -500,6 +547,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@ -528,7 +577,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:45:53.311363",
"modified": "2015-08-27 03:30:05.501449",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request Item",

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,19 @@ class PurchaseReceipt(BuyingController):
'source_field': 'qty',
'percent_join_field': 'prevdoc_docname',
'overflow_type': 'receipt'
},
{
'source_dt': 'Purchase Receipt Item',
'target_dt': 'Purchase Order Item',
'join_field': 'prevdoc_detail_docname',
'target_field': 'returned_qty',
'target_parent_dt': 'Purchase Order',
# 'target_parent_field': 'per_received',
# 'target_ref_field': 'qty',
'source_field': '-1 * qty',
# 'percent_join_field': 'prevdoc_docname',
# 'overflow_type': 'receipt',
'extra_cond': """ and exists (select name from `tabPurchase Receipt` where name=`tabPurchase Receipt Item`.parent and is_return=1)"""
}]
def onload(self):
@ -68,12 +81,12 @@ class PurchaseReceipt(BuyingController):
from `tabLanded Cost Item`
where docstatus = 1 and purchase_receipt_item = %s""", d.name)
d.landed_cost_voucher_amount = lc_voucher_amount[0][0] if lc_voucher_amount else 0.0
def validate_purchase_return(self):
for d in self.get("items"):
if self.is_return and flt(d.rejected_qty) != 0:
frappe.throw(_("Row #{0}: Rejected Qty can not be entered in Purchase Return").format(d.idx))
# validate rate with ref PR
def validate_rejected_warehouse(self):
@ -113,11 +126,11 @@ class PurchaseReceipt(BuyingController):
}
})
if cint(frappe.db.get_single_value('Buying Settings', 'maintain_same_rate')):
if cint(frappe.db.get_single_value('Buying Settings', 'maintain_same_rate')) and not self.is_return:
self.validate_rate_with_reference_doc([["Purchase Order", "prevdoc_docname", "prevdoc_detail_docname"]])
def po_required(self):
if not self.is_return and frappe.db.get_value("Buying Settings", None, "po_required") == 'Yes':
if frappe.db.get_value("Buying Settings", None, "po_required") == 'Yes':
for d in self.get('items'):
if not d.prevdoc_docname:
frappe.throw(_("Purchase Order number required for Item {0}").format(d.item_code))
@ -170,7 +183,8 @@ class PurchaseReceipt(BuyingController):
po_obj = frappe.get_doc("Purchase Order", po)
if po_obj.status in ["Stopped", "Cancelled"]:
frappe.throw(_("Material Request {0} is cancelled or stopped").format(po), frappe.InvalidStatusError)
frappe.throw(_("{0} {1} is cancelled or stopped").format(_("Purchase Order"), po),
frappe.InvalidStatusError)
po_obj.update_ordered_qty(po_item_rows)
@ -221,9 +235,10 @@ class PurchaseReceipt(BuyingController):
# Set status as Submitted
frappe.db.set(self, 'status', 'Submitted')
self.update_prevdoc_status()
self.update_ordered_qty()
if not self.is_return:
self.update_prevdoc_status()
self.update_ordered_qty()
purchase_controller.update_last_purchase_rate(self, 1)
self.update_stock_ledger()
@ -257,12 +272,11 @@ class PurchaseReceipt(BuyingController):
self.update_stock_ledger()
self.update_prevdoc_status()
# Must be called after updating received qty in PO
self.update_ordered_qty()
if not self.is_return:
self.update_prevdoc_status()
# Must be called after updating received qty in PO
self.update_ordered_qty()
pc_obj.update_last_purchase_rate(self, 0)
self.make_gl_entries_on_cancel()
@ -339,22 +353,21 @@ class PurchaseReceipt(BuyingController):
}, warehouse_account[self.supplier_warehouse]["currency"]))
# divisional loss adjustment
if not self.get("taxes"):
sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
self.precision("base_net_amount", d))
sle_valuation_amount = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty) * flt(d.conversion_factor),
self.precision("base_net_amount", d))
distributed_amount = flt(flt(d.base_net_amount, self.precision("base_net_amount", d))) + \
flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost)
distributed_amount = flt(flt(d.base_net_amount, self.precision("base_net_amount", d))) + \
flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost)
divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_net_amount", d))
if divisional_loss:
gl_entries.append(self.get_gl_dict({
"account": stock_rbnb,
"against": warehouse_account[d.warehouse]["name"],
"cost_center": d.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
"debit": divisional_loss
}, stock_rbnb_currency))
divisional_loss = flt(distributed_amount - sle_valuation_amount, self.precision("base_net_amount", d))
if divisional_loss:
gl_entries.append(self.get_gl_dict({
"account": stock_rbnb,
"against": warehouse_account[d.warehouse]["name"],
"cost_center": d.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"),
"debit": divisional_loss
}, stock_rbnb_currency))
elif d.warehouse not in warehouse_with_no_account or \
d.rejected_warehouse not in warehouse_with_no_account:
@ -472,4 +485,4 @@ def get_invoiced_qty_map(purchase_receipt):
@frappe.whitelist()
def make_purchase_return(source_name, target_doc=None):
from erpnext.controllers.sales_and_purchase_return import make_return_doc
return make_return_doc("Purchase Receipt", source_name, target_doc)
return make_return_doc("Purchase Receipt", source_name, target_doc)

View File

@ -3,7 +3,7 @@ frappe.listview_settings['Purchase Receipt'] = {
"transporter_name", "is_return"],
get_indicator: function(doc) {
if(cint(doc.is_return)==1) {
return [__("Return"), "darkgrey", "is_return,=,1"];
return [__("Return"), "darkgrey", "is_return,=,Yes"];
}
}
};

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
@ -30,6 +32,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_2",
"fieldtype": "Section Break",
"hidden": 0,
@ -49,6 +53,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -73,6 +79,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"hidden": 0,
@ -92,6 +100,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -113,12 +123,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "section_break_4",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
"no_copy": 0,
"permlevel": 0,
"precision": "",
@ -132,6 +145,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -155,6 +170,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -173,6 +190,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@ -193,6 +212,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -214,6 +235,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "received_and_accepted",
"fieldtype": "Section Break",
"hidden": 0,
@ -233,6 +256,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "received_qty",
"fieldtype": "Float",
"hidden": 0,
@ -256,6 +281,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
@ -279,6 +306,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rejected_qty",
"fieldtype": "Float",
"hidden": 0,
@ -302,6 +331,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -320,6 +351,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@ -344,6 +377,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@ -368,6 +403,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@ -391,6 +428,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rate_and_amount",
"fieldtype": "Section Break",
"hidden": 0,
@ -410,6 +449,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -430,6 +471,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "price_list_rate",
"fieldname": "discount_percentage",
"fieldtype": "Percent",
@ -450,6 +493,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -468,6 +513,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_price_list_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -488,6 +535,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
@ -506,6 +555,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "rate",
"fieldtype": "Currency",
"hidden": 0,
@ -530,6 +581,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@ -552,6 +605,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@ -570,6 +625,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -594,6 +651,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -618,6 +677,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "pricing_rule",
"fieldtype": "Link",
"hidden": 0,
@ -638,6 +699,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_29",
"fieldtype": "Section Break",
"hidden": 0,
@ -657,6 +720,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -678,6 +743,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -699,6 +766,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_32",
"fieldtype": "Column Break",
"hidden": 0,
@ -718,6 +787,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -739,6 +810,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "base_net_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -760,6 +833,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"hidden": 0,
@ -779,6 +854,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -803,6 +880,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rejected_warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -827,6 +906,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "project_name",
"fieldtype": "Link",
"hidden": 0,
@ -847,6 +928,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": ":Company",
"depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)",
"fieldname": "cost_center",
@ -869,6 +952,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "qa_no",
"fieldtype": "Link",
"hidden": 0,
@ -891,6 +976,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "schedule_date",
"fieldtype": "Date",
"hidden": 0,
@ -912,6 +999,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "stock_qty",
"fieldtype": "Float",
"hidden": 0,
@ -935,6 +1024,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_doctype",
"fieldtype": "Data",
"hidden": 1,
@ -956,6 +1047,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_docname",
"fieldtype": "Link",
"hidden": 0,
@ -980,6 +1073,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "prevdoc_detail_docname",
"fieldtype": "Data",
"hidden": 1,
@ -1003,6 +1098,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@ -1021,6 +1118,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "bom",
"fieldtype": "Link",
"hidden": 0,
@ -1042,6 +1141,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "serial_no",
"fieldtype": "Text",
"hidden": 0,
@ -1063,6 +1164,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rejected_serial_no",
"fieldtype": "Text",
"hidden": 0,
@ -1082,6 +1185,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@ -1104,6 +1209,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 1,
@ -1126,6 +1233,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "item_group",
"fieldtype": "Link",
@ -1149,6 +1258,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "rm_supp_cost",
"fieldtype": "Currency",
"hidden": 1,
@ -1173,6 +1284,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_tax_amount",
"fieldtype": "Currency",
"hidden": 1,
@ -1197,6 +1310,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "landed_cost_voucher_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -1216,6 +1331,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 1,
@ -1240,6 +1357,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
"fieldname": "item_tax_rate",
"fieldtype": "Small Text",
@ -1262,6 +1381,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "page_break",
"fieldtype": "Check",
"hidden": 0,
@ -1290,7 +1411,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:45:54.507665",
"modified": "2015-08-26 12:18:48.903651",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@ class SerialNo(StockController):
self.validate_warehouse()
self.validate_item()
self.on_stock_ledger_entry()
def set_maintenance_status(self):
if not self.warranty_expiry_date and not self.amc_expiry_date:
self.maintenance_status = None
@ -209,7 +209,7 @@ def validate_serial_no(sle, item_det):
frappe.throw(_("Serial No {0} quantity {1} cannot be a fraction").format(sle.item_code, sle.actual_qty))
if len(serial_nos) and len(serial_nos) != abs(cint(sle.actual_qty)):
frappe.throw(_("{0} Serial Numbers required for Item {0}. Only {0} provided.").format(sle.actual_qty, sle.item_code, len(serial_nos)),
frappe.throw(_("{0} Serial Numbers required for Item {1}. You have provided {2}.").format(sle.actual_qty, sle.item_code, len(serial_nos)),
SerialNoQtyError)
if len(serial_nos) != len(set(serial_nos)):

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "items_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -29,28 +31,32 @@
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "col1",
"fieldtype": "Column Break",
"hidden": 0,
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"default": "{purpose}",
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Title",
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_width": "50%",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@ -73,6 +79,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Material Issue",
"fieldname": "purpose",
"fieldtype": "Select",
@ -96,6 +104,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:in_list([\"Material Transfer for Manufacture\", \"Manufacture\"], doc.purpose)",
"fieldname": "production_order",
"fieldtype": "Link",
@ -119,6 +129,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Subcontract\"",
"fieldname": "purchase_order",
"fieldtype": "Link",
@ -141,6 +153,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "delivery_note_no",
"fieldtype": "Link",
@ -164,6 +178,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "sales_invoice_no",
"fieldtype": "Link",
@ -185,6 +201,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\"",
"fieldname": "purchase_receipt_no",
"fieldtype": "Link",
@ -208,6 +226,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:in_list([\"Material Issue\", \"Material Transfer\", \"Manufacture\", \"Repack\", \t\t\t\t\t\"Subcontract\", \"Material Transfer for Manufacture\"], doc.purpose)",
"fieldname": "from_bom",
"fieldtype": "Check",
@ -229,6 +249,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col2",
"fieldtype": "Column Break",
"hidden": 0,
@ -250,6 +272,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Today",
"fieldname": "posting_date",
"fieldtype": "Date",
@ -272,6 +296,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "posting_time",
"fieldtype": "Time",
"hidden": 0,
@ -293,6 +319,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval: doc.from_bom && (doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
"fieldname": "sb1",
"fieldtype": "Section Break",
@ -313,6 +341,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "from_bom",
"fieldname": "bom_no",
"fieldtype": "Link",
@ -334,6 +364,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "from_bom",
"description": "As per Stock UOM",
"fieldname": "fg_completed_qty",
@ -357,6 +389,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "cb1",
"fieldtype": "Column Break",
"hidden": 0,
@ -375,6 +409,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "1",
"depends_on": "from_bom",
"description": "Including items for sub assemblies",
@ -397,6 +433,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "from_bom",
"fieldname": "get_items",
"fieldtype": "Button",
@ -418,6 +456,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_12",
"fieldtype": "Section Break",
"hidden": 0,
@ -437,6 +477,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "from_warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -459,6 +501,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "cb0",
"fieldtype": "Column Break",
"hidden": 0,
@ -477,6 +521,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "to_warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -499,6 +545,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sb0",
"fieldtype": "Section Break",
"hidden": 0,
@ -518,6 +566,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "items",
"fieldtype": "Table",
"hidden": 0,
@ -540,14 +590,16 @@
},
{
"allow_on_submit": 0,
"description": "Get valuation rate and available stock at source/target warehouse on mentioned posting date-time. If serialized item, please press this button after entering serial nos.",
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "get_stock_and_rate",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Get Stock and Rate",
"label": "Update Rate and Availability",
"no_copy": 0,
"oldfieldtype": "Button",
"options": "get_stock_and_rate",
@ -562,6 +614,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_19",
"fieldtype": "Section Break",
"hidden": 0,
@ -581,6 +635,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_incoming_value",
"fieldtype": "Currency",
"hidden": 0,
@ -602,6 +658,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_22",
"fieldtype": "Column Break",
"hidden": 0,
@ -621,6 +679,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_outgoing_value",
"fieldtype": "Currency",
"hidden": 0,
@ -642,6 +702,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "value_difference",
"fieldtype": "Currency",
"hidden": 0,
@ -663,6 +725,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "This will override Difference Account in Item",
"fieldname": "difference_account",
"fieldtype": "Link",
@ -685,6 +749,9 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"collapsible_depends_on": "total_additional_costs",
"fieldname": "additional_costs_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -705,6 +772,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "additional_costs",
"fieldtype": "Table",
"hidden": 0,
@ -726,6 +795,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_additional_costs",
"fieldtype": "Currency",
"hidden": 0,
@ -747,24 +818,8 @@
},
{
"allow_on_submit": 0,
"fieldname": "fold",
"fieldtype": "Fold",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"depends_on": "eval: in_list([\"Sales Return\", \"Purchase Return\", \"Subcontract\"], doc.purpose)",
"fieldname": "contact_section",
"fieldtype": "Section Break",
@ -772,7 +827,7 @@
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"label": "Customer or Supplier Details",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
@ -785,6 +840,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier",
"fieldtype": "Link",
@ -808,6 +865,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier_name",
"fieldtype": "Data",
@ -830,6 +889,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Purchase Return\" || doc.purpose==\"Subcontract\"",
"fieldname": "supplier_address",
"fieldtype": "Small Text",
@ -852,6 +913,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_39",
"fieldtype": "Column Break",
"hidden": 0,
@ -871,6 +934,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "customer",
"fieldtype": "Link",
@ -894,6 +959,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "customer_name",
"fieldtype": "Data",
@ -916,6 +983,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.purpose==\"Sales Return\"",
"fieldname": "customer_address",
"fieldtype": "Small Text",
@ -938,16 +1007,18 @@
},
{
"allow_on_submit": 0,
"fieldname": "more_info",
"bold": 0,
"collapsible": 1,
"fieldname": "printing_settings",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"label": "Printing Settings",
"no_copy": 0,
"oldfieldtype": "Section Break",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
@ -956,133 +1027,10 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "project_name",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Project Name",
"no_copy": 0,
"oldfieldname": "project_name",
"oldfieldtype": "Link",
"options": "Project",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "remarks",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Remarks",
"no_copy": 1,
"oldfieldname": "remarks",
"oldfieldtype": "Text",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "col5",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_width": "50%",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"fieldname": "total_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Fiscal Year",
"no_copy": 0,
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"hidden": 0,
@ -1105,6 +1053,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "letter_head",
"fieldtype": "Link",
"hidden": 0,
@ -1126,6 +1076,167 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Information",
"no_copy": 0,
"oldfieldtype": "Section Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "project_name",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Project Name",
"no_copy": 0,
"oldfieldname": "project_name",
"oldfieldtype": "Link",
"options": "Project",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "remarks",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Remarks",
"no_copy": 1,
"oldfieldname": "remarks",
"oldfieldtype": "Text",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col5",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_width": "50%",
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "total_amount",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Total Amount",
"no_copy": 0,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Fiscal Year",
"no_copy": 0,
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
@ -1148,6 +1259,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "credit_note",
"fieldtype": "Link",
"hidden": 1,
@ -1178,7 +1291,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2015-08-12 08:51:07.002600",
"modified": "2015-08-27 03:30:35.994097",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry",
@ -1270,5 +1383,5 @@
"search_fields": "posting_date, from_warehouse, to_warehouse, purpose, remarks",
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "purpose"
"title_field": "title"
}

View File

@ -10,6 +10,8 @@
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "barcode",
"fieldtype": "Data",
"hidden": 0,
@ -30,6 +32,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break_2",
"fieldtype": "Section Break",
"hidden": 0,
@ -49,6 +53,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "s_warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -71,6 +77,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -89,6 +97,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "t_warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -111,6 +121,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "sec_break1",
"fieldtype": "Section Break",
"hidden": 0,
@ -129,6 +141,8 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -151,6 +165,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -169,46 +185,8 @@
},
{
"allow_on_submit": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Qty",
"no_copy": 0,
"oldfieldname": "qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"fieldname": "section_break_8",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -228,6 +206,30 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 1,
"fieldname": "section_break_8",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Description",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -251,6 +253,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_10",
"fieldtype": "Column Break",
"hidden": 0,
@ -270,6 +274,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image",
"fieldtype": "Attach",
"hidden": 1,
@ -290,6 +296,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "image_view",
"fieldtype": "Image",
"hidden": 0,
@ -311,6 +319,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"hidden": 0,
@ -330,12 +340,37 @@
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Qty",
"no_copy": 0,
"oldfieldname": "qty",
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"fieldname": "basic_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"in_list_view": 0,
"label": "Basic Rate (as per Stock UOM)",
"no_copy": 0,
"oldfieldname": "incoming_rate",
@ -352,6 +387,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "basic_amount",
"fieldtype": "Currency",
"hidden": 0,
@ -373,6 +410,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "additional_cost",
"fieldtype": "Currency",
"hidden": 0,
@ -394,6 +433,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amount",
"fieldtype": "Currency",
"hidden": 0,
@ -416,6 +457,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -437,6 +480,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -455,6 +500,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "uom",
"fieldtype": "Link",
"hidden": 0,
@ -477,6 +524,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "conversion_factor",
"fieldtype": "Float",
"hidden": 0,
@ -498,6 +547,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@ -520,6 +571,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "transfer_qty",
"fieldtype": "Float",
"hidden": 0,
@ -541,6 +594,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "serial_no_batch",
"fieldtype": "Section Break",
"hidden": 0,
@ -560,6 +615,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "serial_no",
"fieldtype": "Text",
"hidden": 0,
@ -581,6 +638,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"hidden": 0,
@ -599,6 +658,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "batch_no",
"fieldtype": "Link",
"hidden": 0,
@ -621,6 +682,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "accounting",
"fieldtype": "Section Break",
"hidden": 0,
@ -640,6 +703,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)",
"fieldname": "expense_account",
"fieldtype": "Link",
@ -661,6 +726,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break5",
"fieldtype": "Column Break",
"hidden": 0,
@ -679,6 +746,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": ":Company",
"depends_on": "eval:cint(sys_defaults.auto_accounting_for_stock)",
"fieldname": "cost_center",
@ -701,13 +770,15 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Info",
"label": "More Information",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
@ -720,6 +791,8 @@
},
{
"allow_on_submit": 1,
"bold": 0,
"collapsible": 0,
"fieldname": "actual_qty",
"fieldtype": "Float",
"hidden": 0,
@ -741,6 +814,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "BOM No. for a Finished Good Item",
"fieldname": "bom_no",
"fieldtype": "Link",
@ -762,6 +837,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break6",
"fieldtype": "Column Break",
"hidden": 0,
@ -780,6 +857,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Material Request used to make this Stock Entry",
"fieldname": "material_request",
"fieldtype": "Link",
@ -801,6 +880,8 @@
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "material_request_item",
"fieldtype": "Link",
"hidden": 1,
@ -828,7 +909,7 @@
"is_submittable": 0,
"issingle": 0,
"istable": 1,
"modified": "2015-08-19 12:45:55.315363",
"modified": "2015-08-27 03:30:49.875635",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",

View File

@ -88,9 +88,12 @@ def update_stock_ledger_entry(item_code, new_stock_uom, conversion_factor):
if flt(conversion_factor) != flt(1):
frappe.db.sql("""update `tabStock Ledger Entry`
set stock_uom = %s, actual_qty = ifnull(actual_qty,0) * %s
set
stock_uom = %s,
actual_qty = ifnull(actual_qty,0) * %s,
qty_after_transaction = ifnull(qty_after_transaction, 0) * %s
where item_code = %s""",
(new_stock_uom, conversion_factor, item_code))
(new_stock_uom, conversion_factor, conversion_factor, item_code))
else:
frappe.db.sql("""update `tabStock Ledger Entry` set stock_uom=%s
where item_code=%s""", (new_stock_uom, item_code))

View File

@ -140,7 +140,7 @@ class Warehouse(Document):
self.recalculate_bin_qty(newdn)
def recalculate_bin_qty(self, newdn):
from erpnext.utilities.repost_stock import repost_stock
from erpnext.stock.stock_balance import repost_stock
frappe.db.auto_commit_on_many_writes = 1
existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)

View File

@ -257,6 +257,10 @@ def validate_price_list(args):
def validate_conversion_rate(args, meta):
from erpnext.controllers.accounts_controller import validate_conversion_rate
if (not args.conversion_rate
and args.currency==frappe.db.get_value("Company", args.company, "default_currency")):
args.conversion_rate = 1.0
# validate currency conversion rate
validate_conversion_rate(args.currency, args.conversion_rate,
meta.get_label("conversion_rate"), args.company)

View File

@ -1,197 +1,494 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
"autoname": "MV.#####",
"creation": "2013-01-10 16:34:31",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_details",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-user",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Customer",
"no_copy": 0,
"oldfieldname": "customer",
"oldfieldtype": "Link",
"options": "Customer",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Name",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "address_display",
"fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Address",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_display",
"fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Contact",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_mobile",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Mobile No",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_email",
"fieldtype": "Data",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Contact Email",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Today",
"fieldname": "mntc_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Maintenance Date",
"no_copy": 1,
"oldfieldname": "mntc_date",
"oldfieldtype": "Date",
"permlevel": 0,
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "mntc_time",
"fieldtype": "Time",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Maintenance Time",
"no_copy": 1,
"oldfieldname": "mntc_time",
"oldfieldtype": "Time",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "maintenance_details",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-wrench",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "completion_status",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Completion Status",
"no_copy": 0,
"oldfieldname": "completion_status",
"oldfieldtype": "Select",
"options": "\nPartially Completed\nFully Completed",
"permlevel": 0,
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break_14",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Unscheduled",
"fieldname": "maintenance_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "Maintenance Type",
"no_copy": 0,
"oldfieldname": "maintenance_type",
"oldfieldtype": "Select",
"options": "\nScheduled\nUnscheduled\nBreakdown",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "section_break0",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-wrench",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "purposes",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Purposes",
"no_copy": 0,
"oldfieldname": "maintenance_visit_details",
"oldfieldtype": "Table",
"options": "Maintenance Visit Purpose",
"permlevel": 0,
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Info",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Information",
"no_copy": 0,
"oldfieldtype": "Section Break",
"options": "icon-file-text",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_feedback",
"fieldtype": "Small Text",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Feedback",
"no_copy": 0,
"oldfieldname": "customer_feedback",
"oldfieldtype": "Small Text",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break3",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Draft",
"fieldname": "status",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Status",
"no_copy": 1,
"oldfieldname": "status",
"oldfieldtype": "Data",
"options": "\nDraft\nCancelled\nSubmitted",
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"reqd": 1
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "amended_from",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"in_filter": 0,
"in_list_view": 0,
"label": "Amended From",
"no_copy": 1,
"oldfieldname": "amended_from",
@ -200,86 +497,205 @@
"permlevel": 0,
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "150px"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Company",
"no_copy": 0,
"oldfieldname": "company",
"oldfieldtype": "Select",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "fiscal_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Fiscal Year",
"no_copy": 0,
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "customer",
"fieldname": "contact_info_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Contact Info",
"no_copy": 0,
"options": "icon-bullhorn",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_address",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Address",
"no_copy": 0,
"options": "Address",
"permlevel": 0,
"print_hide": 1
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_person",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Contact Person",
"no_copy": 0,
"options": "Contact",
"permlevel": 0,
"print_hide": 1
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "col_break4",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "territory",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Territory",
"no_copy": 0,
"options": "Territory",
"permlevel": 0,
"print_hide": 1
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "customer_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Group",
"no_copy": 0,
"options": "Customer Group",
"permlevel": 0,
"print_hide": 1
"print_hide": 1,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-file-text",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 1,
"modified": "2015-02-20 05:08:31.875844",
"issingle": 0,
"istable": 0,
"modified": "2015-08-27 03:33:20.922744",
"modified_by": "Administrator",
"module": "Support",
"name": "Maintenance Visit",
@ -292,16 +708,22 @@
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Maintenance User",
"set_user_permissions": 0,
"share": 1,
"submit": 1,
"write": 1
}
],
"read_only": 0,
"read_only_onload": 0,
"search_fields": "status,maintenance_type,customer,customer_name,mntc_date,company,fiscal_year",
"sort_field": "modified",
"sort_order": "DESC",

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,8 @@
{% } %}
{% if(doc.item_name != doc.item_code && in_list(visible_column_fieldnames, "item_name")) { %}
<br>{%= doc.item_name %}{% } %}
{% if (doc.item_code) { %}<br>{% } %}
{%= doc.item_name %}{% } %}
{% include "templates/form_grid/includes/visible_cols.html" %}
</div>

View File

@ -21,3 +21,5 @@ def send_message(subject="Website Query", message="", sender="", status="Open"):
"sent_or_received": "Received"
})
comm.insert(ignore_permissions=True)
return "okay"

View File

@ -1,354 +1,723 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 1,
"creation": "2013-01-10 16:34:32",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Master",
"document_type": "Setup",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "",
"no_copy": 0,
"options": "icon-user",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "first_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "First Name",
"no_copy": 0,
"oldfieldname": "first_name",
"oldfieldtype": "Data",
"permlevel": 0,
"reqd": 1
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "last_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Last Name",
"no_copy": 0,
"oldfieldname": "last_name",
"oldfieldtype": "Data",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "cb00",
"fieldtype": "Column Break",
"permlevel": 0
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "Passive",
"fieldname": "status",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Status",
"no_copy": 0,
"options": "Passive\nOpen\nReplied",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "email_id",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Email Id",
"no_copy": 0,
"oldfieldname": "email_id",
"oldfieldtype": "Data",
"options": "Email",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "phone",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Phone",
"no_copy": 0,
"oldfieldname": "contact_no",
"oldfieldtype": "Data",
"permlevel": 0,
"reqd": 0
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "contact_details",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reference",
"no_copy": 0,
"options": "icon-pushpin",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer",
"no_copy": 0,
"oldfieldname": "customer",
"oldfieldtype": "Link",
"options": "Customer",
"permlevel": 0,
"print_hide": 0
},
{
"depends_on": "",
"fieldname": "customer_name",
"fieldtype": "Data",
"in_list_view": 0,
"label": "Customer Name",
"permlevel": 0,
"read_only": 1
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"permlevel": 0,
"width": "50%"
},
{
"depends_on": "",
"fieldname": "supplier",
"fieldtype": "Link",
"label": "Supplier",
"options": "Supplier",
"permlevel": 0
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Name",
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "supplier",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Supplier",
"no_copy": 0,
"options": "Supplier",
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "supplier_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Supplier Name",
"no_copy": 0,
"permlevel": 0,
"read_only": 1
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "",
"fieldname": "sales_partner",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Sales Partner",
"no_copy": 0,
"options": "Sales Partner",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "0",
"depends_on": "eval:(doc.customer || doc.supplier || doc.sales_partner)",
"fieldname": "is_primary_contact",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Primary Contact",
"no_copy": 0,
"oldfieldname": "is_primary_contact",
"oldfieldtype": "Select",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "more_info",
"fieldtype": "Section Break",
"label": "More Info",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "More Information",
"no_copy": 0,
"options": "icon-file-text",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "mobile_no",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Mobile No",
"no_copy": 0,
"oldfieldname": "mobile_no",
"oldfieldtype": "Data",
"permlevel": 0
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Enter department to which this Contact belongs",
"fieldname": "department",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Department",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Enter designation of this Contact",
"fieldname": "designation",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Designation",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "unsubscribed",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Unsubscribed",
"permlevel": 0
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "icon-user",
"idx": 1,
"in_create": 0,
"in_dialog": 0,
"modified": "2015-07-09 08:15:29.026935",
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"modified": "2015-08-27 03:39:27.529205",
"modified_by": "Administrator",
"module": "Utilities",
"name": "Contact",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"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": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Master Manager",
"share": 1,
"submit": 0,
"write": 1
},
{
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase Master Manager",
"share": 1,
"submit": 0,
"write": 1
},
{
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Manager",
"share": 1,
"submit": 0,
"write": 1
},
{
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase Manager",
"share": 1,
"submit": 0,
"write": 1
},
{
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Maintenance Manager",
"share": 1,
"submit": 0,
"write": 1
},
{
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts Manager",
"share": 1,
"submit": 0,
"write": 1
},
{
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"share": 1,
"submit": 0,
"write": 1
},
{
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase User",
"share": 1,
"submit": 0,
"write": 1
},
{
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Maintenance User",
"share": 1,
"submit": 0,
"write": 1
},
{
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase Master Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Maintenance Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"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": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Maintenance User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
"email": 0,
"export": 0,
"if_owner": 0,
"import": 0,
"match": "",
"permlevel": 1,
"print": 0,
"read": 1,
"report": 1,
"role": "All",
"submit": 0
"set_user_permissions": 0,
"share": 0,
"submit": 0,
"write": 0
}
]
],
"read_only": 0,
"read_only_onload": 0
}

View File

@ -34,7 +34,7 @@ class TransactionBase(StatusUpdater):
if events:
frappe.db.sql("delete from `tabEvent` where name in (%s)"
.format(", ".join(['%s']*len(events))), tuple(events))
frappe.db.sql("delete from `tabEvent Role` where parent in (%s)"
.format(", ".join(['%s']*len(events))), tuple(events))
@ -47,7 +47,7 @@ class TransactionBase(StatusUpdater):
"owner": opts.owner or self.owner,
"subject": opts.subject,
"description": opts.description,
"starts_on": self.contact_date + " 10:00:00",
"starts_on": self.contact_date,
"event_type": "Private",
"ref_type": self.doctype,
"ref_name": self.name
@ -56,7 +56,7 @@ class TransactionBase(StatusUpdater):
event.insert(ignore_permissions=True)
if frappe.db.exists("User", self.contact_by):
frappe.share.add("Event", event.name, self.contact_by,
frappe.share.add("Event", event.name, self.contact_by,
flags={"ignore_share_permission": True})
def validate_uom_is_integer(self, uom_field, qty_fields):
@ -92,14 +92,14 @@ class TransactionBase(StatusUpdater):
for field, condition in fields:
if prevdoc_values[field] is not None:
self.validate_value(field, condition, prevdoc_values[field], doc)
def validate_rate_with_reference_doc(self, ref_details):
for ref_dt, ref_dn_field, ref_link_field in ref_details:
for d in self.get("items"):
if d.get(ref_link_field):
ref_rate = frappe.db.get_value(ref_dt + " Item", d.get(ref_link_field), "rate")
if abs(flt(d.rate - ref_rate, d.precision("rate"))) >= .01:
frappe.throw(_("Row #{0}: Rate must be same as {1}: {2} ({3} / {4}) ")
.format(d.idx, ref_dt, d.get(ref_dn_field), d.rate, ref_rate))

Some files were not shown because too many files have changed in this diff Show More