merged with slow branch

This commit is contained in:
Nabin Hait 2013-07-18 12:28:09 +05:30
commit 5b43b3dca5
10 changed files with 60 additions and 23 deletions

View File

@ -374,22 +374,27 @@ class DocType(SellingController):
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
["currency", "="]],
},
"Sales Order Item": {
"ref_dn_field": "so_detail",
"compare_fields": [["export_rate", "="]],
"is_child_table": True
},
"Delivery Note": {
"ref_dn_field": "delivery_note",
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
["currency", "="]],
},
"Delivery Note Item": {
"ref_dn_field": "dn_detail",
"compare_fields": [["export_rate", "="]],
"is_child_table": True
}
})
if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Sales Order Item": {
"ref_dn_field": "so_detail",
"compare_fields": [["export_rate", "="]],
"is_child_table": True
},
"Delivery Note Item": {
"ref_dn_field": "dn_detail",
"compare_fields": [["export_rate", "="]],
"is_child_table": True
}
})
def set_aging_date(self):
if self.doc.is_opening != 'Yes':
@ -975,4 +980,4 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
and tabAccount.company = '%(company)s'
and tabAccount.%(key)s LIKE '%(txt)s'
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})

View File

@ -54,7 +54,7 @@ def execute(filters=None):
row.append(expense_amount)
# net total
row.append(net_total)
row.append(net_total or inv.net_total)
# tax account
total_tax = 0
@ -121,7 +121,7 @@ def get_conditions(filters):
def get_invoices(filters):
conditions = get_conditions(filters)
return webnotes.conn.sql("""select name, posting_date, credit_to, supplier, supplier_name,
bill_no, bill_date, remarks, grand_total, outstanding_amount
bill_no, bill_date, remarks, net_total, grand_total, outstanding_amount
from `tabPurchase Invoice` where docstatus = 1 %s
order by posting_date desc, name desc""" % conditions, filters, as_dict=1)

View File

@ -54,7 +54,7 @@ def execute(filters=None):
row.append(income_amount)
# net total
row.append(net_total)
row.append(net_total or inv.net_total)
# tax account
total_tax = 0
@ -120,7 +120,7 @@ def get_conditions(filters):
def get_invoices(filters):
conditions = get_conditions(filters)
return webnotes.conn.sql("""select name, posting_date, debit_to, project_name, customer,
customer_name, remarks, grand_total, rounded_total, outstanding_amount
customer_name, remarks, net_total, grand_total, rounded_total, outstanding_amount
from `tabSales Invoice`
where docstatus = 1 %s order by posting_date desc, name desc""" %
conditions, filters, as_dict=1)

View File

@ -0,0 +1,7 @@
def execute():
import webnotes
webnotes.reload_doc("setup", "doctype", "global_defaults")
gd = webnotes.bean('Global Defaults')
gd.doc.maintain_same_sales_rate = 1
gd.save()

View File

@ -0,0 +1,13 @@
def execute():
import webnotes
webnotes.reload_doc("selling", "doctype", "selling_settings")
ss = webnotes.bean("Selling Settings")
same_rate = webnotes.conn.sql("""select field, value from `tabSingles`
where doctype = 'Global Defaults' and field = 'maintain_same_sales_rate'"""):
if same_rate:
ss.doc.maintain_same_sales_rate = same_rate[1]
else:
ss.doc.maintain_same_sales_rate = 1
ss.save()

View File

@ -253,4 +253,5 @@ patch_list = [
"execute:webnotes.bean('Style Settings').save() #2013-07-16",
"patches.july_2013.p04_merge_duplicate_leads",
"patches.july_2013.p05_custom_doctypes_in_list_view",
"patches.july_2013.p06_same_sales_rate",
]

View File

@ -8,5 +8,5 @@ class DocType:
self.doc, self.doclist = d, dl
def validate(self):
for key in ["cust_master_name", "customer_group", "territory"]:
for key in ["cust_master_name", "customer_group", "territory", "allow_same_sales_rate"]:
webnotes.conn.set_default(key, self.doc.fields.get(key, ""))

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-25 10:25:16",
"docstatus": 0,
"modified": "2013-07-05 14:54:47",
"modified": "2013-07-18 12:03:39",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -88,6 +88,12 @@
"label": "Delivery Note Required",
"options": "No\nYes"
},
{
"doctype": "DocField",
"fieldname": "maintain_same_sales_rate",
"fieldtype": "Check",
"label": "Maintain Same Rate Throughout Sales Cycle"
},
{
"doctype": "DocPerm"
}

View File

@ -32,7 +32,8 @@ keydict = {
'float_precision': 'float_precision',
'account_url':'account_url',
'session_expiry': 'session_expiry',
'disable_rounded_total': 'disable_rounded_total'
'disable_rounded_total': 'disable_rounded_total',
'maintain_same_sales_rate' : 'maintain_same_sales_rate',
}
class DocType:

View File

@ -118,12 +118,16 @@ class DocType(SellingController):
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
["currency", "="]],
},
"Sales Order Item": {
"ref_dn_field": "prevdoc_detail_docname",
"compare_fields": [["export_rate", "="]],
"is_child_table": True
}
})
if cint(webnotes.defaults.get_global_default('maintain_same_sales_rate')):
super(DocType, self).validate_with_previous_doc(self.tname, {
"Sales Order Item": {
"ref_dn_field": "prevdoc_detail_docname",
"compare_fields": [["export_rate", "="]],
"is_child_table": True
}
})
def validate_proj_cust(self):
"""check for does customer belong to same project as entered.."""