Merge branch 'responsive' of github.com:webnotes/erpnext into responsive
Conflicts: accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.py
This commit is contained in:
@@ -60,8 +60,8 @@ class DocType(TransactionBase):
|
||||
" delivery note details have already been pulled", raise_exception=1)
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year, self.doc.inst_date,
|
||||
'Installation Date')
|
||||
from accounts.utils import validate_fiscal_year
|
||||
validate_fiscal_year(self.doc.inst_date, self.doc.fiscal_year, "Installation Date")
|
||||
|
||||
def is_serial_no_added(self, item_code, serial_no):
|
||||
ar_required = webnotes.conn.get_value("Item", item_code, "has_serial_no")
|
||||
|
||||
@@ -99,7 +99,7 @@ class DocType(SellingController):
|
||||
|
||||
@webnotes.whitelist()
|
||||
def make_customer(source_name, target_doclist=None):
|
||||
_make_customer(source_name, target_doclist)
|
||||
return _make_customer(source_name, target_doclist)
|
||||
|
||||
def _make_customer(source_name, target_doclist=None, ignore_permissions=False):
|
||||
from webnotes.model.mapper import get_mapped_doclist
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, cstr, getdate, cint
|
||||
from webnotes.utils import cstr, getdate, cint
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes import msgprint
|
||||
|
||||
@@ -129,14 +129,6 @@ class DocType(TransactionBase):
|
||||
msgprint("Please select items for which enquiry needs to be made")
|
||||
raise Exception
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
|
||||
ysd=fy and fy[0][0] or ""
|
||||
yed=add_days(str(ysd),365)
|
||||
if str(self.doc.transaction_date) < str(ysd) or str(self.doc.transaction_date) > str(yed):
|
||||
msgprint("Opportunity Date is not within the Fiscal Year selected")
|
||||
raise Exception
|
||||
|
||||
def validate_lead_cust(self):
|
||||
if self.doc.enquiry_from == 'Lead' and not self.doc.lead:
|
||||
msgprint("Lead Id is mandatory if 'Opportunity From' is selected as Lead", raise_exception=1)
|
||||
@@ -144,11 +136,13 @@ class DocType(TransactionBase):
|
||||
msgprint("Customer is mandatory if 'Opportunity From' is selected as Customer", raise_exception=1)
|
||||
|
||||
def validate(self):
|
||||
self.validate_fiscal_year()
|
||||
self.set_last_contact_date()
|
||||
self.validate_item_details()
|
||||
self.validate_lead_cust()
|
||||
|
||||
from accounts.utils import validate_fiscal_year
|
||||
validate_fiscal_year(self.doc.transaction_date, self.doc.fiscal_year, "Opportunity Date")
|
||||
|
||||
if not self.doc.status:
|
||||
self.doc.status = "Draft"
|
||||
|
||||
|
||||
@@ -75,11 +75,6 @@ class DocType(SellingController):
|
||||
def get_rate(self,arg):
|
||||
return get_obj('Sales Common').get_rate(arg)
|
||||
|
||||
# Fiscal Year Validation
|
||||
# ----------------------
|
||||
def validate_fiscal_year(self):
|
||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Quotation Date')
|
||||
|
||||
# Does not allow same item code to be entered twice
|
||||
# -------------------------------------------------
|
||||
def validate_for_items(self):
|
||||
@@ -137,7 +132,6 @@ class DocType(SellingController):
|
||||
utilities.validate_status(self.doc.status, ["Draft", "Submitted",
|
||||
"Order Confirmed", "Order Lost", "Cancelled"])
|
||||
|
||||
self.validate_fiscal_year()
|
||||
self.set_last_contact_date()
|
||||
self.validate_order_type()
|
||||
self.validate_for_items()
|
||||
@@ -245,10 +239,6 @@ def _make_sales_order(source_name, target_doclist=None, ignore_permissions=False
|
||||
doclist = get_mapped_doclist("Quotation", source_name, {
|
||||
"Quotation": {
|
||||
"doctype": "Sales Order",
|
||||
"field_map": {
|
||||
"name": "quotation_no",
|
||||
"transaction_date": "quotation_date"
|
||||
},
|
||||
"validation": {
|
||||
"docstatus": ["=", 1]
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cint, cstr, flt, getdate, nowdate
|
||||
from webnotes.utils import cint, cstr, flt
|
||||
from webnotes.model.doc import addchild
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
@@ -30,26 +30,9 @@ from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
def __init__(self,d,dl):
|
||||
self.doc, self.doclist = d,dl
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
self.doctype_dict = {
|
||||
'Sales Order' : 'Sales Order Item',
|
||||
'Delivery Note' : 'Delivery Note Item',
|
||||
'Sales Invoice':'Sales Invoice Item',
|
||||
'Installation Note' : 'Installation Note Item'
|
||||
}
|
||||
|
||||
self.ref_doctype_dict= {}
|
||||
|
||||
self.next_dt_detail = {
|
||||
'delivered_qty' : 'Delivery Note Item',
|
||||
'billed_qty' : 'Sales Invoice Item',
|
||||
'installed_qty' : 'Installation Note Item'}
|
||||
|
||||
self.msg = []
|
||||
|
||||
# Get customer's contact person details
|
||||
# ==============================================================
|
||||
def get_contact_details(self, obj = '', primary = 0):
|
||||
cond = " and contact_name = '"+cstr(obj.doc.contact_person)+"'"
|
||||
if primary: cond = " and is_primary_contact = 'Yes'"
|
||||
@@ -64,15 +47,11 @@ class DocType(TransactionBase):
|
||||
if c['contact_address']:
|
||||
obj.doc.customer_address = c['contact_address']
|
||||
|
||||
|
||||
# get invoice details
|
||||
# ====================
|
||||
def get_invoice_details(self, obj = ''):
|
||||
if obj.doc.company:
|
||||
acc_head = webnotes.conn.sql("select name from `tabAccount` where name = '%s' and docstatus != 2" % (cstr(obj.doc.customer) + " - " + webnotes.conn.get_value('Company', obj.doc.company, 'abbr')))
|
||||
obj.doc.debit_to = acc_head and acc_head[0][0] or ''
|
||||
|
||||
#---------------------------------------- Get Tax Details -------------------------------#
|
||||
def get_tax_details(self, item_code, obj):
|
||||
import json
|
||||
tax = webnotes.conn.sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , item_code)
|
||||
@@ -83,8 +62,6 @@ class DocType(TransactionBase):
|
||||
}
|
||||
return ret
|
||||
|
||||
# Get Serial No Details
|
||||
# ==========================================================================
|
||||
def get_serial_details(self, serial_no, obj):
|
||||
import json
|
||||
item = webnotes.conn.sql("select item_code, make, label,brand, description from `tabSerial No` where name = '%s' and docstatus != 2" %(serial_no), as_dict=1)
|
||||
@@ -339,8 +316,6 @@ class DocType(TransactionBase):
|
||||
webnotes.conn.set_value("Item", d.item_code, "default_income_account", d.income_account)
|
||||
|
||||
|
||||
# **************************************************************************************************************************************************
|
||||
|
||||
def check_credit(self,obj,grand_total):
|
||||
acc_head = webnotes.conn.sql("select name from `tabAccount` where company = '%s' and master_name = '%s'"%(obj.doc.company, obj.doc.customer))
|
||||
if acc_head:
|
||||
@@ -352,10 +327,6 @@ class DocType(TransactionBase):
|
||||
exact_outstanding = flt(tot_outstanding) + flt(grand_total)
|
||||
get_obj('Account',acc_head[0][0]).check_credit_limit(acc_head[0][0], obj.doc.company, exact_outstanding)
|
||||
|
||||
def validate_fiscal_year(self, fiscal_year, transaction_date, label):
|
||||
import accounts.utils
|
||||
accounts.utils.validate_fiscal_year(transaction_date, fiscal_year, label)
|
||||
|
||||
def get_prevdoc_date(self, obj):
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
if d.prevdoc_doctype and d.prevdoc_docname:
|
||||
|
||||
@@ -56,9 +56,6 @@ class DocType(SellingController):
|
||||
def get_rate(self,arg):
|
||||
return get_obj('Sales Common').get_rate(arg)
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Sales Order Date')
|
||||
|
||||
def validate_mandatory(self):
|
||||
# validate transaction date v/s delivery date
|
||||
if self.doc.delivery_date:
|
||||
@@ -156,7 +153,6 @@ class DocType(SellingController):
|
||||
def validate(self):
|
||||
super(DocType, self).validate()
|
||||
|
||||
self.validate_fiscal_year()
|
||||
self.validate_order_type()
|
||||
self.validate_delivery_date()
|
||||
self.validate_mandatory()
|
||||
@@ -398,7 +394,6 @@ def make_delivery_note(source_name, target_doclist=None):
|
||||
"Sales Order": {
|
||||
"doctype": "Delivery Note",
|
||||
"field_map": {
|
||||
"name": "sales_order_no",
|
||||
"shipping_address": "address_display",
|
||||
"shipping_address_name": "customer_address",
|
||||
},
|
||||
|
||||
@@ -303,7 +303,7 @@ test_records = [
|
||||
"basic_rate": 100.0,
|
||||
"export_rate": 100.0,
|
||||
"amount": 1000.0,
|
||||
"reserved_warehouse": "_Test Warehouse",
|
||||
"reserved_warehouse": "_Test Warehouse - _TC",
|
||||
}
|
||||
],
|
||||
]
|
||||
Reference in New Issue
Block a user