Merge pull request #13746 from Zlash65/supplier-group

[Enhance] Rename Supplier Type to Supplier Group - tree structure implemented
This commit is contained in:
rohitwaghchaure 2018-05-14 20:40:30 +05:30 committed by GitHub
commit d9faba962b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 626 additions and 239 deletions

View File

@ -120,12 +120,12 @@ class OpeningInvoiceCreationTool(Document):
if party_type == "Customer":
party_doc.customer_name = party
else:
supplier_type = frappe.db.get_single_value("Buying Settings", "supplier_type")
if not supplier_type:
frappe.throw(_("Please Set Supplier Type in Buying Settings."))
supplier_group = frappe.db.get_single_value("Buying Settings", "supplier_group")
if not supplier_group:
frappe.throw(_("Please Set Supplier Group in Buying Settings."))
party_doc.supplier_name = party
party_doc.supplier_type = supplier_type
party_doc.supplier_group = supplier_group
party_doc.flags.ignore_mandatory = True
party_doc.save(ignore_permissions=True)

View File

@ -33,7 +33,7 @@ frappe.ui.form.on("Pricing Rule", "refresh", function(frm) {
${__("Pricing Rule is first selected based on 'Apply On' field, which can be Item, Item Group or Brand.")}
</li>
<li>
${__("Then Pricing Rules are filtered out based on Customer, Customer Group, Territory, Supplier, Supplier Type, Campaign, Sales Partner etc.")}
${__("Then Pricing Rules are filtered out based on Customer, Customer Group, Territory, Supplier, Supplier Group, Campaign, Sales Partner etc.")}
</li>
<li>
${__('Pricing Rules are further filtered based on quantity.')}
@ -51,7 +51,7 @@ frappe.ui.form.on("Pricing Rule", "refresh", function(frm) {
${__('Customer > Customer Group > Territory')}
</li>
<li>
${__('Supplier > Supplier Type')}
${__('Supplier > Supplier Group')}
</li>
</ul>
</li>
@ -75,7 +75,7 @@ cur_frm.cscript.set_options_for_applicable_for = function() {
options = $.merge(options, ["Customer", "Customer Group", "Territory", "Sales Partner", "Campaign"]);
}
if(cur_frm.doc.buying) {
$.merge(options, ["Supplier", "Supplier Type"]);
$.merge(options, ["Supplier", "Supplier Group"]);
}
set_field_options("applicable_for", options.join("\n"));

View File

@ -39,6 +39,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -69,6 +70,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -100,6 +102,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -131,6 +134,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -162,6 +166,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -193,6 +198,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -222,6 +228,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -253,6 +260,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -282,6 +290,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -311,6 +320,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -340,6 +350,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -369,6 +380,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -398,6 +410,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -419,7 +432,7 @@
"label": "Applicable For",
"length": 0,
"no_copy": 0,
"options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Type",
"options": "\nCustomer\nCustomer Group\nTerritory\nSales Partner\nCampaign\nSupplier\nSupplier Group",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -429,6 +442,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -460,6 +474,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -491,6 +506,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -522,6 +538,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -553,6 +570,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -584,6 +602,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -615,6 +634,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -623,8 +643,8 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.applicable_for==\"Supplier Type\"",
"fieldname": "supplier_type",
"depends_on": "eval:doc.applicable_for==\"Supplier Group\"",
"fieldname": "supplier_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
@ -633,10 +653,10 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier Type",
"label": "Supplier Group",
"length": 0,
"no_copy": 0,
"options": "Supplier Type",
"options": "Supplier Group",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -646,6 +666,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -675,6 +696,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -704,6 +726,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -733,6 +756,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -762,6 +786,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -791,6 +816,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -821,6 +847,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -850,6 +877,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -878,6 +906,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -908,6 +937,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -940,6 +970,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -971,6 +1002,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1003,6 +1035,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1032,6 +1065,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1064,6 +1098,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1093,6 +1128,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1124,6 +1160,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1152,6 +1189,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1182,6 +1220,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1212,6 +1251,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1243,6 +1283,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1273,6 +1314,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -1302,6 +1344,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
@ -1316,7 +1359,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-02-12 17:21:22.559996",
"modified": "2018-04-19 07:52:41.024618",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Pricing Rule",
@ -1324,7 +1367,6 @@
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
@ -1344,7 +1386,6 @@
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
@ -1364,7 +1405,6 @@
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
@ -1384,7 +1424,6 @@
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
@ -1404,7 +1443,6 @@
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,

View File

@ -41,7 +41,7 @@ class PricingRule(Document):
throw(_("Selling must be checked, if Applicable For is selected as {0}"
.format(self.applicable_for)))
if not self.buying and self.applicable_for in ["Supplier", "Supplier Type"]:
if not self.buying and self.applicable_for in ["Supplier", "Supplier Group"]:
throw(_("Buying must be checked, if Applicable For is selected as {0}"
.format(self.applicable_for)))
@ -85,7 +85,7 @@ def apply_pricing_rule(args):
"customer_group": "something",
"territory": "something",
"supplier": "something",
"supplier_type": "something",
"supplier_group": "something",
"currency": "something",
"conversion_rate": "something",
"price_list": "something",
@ -165,10 +165,10 @@ def get_pricing_rule_for_item(args):
if customer:
args.customer_group, args.territory = customer
args.supplier = args.supplier_type = None
args.supplier = args.supplier_group = None
elif args.supplier and not args.supplier_type:
args.supplier_type = frappe.db.get_value("Supplier", args.supplier, "supplier_type")
elif args.supplier and not args.supplier_group:
args.supplier_group = frappe.db.get_value("Supplier", args.supplier, "supplier_group")
args.customer = args.customer_group = args.territory = None
pricing_rules = get_pricing_rules(args)
@ -258,7 +258,7 @@ def get_pricing_rules(args):
conditions = item_variant_condition = ""
values = {"item_code": args.get("item_code"), "brand": args.get("brand")}
for field in ["company", "customer", "supplier", "supplier_type", "campaign", "sales_partner"]:
for field in ["company", "customer", "supplier", "supplier_group", "campaign", "sales_partner"]:
if args.get(field):
conditions += " and ifnull("+field+", '') in (%("+field+")s, '')"
values[field] = args.get(field)
@ -324,11 +324,11 @@ def filter_pricing_rules(args, pricing_rules):
# apply internal priority
all_fields = ["item_code", "item_group", "brand", "customer", "customer_group", "territory",
"supplier", "supplier_type", "campaign", "sales_partner", "variant_of"]
"supplier", "supplier_group", "campaign", "sales_partner", "variant_of"]
if len(pricing_rules) > 1:
for field_set in [["item_code", "variant_of", "item_group", "brand"],
["customer", "customer_group", "territory"], ["supplier", "supplier_type"]]:
["customer", "customer_group", "territory"], ["supplier", "supplier_group"]]:
remaining_fields = list(set(all_fields) - set(field_set))
if if_all_rules_same(pricing_rules, remaining_fields):
pricing_rules = apply_internal_priority(pricing_rules, field_set, args)

View File

@ -2,7 +2,7 @@
// License: GNU General Public License v3. See license.txt
cur_frm.add_fetch("customer", "customer_group", "customer_group" );
cur_frm.add_fetch("supplier", "supplier_type", "supplier_type" );
cur_frm.add_fetch("supplier", "supplier_group_name", "supplier_group" );
frappe.ui.form.on("Tax Rule", "tax_type", function(frm) {
frm.toggle_reqd("sales_tax_template", frm.doc.tax_type=="Sales");

View File

@ -1,5 +1,6 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 0,
"autoname": "TR.####",
@ -12,6 +13,7 @@
"editable_grid": 0,
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -40,9 +42,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -69,9 +73,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -97,9 +103,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -128,9 +136,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -159,9 +169,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -188,9 +200,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -219,9 +233,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -250,9 +266,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -279,9 +297,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -308,9 +328,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -337,9 +359,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -367,9 +391,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -395,9 +421,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -426,15 +454,17 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.tax_type==\"Purchase\"",
"fieldname": "supplier_type",
"fieldname": "supplier_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
@ -443,10 +473,10 @@
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier Type",
"label": "Supplier Group",
"length": 0,
"no_copy": 0,
"options": "Supplier Type",
"options": "Supplier Group",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@ -457,9 +487,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -486,9 +518,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -515,9 +549,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -544,9 +580,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -574,9 +612,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -603,9 +643,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -632,9 +674,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -660,9 +704,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -689,9 +735,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -717,9 +765,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -747,9 +797,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -775,9 +827,11 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
@ -805,20 +859,21 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-02-17 16:22:42.501765",
"modified": "2018-04-19 07:53:43.020808",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Tax Rule",
@ -827,7 +882,6 @@
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,

View File

@ -30,7 +30,7 @@ class TaxRule(Document):
def validate_tax_template(self):
if self.tax_type== "Sales":
self.purchase_tax_template = self.supplier = self.supplier_type = None
self.purchase_tax_template = self.supplier = self.supplier_group = None
if self.customer:
self.customer_group = None
@ -38,7 +38,7 @@ class TaxRule(Document):
self.sales_tax_template = self.customer = self.customer_group = None
if self.supplier:
self.supplier_type = None
self.supplier_group = None
if not (self.sales_tax_template or self.purchase_tax_template):
frappe.throw(_("Tax Template is mandatory."))
@ -53,7 +53,7 @@ class TaxRule(Document):
"customer": self.customer,
"customer_group": self.customer_group,
"supplier": self.supplier,
"supplier_type": self.supplier_type,
"supplier_group": self.supplier_group,
"billing_city": self.billing_city,
"billing_county": self.billing_county,
"billing_state": self.billing_state,

View File

@ -47,7 +47,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
set_contact_details(out, party, party_type)
set_other_values(out, party, party_type)
set_price_list(out, party, party_type, price_list)
out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_type)
out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_group)
out["payment_terms_template"] = get_pyt_term_template(party.name, party_type, company)
if not out.get("currency"):
@ -105,7 +105,7 @@ def set_other_values(out, party, party_type):
if party_type=="Customer":
to_copy = ["customer_name", "customer_group", "territory", "language"]
else:
to_copy = ["supplier_name", "supplier_type", "language"]
to_copy = ["supplier_name", "supplier_group", "language"]
for f in to_copy:
out[f] = party.get(f)
@ -169,7 +169,7 @@ def set_account_and_due_date(party, account, party_type, company, posting_date,
def get_party_account(party_type, party, company):
"""Returns the account for the given `party`.
Will first search in party (Customer / Supplier) record, if not found,
will search in group (Customer Group / Supplier Type),
will search in group (Customer Group / Supplier Group),
finally will return default."""
if not company:
frappe.throw(_("Please select a Company"))
@ -181,7 +181,7 @@ def get_party_account(party_type, party, company):
{"parenttype": party_type, "parent": party, "company": company}, "account")
if not account and party_type in ['Customer', 'Supplier']:
party_group_doctype = "Customer Group" if party_type=="Customer" else "Supplier Type"
party_group_doctype = "Customer Group" if party_type=="Customer" else "Supplier Group"
group = frappe.db.get_value(party_type, party, scrub(party_group_doctype))
account = frappe.db.get_value("Party Account",
{"parenttype": party_group_doctype, "parent": group, "company": company}, "account")
@ -274,8 +274,8 @@ def get_due_date(posting_date, party_type, party, company=None, bill_date=None):
due_date = get_due_date_from_template(template_name, posting_date, bill_date).strftime("%Y-%m-%d")
else:
if party_type == "Supplier":
supplier_type = frappe.db.get_value(party_type, party, fieldname="supplier_type")
template_name = frappe.db.get_value("Supplier Type", supplier_type, fieldname="payment_terms")
supplier_group = frappe.db.get_value(party_type, party, fieldname="supplier_group")
template_name = frappe.db.get_value("Supplier Group", supplier_group, fieldname="payment_terms")
if template_name:
due_date = get_due_date_from_template(template_name, posting_date, bill_date).strftime("%Y-%m-%d")
# If due date is calculated from bill_date, check this condition
@ -321,7 +321,7 @@ def validate_due_date(posting_date, due_date, party_type, party, company=None, b
.format(formatdate(default_due_date)))
@frappe.whitelist()
def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_type=None,
def set_taxes(party, party_type, posting_date, company, customer_group=None, supplier_group=None,
billing_address=None, shipping_address=None, use_for_shopping_cart=None):
from erpnext.accounts.doctype.tax_rule.tax_rule import get_tax_template, get_party_details
args = {
@ -332,8 +332,8 @@ def set_taxes(party, party_type, posting_date, company, customer_group=None, sup
if customer_group:
args['customer_group'] = customer_group
if supplier_type:
args['supplier_type'] = supplier_type
if supplier_group:
args['supplier_group'] = supplier_group
if billing_address or shipping_address:
args.update(get_party_details(party, party_type, {"billing_address": billing_address, \
@ -371,10 +371,10 @@ def get_pyt_term_template(party_name, party_type, company=None):
customer.customer_group, fieldname='payment_terms')
else:
supplier = frappe.db.get_value("Supplier", party_name,
fieldname=['payment_terms', "supplier_type"], as_dict=1)
fieldname=['payment_terms', "supplier_group"], as_dict=1)
template = supplier.payment_terms
if not template and supplier.supplier_type:
template = frappe.db.get_value("Supplier Type", supplier.supplier_type, fieldname='payment_terms')
if not template and supplier.supplier_group:
template = frappe.db.get_value("Supplier Group", supplier.supplier_group, fieldname='payment_terms')
if not template and company:
template = frappe.db.get_value("Company", company, fieldname='payment_terms')

View File

@ -112,7 +112,7 @@ class ReceivablePayableReport(object):
_("Customer Group") + ":Link/Customer Group:120"
]
if args.get("party_type") == "Supplier":
columns += [_("Supplier Type") + ":Link/Supplier Type:80"]
columns += [_("Supplier Group") + ":Link/Supplier Group:80"]
columns.append(_("Remarks") + "::200")
@ -194,11 +194,11 @@ class ReceivablePayableReport(object):
# Delivery Note
row += [voucher_details.get(gle.voucher_no, {}).get("delivery_note")]
# customer territory / supplier type
# customer territory / supplier group
if args.get("party_type") == "Customer":
row += [self.get_territory(gle.party), self.get_customer_group(gle.party)]
if args.get("party_type") == "Supplier":
row += [self.get_supplier_type(gle.party)]
row += [self.get_supplier_group(gle.party)]
row.append(gle.remarks)
data.append(row)
@ -260,15 +260,15 @@ class ReceivablePayableReport(object):
def get_customer_group(self, party_name):
return self.get_party_map("Customer").get(party_name, {}).get("customer_group") or ""
def get_supplier_type(self, party_name):
return self.get_party_map("Supplier").get(party_name, {}).get("supplier_type") or ""
def get_supplier_group(self, party_name):
return self.get_party_map("Supplier").get(party_name, {}).get("supplier_group") or ""
def get_party_map(self, party_type):
if not hasattr(self, "party_map"):
if party_type == "Customer":
select_fields = "name, customer_name, territory, customer_group"
elif party_type == "Supplier":
select_fields = "name, supplier_name, supplier_type"
select_fields = "name, supplier_name, supplier_group"
self.party_map = dict(((r.name, r) for r in frappe.db.sql("select {0} from `tab{1}`"
.format(select_fields, party_type), as_dict=True)))

View File

@ -35,7 +35,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
_("Customer Group") + ":Link/Customer Group:120"
]
if args.get("party_type") == "Supplier":
columns += [_("Supplier Type") + ":Link/Supplier Type:80"]
columns += [_("Supplier Group") + ":Link/Supplier Group:80"]
columns.append({
"fieldname": "currency",
@ -66,7 +66,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
if args.get("party_type") == "Customer":
row += [self.get_territory(party), self.get_customer_group(party)]
if args.get("party_type") == "Supplier":
row += [self.get_supplier_type(party)]
row += [self.get_supplier_group(party)]
row.append(party_dict.currency)
data.append(row)
@ -113,7 +113,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
"outstanding_amt", "age", "range1", "range2", "range3", "range4", "currency"]
if args.get("party_type") == "Supplier":
cols += ["supplier_type", "remarks"]
cols += ["supplier_group", "remarks"]
if args.get("party_type") == "Customer":
cols += ["territory", "customer_group", "remarks"]

View File

@ -42,7 +42,7 @@ def _execute(filters=None, additional_table_columns=None, additional_query_colum
row.append(inv.get(col))
row += [
supplier_details.get(inv.supplier), # supplier_type
supplier_details.get(inv.supplier), # supplier_group
inv.tax_id, inv.credit_to, inv.mode_of_payment, ", ".join(project),
inv.bill_no, inv.bill_date, inv.remarks,
", ".join(purchase_order), ", ".join(purchase_receipt), company_currency
@ -83,7 +83,7 @@ def get_columns(invoice_list, additional_table_columns):
columns += additional_table_columns
columns += [
_("Supplier Type") + ":Link/Supplier Type:120", _("Tax Id") + "::80", _("Payable Account") + ":Link/Account:120",
_("Supplier Group") + ":Link/Supplier Group:120", _("Tax Id") + "::80", _("Payable Account") + ":Link/Account:120",
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
_("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
_("Purchase Order") + ":Link/Purchase Order:100",
@ -229,8 +229,8 @@ def get_account_details(invoice_list):
def get_supplier_details(suppliers):
supplier_details = {}
for supp in frappe.db.sql("""select name, supplier_type from `tabSupplier`
for supp in frappe.db.sql("""select name, supplier_group from `tabSupplier`
where name in (%s)""" % ", ".join(["%s"]*len(suppliers)), tuple(suppliers), as_dict=1):
supplier_details.setdefault(supp.name, supp.supplier_type)
supplier_details.setdefault(supp.name, supp.supplier_group)
return supplier_details

View File

@ -1,188 +1,263 @@
{
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"beta": 0,
"creation": "2013-06-25 11:04:03",
"custom": 0,
"description": "Settings for Buying Module",
"docstatus": 0,
"doctype": "DocType",
"document_type": "Other",
"editable_grid": 0,
"fields": [
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "Supplier Name",
"fieldname": "supp_master_name",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier Naming By",
"length": 0,
"no_copy": 0,
"options": "Supplier Name\nNaming Series",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "supplier_type",
"columns": 0,
"fieldname": "supplier_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"label": "Default Supplier Type",
"in_standard_filter": 0,
"label": "Default Supplier Group",
"length": 0,
"no_copy": 0,
"options": "Supplier Type",
"options": "Supplier Group",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "buying_price_list",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Buying Price List",
"length": 0,
"no_copy": 0,
"options": "Price List",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "po_required",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Purchase Order Required",
"length": 0,
"no_copy": 0,
"options": "No\nYes",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "pr_required",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Purchase Receipt Required",
"length": 0,
"no_copy": 0,
"options": "No\nYes",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "maintain_same_rate",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Maintain same rate throughout purchase cycle",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "allow_multiple_items",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow Item to be added multiple times in a transaction",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -213,19 +288,22 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
"has_web_view": 0,
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "fa fa-cog",
"idx": 1,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"modified": "2017-12-27 15:20:06.052342",
"max_attachments": 0,
"modified": "2018-04-19 07:56:42.888821",
"modified_by": "Administrator",
"module": "Buying",
"name": "Buying Settings",
@ -233,7 +311,6 @@
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
@ -252,6 +329,10 @@
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0
"read_only_onload": 0,
"show_name_in_global_search": 0,
"track_changes": 0,
"track_seen": 0
}

View File

@ -10,7 +10,7 @@ from frappe.model.document import Document
class BuyingSettings(Document):
def validate(self):
for key in ["supplier_type", "supp_master_name", "maintain_same_rate", "buying_price_list"]:
for key in ["supplier_group", "supp_master_name", "maintain_same_rate", "buying_price_list"]:
frappe.db.set_default(key, self.get(key, ""))
from erpnext.setup.doctype.naming_series.naming_series import set_by_naming_series

View File

@ -61,11 +61,11 @@ frappe.ui.form.on("Request for Quotation",{
fields: [
{ "fieldtype": "Select", "label": __("Get Suppliers By"),
"fieldname": "search_type",
"options": "Tag\nSupplier Type", "reqd": 1 },
{ "fieldtype": "Link", "label": __("Supplier Type"),
"fieldname": "supplier_type",
"options": "Supplier Type", "reqd": 0,
"depends_on": "eval:doc.search_type == 'Supplier Type'"},
"options": "Tag\nSupplier Group", "reqd": 1 },
{ "fieldtype": "Link", "label": __("Supplier Group"),
"fieldname": "supplier_group",
"options": "Supplier Group", "reqd": 0,
"depends_on": "eval:doc.search_type == 'Supplier Group'"},
{ "fieldtype": "Data", "label": __("Tag"),
"fieldname": "tag", "reqd": 0,
"depends_on": "eval:doc.search_type == 'Tag'" },
@ -121,14 +121,14 @@ frappe.ui.form.on("Request for Quotation",{
},
callback: load_suppliers
});
} else if (args.supplier_type) {
} else if (args.supplier_group) {
return frappe.call({
method: "frappe.client.get_list",
args: {
doctype: "Supplier",
order_by: "name",
fields: ["name"],
filters: [["Supplier", "supplier_type", "=", args.supplier_type]]
filters: [["Supplier", "supplier_group_name", "=", args.supplier_group]]
},
callback: load_suppliers

View File

@ -56,7 +56,7 @@ class TestRequestforQuotation(unittest.TestCase):
frappe.delete_doc_if_exists("Supplier", "_Test Supplier '1", force=1)
supplier = frappe.new_doc("Supplier")
supplier.supplier_name = "_Test Supplier '1"
supplier.supplier_type = "_Test Supplier Type"
supplier.supplier_group = "_Test Supplier Group"
supplier.insert()
rfq = make_request_for_quotation(supplier_wt_appos)

View File

@ -43,7 +43,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -76,7 +76,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 1,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -108,7 +108,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -140,7 +140,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -171,7 +171,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -267,7 +267,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -296,7 +296,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0,
"width": "50%"
},
@ -306,7 +306,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "supplier_type",
"fieldname": "supplier_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
@ -315,12 +315,12 @@
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Supplier Type",
"label": "Supplier Group",
"length": 0,
"no_copy": 0,
"oldfieldname": "supplier_type",
"oldfieldtype": "Link",
"options": "Supplier Type",
"options": "Supplier Group",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@ -330,7 +330,7 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -362,7 +362,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -394,7 +394,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -425,7 +425,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -456,7 +456,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -487,7 +487,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -518,7 +518,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -614,7 +614,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -645,7 +645,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -675,7 +675,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -706,7 +706,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -737,7 +737,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -770,7 +770,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -803,7 +803,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -833,7 +833,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -862,7 +862,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0,
"width": "50%"
},
@ -893,7 +893,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -924,7 +924,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -957,7 +957,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -988,7 +988,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0,
"width": "50%"
},
@ -1021,7 +1021,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"translatable": 0,
"unique": 0
},
{
@ -1163,7 +1163,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2018-04-19 12:19:52.519026",
"modified": "2018-05-11 12:19:52.519026",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier",
@ -1307,7 +1307,7 @@
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "supplier_name, supplier_type",
"search_fields": "supplier_name, supplier_group",
"show_name_in_global_search": 1,
"sort_order": "ASC",
"title_field": "supplier_name",

View File

@ -1,3 +1,3 @@
frappe.listview_settings['Supplier'] = {
add_fields: ["supplier_name", "supplier_type", "image"],
add_fields: ["supplier_name", "supplier_group", "image"],
};

View File

@ -2,39 +2,39 @@
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier With Template 1",
"supplier_type": "_Test Supplier Type",
"supplier_group": "_Test Supplier Group",
"payment_terms": "_Test Payment Term Template 3"
},
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier P",
"supplier_type": "_Test Supplier Type"
"supplier_group": "_Test Supplier Group"
},
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier with Country",
"supplier_type": "_Test Supplier Type",
"supplier_group": "_Test Supplier Group",
"country": "Greece"
},
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier",
"supplier_type": "_Test Supplier Type"
"supplier_group": "_Test Supplier Group"
},
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier 1",
"supplier_type": "_Test Supplier Type"
"supplier_group": "_Test Supplier Group"
},
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier 2",
"supplier_type": "_Test Supplier Type"
"supplier_group": "_Test Supplier Group"
},
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier USD",
"supplier_type": "_Test Supplier Type",
"supplier_group": "_Test Supplier Group",
"accounts": [{
"company": "_Test Company",
"account": "_Test Payable USD - _TC"

View File

@ -7,7 +7,7 @@ QUnit.test("test: supplier", function(assert) {
() => {
return frappe.tests.make('Supplier', [
{supplier_name: 'Test Supplier'},
{supplier_type: 'Hardware'},
{supplier_group: 'Hardware'},
{country: 'India'},
{default_currency: 'INR'},
{accounts: [
@ -66,7 +66,7 @@ QUnit.test("test: supplier", function(assert) {
() => {
assert.ok(cur_frm.doc.supplier_name == 'Test Supplier', "Name correct");
assert.ok(cur_frm.doc.supplier_type == 'Hardware', "Type correct");
assert.ok(cur_frm.doc.supplier_group == 'Hardware', "Type correct");
assert.ok(cur_frm.doc.default_currency == 'INR', "Currency correct");
assert.ok(cur_frm.doc.accounts[0].account == 'Creditors - '+frappe.get_abbr('For Testing'), " Account Head abbr correct");
assert.ok($('.address-box:nth-child(3) p').text().includes('Shipping City 3'), "Address correct");

View File

@ -36,14 +36,14 @@ class TestSupplier(unittest.TestCase):
frappe.db.set_value("Supplier", "_Test Supplier With Template 1", "payment_terms", "")
# Set credit limit for the supplier type instead of supplier and evaluate the due date
frappe.db.set_value("Supplier Type", "_Test Supplier Type", "payment_terms", "_Test Payment Term Template 3")
# Set credit limit for the supplier group instead of supplier and evaluate the due date
frappe.db.set_value("Supplier Group", "_Test Supplier Group", "payment_terms", "_Test Payment Term Template 3")
due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier With Template 1")
self.assertEqual(due_date, "2016-02-21")
# Payment terms for Supplier Type instead of supplier and evaluate the due date
frappe.db.set_value("Supplier Type", "_Test Supplier Type", "payment_terms", "_Test Payment Term Template 1")
# Payment terms for Supplier Group instead of supplier and evaluate the due date
frappe.db.set_value("Supplier Group", "_Test Supplier Group", "payment_terms", "_Test Payment Term Template 1")
# Leap year
due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier With Template 1")
@ -53,7 +53,7 @@ class TestSupplier(unittest.TestCase):
self.assertEqual(due_date, "2017-02-28")
# Supplier with no default Payment Terms Template
frappe.db.set_value("Supplier Type", "_Test Supplier Type", "payment_terms", "")
frappe.db.set_value("Supplier Group", "_Test Supplier Group", "payment_terms", "")
frappe.db.set_value("Supplier", "_Test Supplier", "payment_terms", "")
due_date = get_due_date("2016-01-22", "Supplier", "_Test Supplier")

View File

@ -19,7 +19,7 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
title: __("Purchase Analytics"),
parent: $(wrapper).find('.layout-main'),
page: wrapper.page,
doctypes: ["Item", "Item Group", "Supplier", "Supplier Type", "Company", "Fiscal Year",
doctypes: ["Item", "Item Group", "Supplier", "Supplier Group", "Company", "Fiscal Year",
"Purchase Invoice", "Purchase Invoice Item",
"Purchase Order", "Purchase Order Item[Purchase Analytics]",
"Purchase Receipt", "Purchase Receipt Item[Purchase Analytics]"],
@ -27,11 +27,11 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
});
this.tree_grids = {
"Supplier Type": {
label: __("Supplier Type / Supplier"),
"Supplier Group": {
label: __("Supplier Group / Supplier"),
show: true,
item_key: "supplier",
parent_field: "parent_supplier_type",
parent_field: "parent_supplier_group",
formatter: function(item) {
return item.supplier_name ? item.supplier_name + " (" + item.name + ")" : item.name;
}
@ -77,7 +77,7 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
},
filters: [
{fieldtype:"Select", label: __("Tree Type"), fieldname: "tree_type",
options:["Supplier Type", "Supplier", "Item Group", "Item"],
options:["Supplier Group", "Supplier", "Item Group", "Item"],
filter: function(val, item, opts, me) {
return me.apply_zero_filter(val, item, opts, me);
}},
@ -110,22 +110,10 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
var me = this;
if (!this.tl) {
// add 'Not Set' Supplier & Item
// Add 'All Supplier Types' Supplier Type
// (Supplier / Item are not mandatory!!)
// Set parent supplier type for tree view
$.each(frappe.report_dump.data["Supplier Type"], function(i, v) {
v['parent_supplier_type'] = __("All Supplier Types")
})
frappe.report_dump.data["Supplier Type"] = [{
name: __("All Supplier Types"),
id: "All Supplier Types",
}].concat(frappe.report_dump.data["Supplier Type"]);
frappe.report_dump.data["Supplier"].push({
name: __("Not Set"),
parent_supplier_type: __("All Supplier Types"),
parent_supplier_group: __("All Supplier Groups"),
id: "Not Set",
});
@ -142,14 +130,15 @@ erpnext.PurchaseAnalytics = frappe.views.TreeGridReport.extend({
if(!this.data || me.item_type != me.tree_type) {
var items;
if(me.tree_type=='Supplier') {
var items = frappe.report_dump.data["Supplier"];
} if(me.tree_type=='Supplier Type') {
var items = this.prepare_tree("Supplier", "Supplier Type");
items = frappe.report_dump.data["Supplier"];
} else if(me.tree_type=='Supplier Group') {
items = this.prepare_tree("Supplier", "Supplier Group");
} else if(me.tree_type=="Item Group") {
var items = this.prepare_tree("Item", "Item Group");
items = this.prepare_tree("Item", "Item Group");
} else if(me.tree_type=="Item") {
var items = frappe.report_dump.data["Item"];
items = frappe.report_dump.data["Item"];
}
me.item_type = me.tree_type

View File

@ -39,8 +39,8 @@ def get_data():
},
{
"type": "doctype",
"name": "Supplier Type",
"description": _("Supplier Type master.")
"name": "Supplier Group",
"description": _("Supplier Group master.")
},
{
"type": "doctype",

View File

@ -102,9 +102,9 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters):
def supplier_query(doctype, txt, searchfield, start, page_len, filters):
supp_master_name = frappe.defaults.get_user_default("supp_master_name")
if supp_master_name == "Supplier Name":
fields = ["name", "supplier_type"]
fields = ["name", "supplier_group"]
else:
fields = ["name", "supplier_name", "supplier_type"]
fields = ["name", "supplier_name", "supplier_group"]
fields = ", ".join(fields)
return frappe.db.sql("""select {field} from `tabSupplier`

View File

@ -235,16 +235,16 @@ def based_wise_columns_query(based_on, trans):
based_on_details["addl_tables"] = ''
elif based_on == 'Supplier':
based_on_details["based_on_cols"] = ["Supplier:Link/Supplier:120", "Supplier Type:Link/Supplier Type:140"]
based_on_details["based_on_select"] = "t1.supplier, t3.supplier_type,"
based_on_details["based_on_cols"] = ["Supplier:Link/Supplier:120", "Supplier Group:Link/Supplier Group:140"]
based_on_details["based_on_select"] = "t1.supplier, t3.supplier_group,"
based_on_details["based_on_group_by"] = 't1.supplier'
based_on_details["addl_tables"] = ',`tabSupplier` t3'
based_on_details["addl_tables_relational_cond"] = " and t1.supplier = t3.name"
elif based_on == 'Supplier Type':
based_on_details["based_on_cols"] = ["Supplier Type:Link/Supplier Type:140"]
based_on_details["based_on_select"] = "t3.supplier_type,"
based_on_details["based_on_group_by"] = 't3.supplier_type'
elif based_on == 'Supplier Group':
based_on_details["based_on_cols"] = ["Supplier Group:Link/Supplier Group:140"]
based_on_details["based_on_select"] = "t3.supplier_group,"
based_on_details["based_on_group_by"] = 't3.supplier_group'
based_on_details["addl_tables"] = ',`tabSupplier` t3'
based_on_details["addl_tables_relational_cond"] = " and t1.supplier = t3.name"

View File

@ -275,7 +275,7 @@ def setup_supplier():
frappe.get_doc({
"doctype": "Supplier",
"supplier_name": s,
"supplier_type": random.choice(["Services", "Raw Material"]),
"supplier_group": random.choice(["Services", "Raw Material"]),
}).insert()
def setup_warehouse():

View File

@ -187,7 +187,7 @@ def make_supplier(supplier):
supplier_doc = frappe.get_doc({
'doctype': 'Supplier',
'supplier_name': supplier.supplier_name,
'supplier_type': supplier.supplier_type,
'supplier_group': supplier.supplier_group,
'supplier_email': supplier.supplier_email
}).insert()
else:

View File

@ -527,6 +527,7 @@ erpnext.patches.v11_0.rename_field_max_days_allowed
erpnext.patches.v11_0.create_salary_structure_assignments
erpnext.patches.v11_0.rename_health_insurance
erpnext.patches.v11_0.rebuild_tree_for_company
erpnext.patches.v11_0.rename_supplier_type_to_supplier_group
erpnext.patches.v11_0.create_department_records_for_each_company
erpnext.patches.v11_0.make_location_from_warehouse
erpnext.patches.v11_0.make_asset_finance_book_against_old_entries
erpnext.patches.v11_0.make_asset_finance_book_against_old_entries

View File

@ -0,0 +1,34 @@
import frappe
from frappe.model.rename_doc import rename_doc
from frappe.model.utils.rename_field import rename_field
from frappe import _
from frappe.utils.nestedset import rebuild_tree
def execute():
if frappe.db.table_exists("Supplier Type") and not frappe.db.table_exists("Supplier Group"):
rename_doc("DocType", "Supplier Type", "Supplier Group", force=True)
frappe.reload_doc('setup', 'doctype', 'supplier_group')
frappe.reload_doc("accounts", "doctype", "pricing_rule")
frappe.reload_doc("accounts", "doctype", "tax_rule")
frappe.reload_doc("buying", "doctype", "buying_settings")
frappe.reload_doc("buying", "doctype", "supplier")
rename_field("Supplier Group", "supplier_type", "supplier_group_name")
rename_field("Supplier", "supplier_type", "supplier_group")
rename_field("Buying Settings", "supplier_type", "supplier_group")
rename_field("Pricing Rule", "supplier_type", "supplier_group")
rename_field("Tax Rule", "supplier_type", "supplier_group")
build_tree()
def build_tree():
frappe.db.sql("""update `tabSupplier Group` set parent_supplier_group = '{0}'
where is_group = 0""".format(_('All Supplier Groups')))
if not frappe.db.exists("Supplier Group", _('All Supplier Groups')):
frappe.get_doc({
'doctype': 'Supplier Group',
'supplier_group_name': _('All Supplier Groups'),
'is_group': 1
}).insert(ignore_permissions=True)
rebuild_tree("Supplier Group", "parent_supplier_group")

View File

@ -49,7 +49,7 @@ $.extend(frappe.create_routes, {
$.extend(frappe.breadcrumbs.preferred, {
"Item Group": "Stock",
"Customer Group": "Selling",
"Supplier Type": "Buying",
"Supplier Group": "Buying",
"Territory": "Selling",
"Sales Person": "Selling",
"Sales Partner": "Selling",

View File

@ -980,7 +980,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
"customer_group": me.frm.doc.customer_group,
"territory": me.frm.doc.territory,
"supplier": me.frm.doc.supplier,
"supplier_type": me.frm.doc.supplier_type,
"supplier_group": me.frm.doc.supplier_group,
"currency": me.frm.doc.currency,
"conversion_rate": me.frm.doc.conversion_rate,
"price_list": me.frm.doc.selling_price_list || me.frm.doc.buying_price_list,

View File

@ -444,8 +444,8 @@ erpnext.hub.ItemPage = class ItemPage extends erpnext.hub.HubDetailsPage {
{ label: __('Supplier Name'), fieldtype: 'Data', fieldname: 'supplier_name', default: item.company_name },
{ label: __('Supplier Email'), fieldtype: 'Data', fieldname: 'supplier_email', default: item.seller },
{ fieldtype: 'Column Break' },
{ label: __('Supplier Type'), fieldname: 'supplier_type',
fieldtype: 'Link', options: 'Supplier Type' }
{ label: __('Supplier Group'), fieldname: 'supplier_group',
fieldtype: 'Link', options: 'Supplier Group' }
];
fields = fields.map(f => { f.reqd = 1; return f; });

View File

@ -23,7 +23,7 @@ erpnext.get_purchase_trends_filters = function() {
{ "value": "Item", "label": __("Item") },
{ "value": "Item Group", "label": __("Item Group") },
{ "value": "Supplier", "label": __("Supplier") },
{ "value": "Supplier Type", "label": __("Supplier Type") },
{ "value": "Supplier Group", "label": __("Supplier Group") },
{ "value": "Project", "label": __("Project") }
],
"default": "Item"

View File

@ -755,9 +755,9 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc=
def get_supplier(doctype, txt, searchfield, start, page_len, filters):
supp_master_name = frappe.defaults.get_user_default("supp_master_name")
if supp_master_name == "Supplier Name":
fields = ["name", "supplier_type"]
fields = ["name", "supplier_group"]
else:
fields = ["name", "supplier_name", "supplier_type"]
fields = ["name", "supplier_name", "supplier_group"]
fields = ", ".join(fields)
return frappe.db.sql("""select {field} from `tabSupplier`

View File

@ -0,0 +1,37 @@
// Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
cur_frm.cscript.refresh = function(doc) {
cur_frm.set_intro(doc.__islocal ? "" : __("There is nothing to edit."));
cur_frm.cscript.set_root_readonly(doc);
};
cur_frm.cscript.set_root_readonly = function(doc) {
// read-only for root customer group
if(!doc.parent_supplier_group) {
cur_frm.set_read_only();
cur_frm.set_intro(__("This is a root supplier group and cannot be edited."));
} else {
cur_frm.set_intro(null);
}
};
// get query select Customer Group
cur_frm.fields_dict['parent_supplier_group'].get_query = function() {
return {
filters: {
'is_group': 1
}
};
};
cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
filters: {
'account_type': 'Payable',
'company': d.company,
"is_group": 0
}
};
};

View File

@ -3,7 +3,7 @@
"allow_guest_to_view": 0,
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:supplier_type",
"autoname": "field:supplier_group_name",
"beta": 0,
"creation": "2013-01-10 16:34:24",
"custom": 0,
@ -18,16 +18,16 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "supplier_type",
"fieldname": "supplier_group_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier Type",
"label": "Supplier Group Name",
"length": 0,
"no_copy": 0,
"oldfieldname": "supplier_type",
@ -41,8 +41,72 @@
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "parent_supplier_group",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Parent Supplier Group",
"length": 0,
"no_copy": 0,
"options": "Supplier Group",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"fieldname": "is_group",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Is Group",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
@ -71,6 +135,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -102,6 +167,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -131,6 +197,7 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
@ -163,6 +230,101 @@
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "lft",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "lft",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "rgt",
"fieldtype": "Int",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "rgt",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "old_parent",
"fieldtype": "Link",
"hidden": 1,
"ignore_user_permissions": 1,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Old Parent",
"length": 0,
"no_copy": 1,
"options": "Supplier Group",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 1,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
}
],
@ -177,15 +339,14 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-09-04 18:54:10.093500",
"modified": "2018-04-20 00:54:48.724120",
"modified_by": "Administrator",
"module": "Setup",
"name": "Supplier Type",
"name": "Supplier Group",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
@ -205,7 +366,6 @@
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
@ -225,7 +385,6 @@
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
@ -245,7 +404,6 @@
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
@ -265,7 +423,6 @@
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,
@ -285,7 +442,6 @@
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 0,
"delete": 0,

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils.nestedset import NestedSet
class SupplierGroup(NestedSet):
nsm_parent_field = 'parent_supplier_group';
def update_nsm_model(self):
frappe.utils.nestedset.update_nsm(self)
def on_update(self):
self.update_nsm_model()
self.validate_one_root()
def on_trash(self):
self.update_nsm_model()

View File

@ -0,0 +1,3 @@
frappe.treeview_settings["Supplier Group"] = {
ignore_fields:["parent_supplier_group"]
};

View File

@ -0,0 +1,7 @@
[
{
"doctype": "Supplier Group",
"supplier_group_name": "_Test Supplier Group"
}
]

View File

@ -2,15 +2,15 @@
// rename this file from _test_[name] to test_[name] to activate
// and remove above this line
QUnit.test("test: Supplier Type", function (assert) {
QUnit.test("test: Supplier Group", function (assert) {
let done = assert.async();
// number of asserts
assert.expect(1);
frappe.run_serially([
// insert a new Supplier Type
() => frappe.tests.make('Supplier Type', [
// insert a new Supplier Group
() => frappe.tests.make('Supplier Group', [
// values to be set
{key: 'value'}
]),

View File

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
test_records = frappe.get_test_records('Supplier Group')

View File

@ -1 +0,0 @@
Supplier classification.

View File

@ -1,17 +0,0 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
cur_frm.cscript.refresh = function(doc) {
cur_frm.set_intro(doc.__islocal ? "" : __("There is nothing to edit."))
}
cur_frm.fields_dict['accounts'].grid.get_field('account').get_query = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
return {
filters: {
'account_type': 'Payable',
'company': d.company,
"is_group": 0
}
}
}

View File

@ -1,10 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class SupplierType(Document):
pass

View File

@ -1,6 +0,0 @@
[
{
"doctype": "Supplier Type",
"supplier_type": "_Test Supplier Type"
}
]

View File

@ -1,7 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
test_records = frappe.get_test_records('Supplier Type')

View File

@ -147,14 +147,15 @@ def install(country=None):
{'doctype': 'Customer Group', 'customer_group_name': _('Non Profit'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
{'doctype': 'Customer Group', 'customer_group_name': _('Government'), 'is_group': 0, 'parent_customer_group': _('All Customer Groups')},
# supplier type
{'doctype': 'Supplier Type', 'supplier_type': _('Services')},
{'doctype': 'Supplier Type', 'supplier_type': _('Local')},
{'doctype': 'Supplier Type', 'supplier_type': _('Raw Material')},
{'doctype': 'Supplier Type', 'supplier_type': _('Electrical')},
{'doctype': 'Supplier Type', 'supplier_type': _('Hardware')},
{'doctype': 'Supplier Type', 'supplier_type': _('Pharmaceutical')},
{'doctype': 'Supplier Type', 'supplier_type': _('Distributor')},
# supplier group
{'doctype': 'Supplier Group', 'supplier_group_name': _('All Supplier Groups'), 'is_group': 1, 'name': _('All Supplier Groups'), 'parent_supplier_group': ''},
{'doctype': 'Supplier Group', 'supplier_group_name': _('Services'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
{'doctype': 'Supplier Group', 'supplier_group_name': _('Local'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
{'doctype': 'Supplier Group', 'supplier_group_name': _('Raw Material'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
{'doctype': 'Supplier Group', 'supplier_group_name': _('Electrical'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
{'doctype': 'Supplier Group', 'supplier_group_name': _('Hardware'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
{'doctype': 'Supplier Group', 'supplier_group_name': _('Pharmaceutical'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
{'doctype': 'Supplier Group', 'supplier_group_name': _('Distributor'), 'is_group': 0, 'parent_supplier_group': _('All Supplier Groups')},
# Sales Person
{'doctype': 'Sales Person', 'sales_person_name': _('Sales Team'), 'is_group': 1, "parent_sales_person": ""},

View File

@ -208,15 +208,15 @@ data_map = {
},
"Supplier": {
"columns": ["name", "if(supplier_name=name, '', supplier_name) as supplier_name",
"supplier_type as parent_supplier_type"],
"supplier_group as parent_supplier_group"],
"conditions": ["docstatus < 2"],
"order_by": "name",
"links": {
"parent_supplier_type": ["Supplier Type", "name"],
"parent_supplier_group": ["Supplier Group", "name"],
}
},
"Supplier Type": {
"columns": ["name"],
"Supplier Group": {
"columns": ["name", "parent_supplier_group"],
"conditions": ["docstatus < 2"],
"order_by": "name"
},

View File

@ -34,7 +34,7 @@ frappe.ui.form.on("Delivery Note", {
frm.set_query('transporter_name', function(doc) {
return {
filters: { 'supplier_type': "transporter" }
filters: { 'supplier_group': "transporter" }
}
});

View File

@ -63,7 +63,7 @@ def create_suppliers(args_data):
doc = frappe.get_doc({
"doctype":"Supplier",
"supplier_name": supplier,
"supplier_type": _("Local"),
"supplier_group": _("Local"),
"company": defaults.get("company")
}).insert()