[shipping rule] added doctypes shipping rule and shipping rule conditions
This commit is contained in:
parent
4d150e67e6
commit
bd7218979e
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:09",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-20 16:49:12",
|
||||
"modified": "2013-06-25 12:06:45",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -30,8 +30,7 @@
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 0
|
||||
"report": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
@ -101,21 +100,20 @@
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Sales User",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User"
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "System Manager",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
@ -124,6 +122,7 @@
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Sales Master Manager",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
]
|
0
accounts/doctype/shipping_rule/__init__.py
Normal file
0
accounts/doctype/shipping_rule/__init__.py
Normal file
25
accounts/doctype/shipping_rule/shipping_rule.py
Normal file
25
accounts/doctype/shipping_rule/shipping_rule.py
Normal file
@ -0,0 +1,25 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes import _, msgprint
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
def validate(self):
|
||||
self.validate_to_value_of_shipping_rule_conditions()
|
||||
self.validate_overlapping_shipping_rule_conditions()
|
||||
|
||||
|
||||
def validate_to_value_of_shipping_rule_conditions(self):
|
||||
"""check if more than two or more rows has To Value = 0"""
|
||||
shipping_rule_conditions_with_0_to_value = self.doclist.get({
|
||||
"parentfield": "shipping_rule_conditions", "to_value": ["in", [0, None]]})
|
||||
if len(shipping_rule_conditions_with_0_to_value) >= 2:
|
||||
msgprint(_('''There can only be one shipping rule with 0 or blank value for "To Value"'''),
|
||||
raise_exception=True)
|
||||
|
||||
def validate_overlapping_shipping_rule_conditions(self):
|
||||
pass
|
151
accounts/doctype/shipping_rule/shipping_rule.txt
Normal file
151
accounts/doctype/shipping_rule/shipping_rule.txt
Normal file
@ -0,0 +1,151 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-25 11:48:03",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-25 12:15:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"description": "Specify conditions to calculate shipping amount",
|
||||
"doctype": "DocType",
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Shipping Rule",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
"parent": "Shipping Rule",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Shipping Rule"
|
||||
},
|
||||
{
|
||||
"description": "example: Next Day Shipping",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "shipping_rule_label",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Shipping Rule Label",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_2",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"default": "Amount",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "calculate_based_on",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Calculate Based On",
|
||||
"options": "Amount\nNet Weight",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rule_conditions_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Shipping Rule Conditions"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "shipping_rule_conditions",
|
||||
"fieldtype": "Table",
|
||||
"label": "Shipping Rule Conditions",
|
||||
"options": "Shipping Rule Condition",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "section_break_6",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"description": "Specify a list of Territories, for which, this Shipping Rule is valid",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "valid_for_territories",
|
||||
"fieldtype": "Table",
|
||||
"label": "Valid For Territories",
|
||||
"options": "For Territory",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_8",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "Company",
|
||||
"options": "Company",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "section_break_10",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"label": "Shipping Account",
|
||||
"options": "Account",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_12",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"label": "Cost Center",
|
||||
"options": "Cost Center",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Sales User"
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Sales Master Manager",
|
||||
"write": 1
|
||||
}
|
||||
]
|
@ -0,0 +1,8 @@
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
@ -0,0 +1,50 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-06-25 11:54:50",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-25 11:58:04",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"description": "A condition for a Shipping Rule",
|
||||
"doctype": "DocType",
|
||||
"istable": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"name": "__common__",
|
||||
"parent": "Shipping Rule Condition",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
"name": "Shipping Rule Condition"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "from_value",
|
||||
"fieldtype": "Float",
|
||||
"label": "From Value",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "to_value",
|
||||
"fieldtype": "Float",
|
||||
"label": "To Value",
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "shipping_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Shipping Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"reqd": 1
|
||||
}
|
||||
]
|
@ -100,6 +100,11 @@ wn.module_page["Accounts"] = [
|
||||
"doctype":"Purchase Taxes and Charges Master",
|
||||
"description": wn._("Tax Template for Purchase")
|
||||
},
|
||||
{
|
||||
"label": wn._("Shipping Rules"),
|
||||
"doctype":"Shipping Rule",
|
||||
"description": wn._("Rules to calculate shipping amount for a sale")
|
||||
},
|
||||
{
|
||||
"label": wn._("Point-of-Sale Setting"),
|
||||
"doctype":"POS Setting",
|
||||
|
@ -63,6 +63,11 @@ wn.module_page["Selling"] = [
|
||||
description: wn._("Sales taxes template."),
|
||||
doctype:"Sales Taxes and Charges Master"
|
||||
},
|
||||
{
|
||||
label: wn._("Shipping Rules"),
|
||||
description: wn._("Rules to calculate shipping amount for a sale"),
|
||||
doctype:"Shipping Rule"
|
||||
},
|
||||
{
|
||||
label: wn._("Price List"),
|
||||
description: wn._("Mupltiple Item prices."),
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-25 11:35:09",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-20 12:53:10",
|
||||
"modified": "2013-06-25 12:05:12",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -116,13 +116,6 @@
|
||||
"label": "How to upload",
|
||||
"options": "<div class=\"well\">Use the <a href=\"#data-import-tool\">Data Import Tool</a> to upload, update Item Prices in bulk:\n<ol> \n<li>Go to Data Import Tool.\n<li>Select \"Item\"\n<li>Check on \"With Data\"\n<li>Download \"Item Price\" from Child Tables.\n<li>Update the prices required and add new rows if required.\n<li>Check on \"Overwrite\"\n<li>Upload the modified sheet.\n</div>\n"
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Sales Manager",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user