[fixed conflict]

This commit is contained in:
Nabin Hait
2013-07-05 10:26:29 +05:30
45 changed files with 1389 additions and 505 deletions

View File

@@ -251,7 +251,7 @@ class DocType(SellingController):
# fetch charges
if self.doc.charge and not len(self.doclist.get({"parentfield": "other_charges"})):
self.set_taxes()
self.set_taxes("other_charges", "charge")
def get_customer_account(self):
"""Get Account Head to which amount needs to be Debited based on Customer"""

View File

@@ -16,12 +16,10 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
from webnotes.model.controller import DocListController
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
class DocType(DocListController):
def get_rate(self, arg):
from webnotes.model.code import get_obj
return get_obj('Sales Common').get_rate(arg)
@@ -30,4 +28,12 @@ class DocType:
if self.doc.is_default == 1:
webnotes.conn.sql("""update `tabSales Taxes and Charges Master` set is_default = 0
where ifnull(is_default,0) = 1 and name != %s and company = %s""",
(self.doc.name, self.doc.company))
(self.doc.name, self.doc.company))
# at least one territory
self.validate_table_has_rows("valid_for_territories")
def on_update(self):
cart_settings = webnotes.get_obj("Shopping Cart Settings")
if cint(cart_settings.doc.enabled):
cart_settings.validate_tax_masters()

View File

@@ -0,0 +1,146 @@
test_records = [
[
{
"doctype": "Sales Taxes and Charges Master",
"title": "_Test Sales Taxes and Charges Master",
"company": "_Test Company"
},
{
"account_head": "_Test Account VAT - _TC",
"charge_type": "On Net Total",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"rate": 6,
},
{
"account_head": "_Test Account Service Tax - _TC",
"charge_type": "On Net Total",
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"rate": 6.36,
},
{
"doctype": "For Territory",
"parentfield": "valid_for_territories",
"territory": "All Territories"
}
],
[
{
"doctype": "Sales Taxes and Charges Master",
"title": "_Test India Tax Master",
"company": "_Test Company"
},
{
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"charge_type": "Actual",
"account_head": "_Test Account Shipping Charges - _TC",
"cost_center": "_Test Cost Center - _TC",
"description": "Shipping Charges",
"rate": 100
},
{
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"charge_type": "On Net Total",
"account_head": "_Test Account Customs Duty - _TC",
"cost_center": "_Test Cost Center - _TC",
"description": "Customs Duty",
"rate": 10
},
{
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"charge_type": "On Net Total",
"account_head": "_Test Account Excise Duty - _TC",
"cost_center": "_Test Cost Center - _TC",
"description": "Excise Duty",
"rate": 12
},
{
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"charge_type": "On Previous Row Amount",
"account_head": "_Test Account Education Cess - _TC",
"cost_center": "_Test Cost Center - _TC",
"description": "Education Cess",
"rate": 2,
"row_id": 3
},
{
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"charge_type": "On Previous Row Amount",
"account_head": "_Test Account S&H Education Cess - _TC",
"cost_center": "_Test Cost Center - _TC",
"description": "S&H Education Cess",
"rate": 1,
"row_id": 3
},
{
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"charge_type": "On Previous Row Total",
"account_head": "_Test Account CST - _TC",
"cost_center": "_Test Cost Center - _TC",
"description": "CST",
"rate": 2,
"row_id": 5
},
{
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"charge_type": "On Net Total",
"account_head": "_Test Account VAT - _TC",
"cost_center": "_Test Cost Center - _TC",
"description": "VAT",
"rate": 12.5
},
{
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"charge_type": "On Previous Row Total",
"account_head": "_Test Account Discount - _TC",
"cost_center": "_Test Cost Center - _TC",
"description": "Discount",
"rate": -10,
"row_id": 7
},
{
"doctype": "For Territory",
"parentfield": "valid_for_territories",
"territory": "_Test Territory India"
}
],
[
{
"doctype": "Sales Taxes and Charges Master",
"title": "_Test Sales Taxes and Charges Master 2",
"company": "_Test Company"
},
{
"account_head": "_Test Account VAT - _TC",
"charge_type": "On Net Total",
"description": "VAT",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"rate": 12,
},
{
"account_head": "_Test Account Service Tax - _TC",
"charge_type": "On Net Total",
"description": "Service Tax",
"doctype": "Sales Taxes and Charges",
"parentfield": "other_charges",
"rate": 4,
},
{
"doctype": "For Territory",
"parentfield": "valid_for_territories",
"territory": "All Territories"
}
],
]

View File

@@ -16,6 +16,7 @@ class DocType(DocListController):
self.doc, self.doclist = d, dl
def validate(self):
self.validate_value("calculate_based_on", "in", ["Net Total", "Net Weight"])
self.shipping_rule_conditions = self.doclist.get({"parentfield": "shipping_rule_conditions"})
self.validate_from_to_values()
self.sort_shipping_rule_conditions()
@@ -57,7 +58,7 @@ class DocType(DocListController):
then condition y can only be like 50 to 99 or 301 to 400
hence, non-overlapping condition = (x1 <= x2 < y1 <= y2) or (y1 <= y2 < x1 <= x2)
"""
separate = (x1 <= x2 < y1 <= y2) or (y1 <= y2 < x1 <= x2)
separate = (x1 <= x2 <= y1 <= y2) or (y1 <= y2 <= x1 <= x2)
return (not separate)
overlaps = []

View File

@@ -2,11 +2,12 @@
{
"creation": "2013-06-25 11:48:03",
"docstatus": 0,
"modified": "2013-06-25 12:15:21",
"modified": "2013-07-04 16:28:42",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"autoname": "Prompt",
"description": "Specify conditions to calculate shipping amount",
"doctype": "DocType",
"module": "Accounts",
@@ -37,7 +38,7 @@
{
"description": "example: Next Day Shipping",
"doctype": "DocField",
"fieldname": "shipping_rule_label",
"fieldname": "label",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Shipping Rule Label",
@@ -49,14 +50,16 @@
"fieldtype": "Column Break"
},
{
"default": "Amount",
"default": "Net Total",
"doctype": "DocField",
"fieldname": "calculate_based_on",
"fieldtype": "Select",
"hidden": 1,
"in_list_view": 1,
"label": "Calculate Based On",
"options": "Amount\nNet Weight",
"reqd": 1
"options": "Net Total\nNet Weight",
"read_only": 1,
"reqd": 0
},
{
"doctype": "DocField",

View File

@@ -32,7 +32,7 @@ test_records = [
[
{
"doctype": "Shipping Rule",
"calculate_based_on": "Amount",
"calculate_based_on": "Net Total",
"company": "_Test Company",
"account": "_Test Account Shipping Charges - _TC",
"cost_center": "_Test Cost Center - _TC"

View File

@@ -106,6 +106,11 @@ wn.module_page["Accounts"] = [
"doctype":"Shipping Rule",
"description": wn._("Rules to calculate shipping amount for a sale")
},
{
"label": wn._("Currency Exchange"),
"doctype":"Currency Exchange",
"description": wn._("Manage exchange rates for currency conversion")
},
{
"label": wn._("Point-of-Sale Setting"),
"doctype":"POS Setting",