Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
573b423a6c
@ -374,16 +374,20 @@ 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", "="]],
|
||||
},
|
||||
})
|
||||
|
||||
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", "="]],
|
||||
@ -391,6 +395,7 @@ class DocType(SellingController):
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
def set_aging_date(self):
|
||||
if self.doc.is_opening != 'Yes':
|
||||
self.doc.aging_date = self.doc.posting_date
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -249,7 +249,7 @@ def make_purchase_invoice(source_name, target_doclist=None):
|
||||
def update_item(obj, target, source_parent):
|
||||
target.conversion_factor = 1
|
||||
target.import_amount = flt(obj.import_amount) - flt(obj.billed_amt)
|
||||
target.amount = target.import_amount / flt(source_parent.conversion_rate)
|
||||
target.amount = target.import_amount * flt(source_parent.conversion_rate)
|
||||
if flt(obj.purchase_rate):
|
||||
target.qty = target.amount / flt(obj.purchase_rate)
|
||||
|
||||
|
7
patches/july_2013/p01_same_sales_rate_patch.py
Normal file
7
patches/july_2013/p01_same_sales_rate_patch.py
Normal 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()
|
13
patches/july_2013/p06_same_sales_rate.py
Normal file
13
patches/july_2013/p06_same_sales_rate.py
Normal 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.get_value("Global Defaults", "maintain_same_sales_rate")
|
||||
|
||||
if same_rate or same_rate == 0:
|
||||
ss.doc.maintain_same_sales_rate = same_rate
|
||||
else:
|
||||
ss.doc.maintain_same_sales_rate = 1
|
||||
|
||||
ss.save()
|
23
patches/july_2013/p07_repost_billed_amt_in_sales_cycle.py
Normal file
23
patches/july_2013/p07_repost_billed_amt_in_sales_cycle.py
Normal file
@ -0,0 +1,23 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
def execute():
|
||||
import webnotes
|
||||
for si in webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1"""):
|
||||
webnotes.get_obj("Sales Invoice", si[0],
|
||||
with_children=1).update_qty(change_modified=False)
|
@ -255,4 +255,6 @@ 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",
|
||||
"patches.july_2013.p07_repost_billed_amt_in_sales_cycle",
|
||||
]
|
@ -412,9 +412,9 @@ def make_delivery_note(source_name, target_doclist=None):
|
||||
@webnotes.whitelist()
|
||||
def make_sales_invoice(source_name, target_doclist=None):
|
||||
def update_item(obj, target, source_parent):
|
||||
target.export_amount = flt(obj.amount) - flt(obj.billed_amt)
|
||||
target.amount = target.export_amount / flt(source_parent.conversion_rate)
|
||||
target.qty = obj.basic_rate and target.amount / flt(obj.basic_rate) or obj.qty
|
||||
target.export_amount = flt(obj.export_amount) - flt(obj.billed_amt)
|
||||
target.amount = target.export_amount * flt(source_parent.conversion_rate)
|
||||
target.qty = obj.export_rate and target.export_amount / flt(obj.export_rate) or obj.qty
|
||||
|
||||
doclist = get_mapped_doclist("Sales Order", source_name, {
|
||||
"Sales Order": {
|
||||
|
@ -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, ""))
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ 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',
|
||||
}
|
||||
|
||||
class DocType:
|
||||
|
@ -118,6 +118,9 @@ class DocType(SellingController):
|
||||
"compare_fields": [["customer", "="], ["company", "="], ["project_name", "="],
|
||||
["currency", "="]],
|
||||
},
|
||||
})
|
||||
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", "="]],
|
||||
@ -125,6 +128,7 @@ class DocType(SellingController):
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
def validate_proj_cust(self):
|
||||
"""check for does customer belong to same project as entered.."""
|
||||
if self.doc.project_name and self.doc.customer:
|
||||
@ -355,11 +359,6 @@ class DocType(SellingController):
|
||||
|
||||
@webnotes.whitelist()
|
||||
def make_sales_invoice(source_name, target_doclist=None):
|
||||
def update_item(obj, target, source_parent):
|
||||
target.export_amount = flt(obj.amount)
|
||||
target.amount = target.export_amount / flt(source_parent.conversion_rate)
|
||||
target.qty = obj.basic_rate and target.amount / flt(obj.basic_rate) or obj.qty
|
||||
|
||||
def update_accounts(source, target):
|
||||
si = webnotes.bean(target)
|
||||
si.run_method("onload_post_render")
|
||||
@ -380,7 +379,6 @@ def make_sales_invoice(source_name, target_doclist=None):
|
||||
"prevdoc_docname": "sales_order",
|
||||
"serial_no": "serial_no"
|
||||
},
|
||||
"postprocess": update_item
|
||||
},
|
||||
"Sales Taxes and Charges": {
|
||||
"doctype": "Sales Taxes and Charges",
|
||||
|
@ -352,10 +352,6 @@ def make_purchase_invoice(source_name, target_doclist=None):
|
||||
|
||||
def update_item(obj, target, source_parent):
|
||||
target.conversion_factor = 1
|
||||
target.import_amount = flt(obj.import_amount)
|
||||
target.amount = target.import_amount / flt(source_parent.conversion_rate)
|
||||
if flt(obj.purchase_rate):
|
||||
target.qty = target.amount / flt(obj.purchase_rate)
|
||||
|
||||
doclist = get_mapped_doclist("Purchase Receipt", source_name, {
|
||||
"Purchase Receipt": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user