[mappers] cleanup, remove dt_map, map_doclist and other such functions
This commit is contained in:
parent
ed23cca9d3
commit
a2a1ec765b
@ -65,7 +65,6 @@ class DocType(BuyingController):
|
||||
self.check_conversion_rate()
|
||||
self.validate_bill_no_date()
|
||||
self.validate_bill_no()
|
||||
self.validate_reference_value()
|
||||
self.validate_credit_acc()
|
||||
self.clear_unallocated_advances("Purchase Invoice Advance", "advance_allocation_details")
|
||||
self.check_for_acc_head_of_supplier()
|
||||
@ -244,12 +243,9 @@ class DocType(BuyingController):
|
||||
msgprint("Supplier name %s do not match with supplier name of %s %s." %(self.doc.supplier,cstr(d.purchase_receipt)))
|
||||
raise Exception , " Validation Error "
|
||||
|
||||
# Validate values with reference document
|
||||
#----------------------------------------
|
||||
def validate_reference_value(self):
|
||||
get_obj('DocType Mapper', 'Purchase Order-Purchase Invoice', with_children = 1).validate_reference_value(self, self.doc.name)
|
||||
|
||||
|
||||
# pass
|
||||
|
||||
# Validate PO and PR
|
||||
# -------------------
|
||||
def validate_po_pr(self, d):
|
||||
|
@ -212,19 +212,10 @@ cur_frm.cscript.get_items = function(doc, dt, dn) {
|
||||
//-----------------------------
|
||||
|
||||
cur_frm.cscript['Make Delivery Note'] = function() {
|
||||
|
||||
var doc = cur_frm.doc
|
||||
n = wn.model.make_new_doc_and_get_name('Delivery Note');
|
||||
$c('dt_map', args={
|
||||
'docs':wn.model.compress([locals['Delivery Note'][n]]),
|
||||
'from_doctype':doc.doctype,
|
||||
'to_doctype':'Delivery Note',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Sales Invoice','Delivery Note'],['Sales Invoice Item','Delivery Note Item'],['Sales Taxes and Charges','Sales Taxes and Charges'],['Sales Team','Sales Team']]"
|
||||
}, function(r,rt) {
|
||||
loaddoc('Delivery Note', n);
|
||||
}
|
||||
);
|
||||
wn.model.open_mapped_doc({
|
||||
method: "accounts.doctype.sales_invoice.sales_invoice.make_delivery_note",
|
||||
source_name: cur_frm.doc.name
|
||||
})
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_bank_voucher = function() {
|
||||
|
@ -231,16 +231,6 @@ class DocType(BuyingController):
|
||||
else:
|
||||
chk_dupl_itm.append(f)
|
||||
|
||||
def validate_reference_value(self, obj):
|
||||
ref_doc = []
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
if d.prevdoc_doctype and d.prevdoc_docname and d.prevdoc_doctype not in ref_doc:
|
||||
mapper_name = d.prevdoc_doctype + '-' + obj.doc.doctype
|
||||
get_obj('DocType Mapper', mapper_name, with_children = 1).\
|
||||
validate_reference_value(obj, obj.doc.name)
|
||||
ref_doc.append(d.prevdoc_doctype)
|
||||
|
||||
|
||||
# Check for Stopped status
|
||||
def check_for_stopped_status(self, doctype, docname):
|
||||
stopped = sql("select name from `tab%s` where name = '%s' and status = 'Stopped'" %
|
||||
@ -248,7 +238,10 @@ class DocType(BuyingController):
|
||||
if stopped:
|
||||
msgprint("One cannot do any transaction against %s : %s, it's status is 'Stopped'" %
|
||||
( doctype, docname), raise_exception=1)
|
||||
|
||||
|
||||
def validate_reference_value(self, obj=None):
|
||||
pass
|
||||
|
||||
# Check Docstatus of Next DocType on Cancel AND of Previous DocType on Submit
|
||||
def check_docstatus(self, check, doctype, docname , detail_doctype = ''):
|
||||
|
||||
|
@ -62,7 +62,8 @@ class DocType(TransactionBase):
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'earning_details')
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'deduction_details')
|
||||
|
||||
get_obj('DocType Mapper', 'Salary Structure-Salary Slip').dt_map('Salary Structure', 'Salary Slip', struct, self.doc, self.doclist, "[['Salary Structure', 'Salary Slip'],['Salary Structure Earning', 'Salary Slip Earning'],['Salary Structure Deduction','Salary Slip Deduction']]")
|
||||
from hr.doctype.salary_structure.salary_structure import make_salary_slip
|
||||
make_salary_slip(struct, self.doclist)
|
||||
|
||||
basic_info = sql("select bank_name, bank_ac_no, esic_card_no, pf_number from `tabEmployee` where name ='%s'" % self.doc.employee)
|
||||
self.doc.bank_name = basic_info[0][0]
|
||||
|
@ -22,8 +22,6 @@ from webnotes.model.doc import addchild, make_autoname
|
||||
from webnotes import msgprint, _
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
|
@ -1,6 +0,0 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
from webnotes.model import delete_doc
|
||||
for d in ["Project-Sales Order", "Project-Delivery Note", "Project-Sales Invoice"]:
|
||||
delete_doc("DocType Mapper", d)
|
@ -1,7 +0,0 @@
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
webnotes.reload_doc("buying", "DocType Mapper", "Material Request-Purchase Order")
|
||||
webnotes.reload_doc("buying", "DocType Mapper", "Material Request-Supplier Quotation")
|
||||
webnotes.reload_doc("buying", "DocType Mapper", "Sales Order-Material Request")
|
||||
webnotes.reload_doc("stock", "DocType Mapper", "Material Request-Stock Entry")
|
@ -1,5 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
import webnotes
|
||||
from webnotes.modules import reload_doc
|
||||
reload_doc('buying', 'DocType Mapper', 'Material Request-Purchase Order')
|
@ -1,14 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def execute():
|
||||
"""sync supplier quotatoin and create supplier quotation mappers"""
|
||||
webnotes.reload_doc('buying', 'doctype', 'supplier_quotation')
|
||||
webnotes.reload_doc('buying', 'doctype', 'supplier_quotation_item')
|
||||
webnotes.reload_doc('buying', 'doctype', 'purchase_order')
|
||||
webnotes.reload_doc('buying', 'doctype', 'purchase_order_item')
|
||||
|
||||
from webnotes.modules import reload_doc
|
||||
reload_doc('buying', 'DocType Mapper', 'Material Request-Supplier Quotation')
|
||||
reload_doc('buying', 'DocType Mapper', 'Supplier Quotation-Purchase Order')
|
||||
|
@ -1,4 +1,8 @@
|
||||
import webnotes
|
||||
def execute():
|
||||
for m in webnotes.conn.sql("select name from `tabDocType Mapper`"):
|
||||
webnotes.delete_doc("DocType Mapper", m[0])
|
||||
webnotes.conn.sql("""drop table if exists `tabDocType Mapper`""")
|
||||
webnotes.conn.sql("""drop table if exists `tabTable Mapper Detail`""")
|
||||
webnotes.conn.sql("""drop table if exists `tabField Mapper Detail`""")
|
||||
webnotes.delete_doc("DocType", "DocType Mapper")
|
||||
webnotes.delete_doc("DocType", "Table Mapper Detail")
|
||||
webnotes.delete_doc("DocType", "Field Mapper Detail")
|
@ -1,11 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
import webnotes
|
||||
count = webnotes.conn.sql("""SELECT COUNT(*) FROM `tabTable Mapper Detail`
|
||||
WHERE parent='Sales Order-Sales Invoice'
|
||||
AND from_table='Sales Order Item'""")
|
||||
if count and count[0][0]==2:
|
||||
webnotes.conn.sql("""DELETE FROM `tabTable Mapper Detail`
|
||||
WHERE parent='Sales Order-Sales Invoice'
|
||||
AND from_table='Sales Order Item'
|
||||
AND validation_logic='docstatus = 1'""")
|
@ -1,6 +0,0 @@
|
||||
def execute():
|
||||
return # deprecated
|
||||
import webnotes
|
||||
from webnotes.modules import reload_doc
|
||||
reload_doc("accounts", "GL Mapper", "Purchase Invoice")
|
||||
reload_doc("accounts", "GL Mapper", "Purchase Invoice with write off")
|
@ -20,7 +20,6 @@ patch_list = [
|
||||
"execute:webnotes.reload_doc('core', 'doctype', 'docperm') # 2013-04-07",
|
||||
"execute:webnotes.reload_doc('core', 'doctype', 'report')",
|
||||
"execute:webnotes.reload_doc('core', 'doctype', 'doctype') # 2013-07-04",
|
||||
"patches.mar_2012.so_rv_mapper_fix",
|
||||
"patches.mar_2012.clean_property_setter",
|
||||
"patches.april_2012.naming_series_patch",
|
||||
"patches.mar_2012.cleanup_control_panel",
|
||||
@ -73,7 +72,6 @@ patch_list = [
|
||||
"patches.july_2012.bin_permission",
|
||||
"patches.july_2012.project_patch_repeat",
|
||||
"patches.july_2012.repost_stock_due_to_wrong_packing_list",
|
||||
"patches.july_2012.supplier_quotation",
|
||||
"patches.august_2012.task_allocated_to_assigned",
|
||||
"patches.august_2012.change_profile_permission",
|
||||
"patches.august_2012.repost_billed_amt",
|
||||
@ -89,7 +87,6 @@ patch_list = [
|
||||
"patches.september_2012.deprecate_account_balance",
|
||||
"patches.september_2012.profile_delete_permission",
|
||||
"patches.october_2012.update_permission",
|
||||
"patches.october_2012.reload_gl_mapper",
|
||||
"patches.october_2012.fix_wrong_vouchers",
|
||||
"patches.october_2012.company_fiscal_year_docstatus_patch",
|
||||
"patches.october_2012.update_account_property",
|
||||
@ -124,7 +121,6 @@ patch_list = [
|
||||
"patches.december_2012.rebuild_item_group_tree",
|
||||
"patches.december_2012.address_title",
|
||||
"patches.december_2012.delete_form16_print_format",
|
||||
"patches.december_2012.remove_project_mapper",
|
||||
"patches.december_2012.update_print_width",
|
||||
"patches.january_2013.remove_bad_permissions",
|
||||
"patches.january_2013.holiday_list_patch",
|
||||
@ -171,7 +167,6 @@ patch_list = [
|
||||
"execute:webnotes.delete_doc('DocType', 'Service Quotation')",
|
||||
"execute:webnotes.delete_doc('DocType', 'Service Order Detail')",
|
||||
"execute:webnotes.delete_doc('DocType', 'Service Quotation Detail')",
|
||||
"patches.february_2013.p06_material_request_mappers",
|
||||
"execute:webnotes.delete_doc('Page', 'Query Report')",
|
||||
"patches.february_2013.repost_reserved_qty",
|
||||
"execute:webnotes.reload_doc('core', 'doctype', 'report') # 2013-02-25",
|
||||
@ -221,7 +216,6 @@ patch_list = [
|
||||
"patches.april_2013.p05_update_file_data",
|
||||
"patches.april_2013.p06_update_file_size",
|
||||
"patches.april_2013.p05_fixes_in_reverse_modules",
|
||||
"execute:webnotes.delete_doc('DocType Mapper', 'Delivery Note-Packing Slip')",
|
||||
"patches.april_2013.p07_rename_cost_center_other_charges",
|
||||
"patches.april_2013.p06_default_cost_center",
|
||||
"execute:webnotes.reset_perms('File Data')",
|
||||
|
@ -65,8 +65,7 @@ class DocType(TransactionBase):
|
||||
'Installation Date')
|
||||
|
||||
def validate_reference_value(self):
|
||||
mapper = get_obj('DocType Mapper', 'Delivery Note-Installation Note', with_children = 1)
|
||||
mapper.validate_reference_value(self, self.doc.name)
|
||||
pass
|
||||
|
||||
def is_serial_no_added(self, item_code, serial_no):
|
||||
ar_required = webnotes.conn.get_value("Item", item_code, "has_serial_no")
|
||||
|
@ -135,25 +135,10 @@ cur_frm.cscript['Make Sales Order'] = function() {
|
||||
|
||||
//pull enquiry details
|
||||
cur_frm.cscript.pull_enquiry_detail = function(doc,cdt,cdn){
|
||||
|
||||
var callback = function(r,rt){
|
||||
if(r.message){
|
||||
doc.quotation_to = r.message;
|
||||
|
||||
if(doc.quotation_to == 'Lead') {
|
||||
unhide_field('lead');
|
||||
}
|
||||
else if(doc.quotation_to == 'Customer') {
|
||||
unhide_field(['customer','customer_address','contact_person','territory','customer_group']);
|
||||
}
|
||||
refresh_many(['quotation_details','quotation_to','customer','customer_address',
|
||||
'contact_person', 'lead', 'address_display', 'contact_display', 'contact_mobile',
|
||||
'contact_email', 'territory', 'customer_group', 'order_type']);
|
||||
}
|
||||
}
|
||||
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'pull_enq_details','',callback);
|
||||
|
||||
wn.model.map_current_doc({
|
||||
method: "selling.doctype.opportunity.opportunity.make_quotation",
|
||||
source_name: cur_frm.doc.enq_no,
|
||||
})
|
||||
}
|
||||
|
||||
// declare order lost
|
||||
|
@ -37,26 +37,11 @@ class DocType(SellingController):
|
||||
def onload(self):
|
||||
self.add_communication_list()
|
||||
|
||||
# Pull Opportunity Details
|
||||
# --------------------
|
||||
def pull_enq_details(self):
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'quotation_details')
|
||||
get_obj('DocType Mapper', 'Opportunity-Quotation').dt_map('Opportunity', 'Quotation', self.doc.enq_no, self.doc, self.doclist, "[['Opportunity', 'Quotation'],['Opportunity Item', 'Quotation Item']]")
|
||||
|
||||
self.get_adj_percent()
|
||||
|
||||
return self.doc.quotation_to
|
||||
|
||||
# Get contact person details based on customer selected
|
||||
# ------------------------------------------------------
|
||||
def get_contact_details(self):
|
||||
return get_obj('Sales Common').get_contact_details(self,0)
|
||||
|
||||
|
||||
|
||||
# QUOTATION DETAILS TRIGGER FUNCTIONS
|
||||
# ================================================================================
|
||||
|
||||
# Get Item Details
|
||||
# -----------------
|
||||
def get_item_details(self, args=None):
|
||||
@ -83,20 +68,12 @@ class DocType(SellingController):
|
||||
# --------------------------------------------------------------
|
||||
def get_adj_percent(self, arg=''):
|
||||
get_obj('Sales Common').get_adj_percent(self)
|
||||
|
||||
|
||||
|
||||
|
||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
||||
# ====================================================================================
|
||||
|
||||
# Get Tax rate if account type is TAX
|
||||
# -----------------------------------
|
||||
def get_rate(self,arg):
|
||||
return get_obj('Sales Common').get_rate(arg)
|
||||
|
||||
# VALIDATE
|
||||
# ==============================================================================================
|
||||
|
||||
# Fiscal Year Validation
|
||||
# ----------------------
|
||||
|
@ -89,7 +89,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
|
||||
},
|
||||
|
||||
make_delivery_note: function() {
|
||||
console.log(cur_frm.doc.name);
|
||||
wn.model.open_mapped_doc({
|
||||
method: "selling.doctype.sales_order.sales_order.make_delivery_note",
|
||||
source_name: cur_frm.doc.name
|
||||
|
@ -72,6 +72,13 @@ erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.exten
|
||||
return;
|
||||
},
|
||||
|
||||
pull_sales_order_details: function(doc) {
|
||||
wn.model.map_current_doc({
|
||||
method: "selling.doctype.sales_order.sales_order.make_material_request",
|
||||
source_name: cur_frm.doc.sales_order_no,
|
||||
});
|
||||
},
|
||||
|
||||
make_purchase_order: function() {
|
||||
wn.model.open_mapped_doc({
|
||||
method: "stock.doctype.material_request.material_request.make_purchase_order",
|
||||
|
@ -21,15 +21,6 @@ class DocType(BuyingController):
|
||||
def get_bin_details(self, arg = ''):
|
||||
return get_obj(dt='Purchase Common').get_bin_details(arg)
|
||||
|
||||
# Pull Sales Order Items
|
||||
# -------------------------
|
||||
def pull_so_details(self):
|
||||
self.check_if_already_pulled()
|
||||
if self.doc.sales_order_no:
|
||||
get_obj('DocType Mapper', 'Sales Order-Material Request', with_children=1).dt_map('Sales Order', 'Material Request', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Material Request'],['Sales Order Item', 'Material Request Item']]")
|
||||
else:
|
||||
msgprint("Please select Sales Order whose details need to pull")
|
||||
|
||||
def check_if_already_pulled(self):
|
||||
pass#if self.[d.sales_order_no for d in getlist(self.doclist, 'indent_details')]
|
||||
|
||||
@ -303,10 +294,10 @@ def make_supplier_quotation(source_name, target_doclist=None):
|
||||
def make_stock_entry(source_name, target_doclist=None):
|
||||
from webnotes.model.mapper import get_mapped_doclist
|
||||
|
||||
def set_purpose(source, target, source_parent):
|
||||
def set_purpose(source, target):
|
||||
target[0].purpose = "Material Transfer"
|
||||
|
||||
def update_item(source, target):
|
||||
def update_item(source, target, source_parent):
|
||||
target.conversion_factor = 1
|
||||
target.qty = flt(source.qty) - flt(source.ordered_qty)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 14:48:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:46:13",
|
||||
"modified": "2013-07-08 11:02:12",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -134,8 +134,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "pull_sales_order_details",
|
||||
"fieldtype": "Button",
|
||||
"label": "Pull Sales Order Items",
|
||||
"options": "pull_so_details"
|
||||
"label": "Pull Sales Order Items"
|
||||
},
|
||||
{
|
||||
"default": "Give additional details about the indent.",
|
||||
|
@ -116,17 +116,8 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
self._test_requested_qty(54.0, 3.0)
|
||||
|
||||
# map a purchase order
|
||||
po_doclist = webnotes.map_doclist([["Material Request", "Purchase Order"],
|
||||
["Material Request Item", "Purchase Order Item"]], mr.doc.name)
|
||||
po_doclist[0].fields.update({
|
||||
"supplier": "_Test Supplier",
|
||||
"supplier_name": "_Test Supplier",
|
||||
"transaction_date": mr.doc.transaction_date,
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"currency": "INR",
|
||||
"conversion_rate": 1.0,
|
||||
"grand_total_import": 0.0
|
||||
})
|
||||
from stock.doctype.material_request.material_request import make_purchase_order
|
||||
po_doclist = make_purchase_order(mr.doc.name)
|
||||
po_doclist[1].qty = 27.0
|
||||
po_doclist[2].qty = 1.5
|
||||
|
||||
@ -167,22 +158,23 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
self._test_expected(mr.doclist, [{"per_ordered": None}, {"ordered_qty": None}, {"ordered_qty": None}])
|
||||
|
||||
self._test_requested_qty(54.0, 3.0)
|
||||
|
||||
|
||||
from stock.doctype.material_request.material_request import make_stock_entry
|
||||
|
||||
# map a stock entry
|
||||
se_doclist = webnotes.map_doclist([["Material Request", "Stock Entry"],
|
||||
["Material Request Item", "Stock Entry Detail"]], mr.doc.name)
|
||||
se_doclist[0].fields.update({
|
||||
se_doclist = make_stock_entry(mr.doc.name)
|
||||
se_doclist[0].update({
|
||||
"posting_date": "2013-03-01",
|
||||
"posting_time": "01:00",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
})
|
||||
se_doclist[1].fields.update({
|
||||
se_doclist[1].update({
|
||||
"qty": 27.0,
|
||||
"transfer_qty": 27.0,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
"incoming_rate": 1.0
|
||||
})
|
||||
se_doclist[2].fields.update({
|
||||
se_doclist[2].update({
|
||||
"qty": 1.5,
|
||||
"transfer_qty": 1.5,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
@ -231,20 +223,21 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
self._test_requested_qty(54.0, 3.0)
|
||||
|
||||
# map a stock entry
|
||||
se_doclist = webnotes.map_doclist([["Material Request", "Stock Entry"],
|
||||
["Material Request Item", "Stock Entry Detail"]], mr.doc.name)
|
||||
se_doclist[0].fields.update({
|
||||
from stock.doctype.material_request.material_request import make_stock_entry
|
||||
|
||||
se_doclist = make_stock_entry(mr.doc.name)
|
||||
se_doclist[0].update({
|
||||
"posting_date": "2013-03-01",
|
||||
"posting_time": "00:00",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
})
|
||||
se_doclist[1].fields.update({
|
||||
se_doclist[1].update({
|
||||
"qty": 60.0,
|
||||
"transfer_qty": 60.0,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
"incoming_rate": 1.0
|
||||
})
|
||||
se_doclist[2].fields.update({
|
||||
se_doclist[2].update({
|
||||
"qty": 3.0,
|
||||
"transfer_qty": 3.0,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
@ -285,21 +278,22 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
mr.submit()
|
||||
|
||||
# map a stock entry
|
||||
se_doclist = webnotes.map_doclist([["Material Request", "Stock Entry"],
|
||||
["Material Request Item", "Stock Entry Detail"]], mr.doc.name)
|
||||
se_doclist[0].fields.update({
|
||||
from stock.doctype.material_request.material_request import make_stock_entry
|
||||
|
||||
se_doclist = make_stock_entry(mr.doc.name)
|
||||
se_doclist[0].update({
|
||||
"posting_date": "2013-03-01",
|
||||
"posting_time": "00:00",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
})
|
||||
se_doclist[1].fields.update({
|
||||
se_doclist[1].update({
|
||||
"qty": 60.0,
|
||||
"transfer_qty": 60.0,
|
||||
"s_warehouse": "_Test Warehouse",
|
||||
"t_warehouse": "_Test Warehouse 1",
|
||||
"incoming_rate": 1.0
|
||||
})
|
||||
se_doclist[2].fields.update({
|
||||
se_doclist[2].update({
|
||||
"qty": 3.0,
|
||||
"transfer_qty": 3.0,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
|
@ -278,7 +278,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
self._insert_material_receipt()
|
||||
|
||||
from stock.doctype.delivery_note.test_delivery_note \
|
||||
import test_records as delivery_note_test_records
|
||||
import test_records as delivery_note_test_records, make_sales_invoice
|
||||
|
||||
actual_qty_0 = self._get_actual_qty()
|
||||
|
||||
@ -292,11 +292,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
self.assertEquals(actual_qty_0 - delivered_qty, actual_qty_1)
|
||||
|
||||
si_doclist = webnotes.map_doclist([
|
||||
["Delivery Note", "Sales Invoice"],
|
||||
["Delivery Note Item", "Sales Invoice Item"],
|
||||
["Sales Taxes and Charges", "Sales Taxes and Charges"],
|
||||
["Sales Team", "Sales Team"]], dn.doc.name)
|
||||
si_doclist = make_sales_invoice(dn.doc.name)
|
||||
|
||||
si = webnotes.bean(si_doclist)
|
||||
si.doc.posting_date = dn.doc.posting_date
|
||||
@ -366,7 +362,8 @@ class TestStockEntry(unittest.TestCase):
|
||||
self._insert_material_receipt()
|
||||
|
||||
from selling.doctype.sales_order.test_sales_order \
|
||||
import test_records as sales_order_test_records
|
||||
import test_records as sales_order_test_records,
|
||||
make_sales_invoice, make_delivery_note
|
||||
|
||||
actual_qty_0 = self._get_actual_qty()
|
||||
|
||||
@ -376,11 +373,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
so.insert()
|
||||
so.submit()
|
||||
|
||||
dn_doclist = webnotes.map_doclist([
|
||||
["Sales Order", "Delivery Note"],
|
||||
["Sales Order Item", "Delivery Note Item"],
|
||||
["Sales Taxes and Charges", "Sales Taxes and Charges"],
|
||||
["Sales Team", "Sales Team"]], so.doc.name)
|
||||
dn_doclist = make_delivery_note(so.doc.name)
|
||||
|
||||
dn = webnotes.bean(dn_doclist)
|
||||
dn.doc.status = "Draft"
|
||||
@ -392,11 +385,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
self.assertEquals(actual_qty_0 - delivered_qty, actual_qty_1)
|
||||
|
||||
si_doclist = webnotes.map_doclist([
|
||||
["Sales Order", "Sales Invoice"],
|
||||
["Sales Order Item", "Sales Invoice Item"],
|
||||
["Sales Taxes and Charges", "Sales Taxes and Charges"],
|
||||
["Sales Team", "Sales Team"]], so.doc.name)
|
||||
si_doclist = make_sales_invoice(so.doc.name)
|
||||
|
||||
si = webnotes.bean(si_doclist)
|
||||
si.doc.posting_date = dn.doc.posting_date
|
||||
@ -429,7 +418,8 @@ class TestStockEntry(unittest.TestCase):
|
||||
actual_qty_0 = self._get_actual_qty()
|
||||
|
||||
from stock.doctype.purchase_receipt.test_purchase_receipt \
|
||||
import test_records as purchase_receipt_test_records
|
||||
import test_records as purchase_receipt_test_records,
|
||||
make_purchase_invoice
|
||||
|
||||
# submit purchase receipt
|
||||
pr = webnotes.bean(copy=purchase_receipt_test_records[0])
|
||||
@ -440,10 +430,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
self.assertEquals(actual_qty_0 + 10, actual_qty_1)
|
||||
|
||||
pi_doclist = webnotes.map_doclist([
|
||||
["Purchase Receipt", "Purchase Invoice"],
|
||||
["Purchase Receipt Item", "Purchase Invoice Item"],
|
||||
["Purchase Taxes and Charges", "Purchase Taxes and Charges"]], pr.doc.name)
|
||||
pi_doclist = make_purchase_invoice(pr.doc.name)
|
||||
|
||||
pi = webnotes.bean(pi_doclist)
|
||||
pi.doc.posting_date = pr.doc.posting_date
|
||||
@ -519,7 +506,8 @@ class TestStockEntry(unittest.TestCase):
|
||||
actual_qty_0 = self._get_actual_qty()
|
||||
|
||||
from buying.doctype.purchase_order.test_purchase_order \
|
||||
import test_records as purchase_order_test_records
|
||||
import test_records as purchase_order_test_records,
|
||||
make_purchase_receipt, make_purchase_invoice
|
||||
|
||||
# submit purchase receipt
|
||||
po = webnotes.bean(copy=purchase_order_test_records[0])
|
||||
@ -529,10 +517,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
po.insert()
|
||||
po.submit()
|
||||
|
||||
pr_doclist = webnotes.map_doclist([
|
||||
["Purchase Order", "Purchase Receipt"],
|
||||
["Purchase Order Item", "Purchase Receipt Item"],
|
||||
["Purchase Taxes and Charges", "Purchase Taxes and Charges"]], po.doc.name)
|
||||
pr_doclist = make_purchase_receipt(po.doc.name)
|
||||
|
||||
pr = webnotes.bean(pr_doclist)
|
||||
pr.doc.posting_date = po.doc.transaction_date
|
||||
@ -543,10 +528,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
self.assertEquals(actual_qty_0 + 10, actual_qty_1)
|
||||
|
||||
pi_doclist = webnotes.map_doclist([
|
||||
["Purchase Order", "Purchase Invoice"],
|
||||
["Purchase Order Item", "Purchase Invoice Item"],
|
||||
["Purchase Taxes and Charges", "Purchase Taxes and Charges"]], po.doc.name)
|
||||
pi_doclist = make_purchase_invoice(po.doc.name)
|
||||
|
||||
pi = webnotes.bean(pi_doclist)
|
||||
pi.doc.posting_date = pr.doc.posting_date
|
||||
|
@ -194,7 +194,7 @@ class DocType(TransactionBase):
|
||||
# Validate values with reference document
|
||||
#----------------------------------------
|
||||
def validate_reference_value(self):
|
||||
get_obj('DocType Mapper', 'Sales Order-Maintenance Schedule', with_children = 1).validate_reference_value(self, self.doc.name)
|
||||
pass
|
||||
|
||||
def validate_serial_no(self):
|
||||
for d in getlist(self.doclist, 'item_maintenance_detail'):
|
||||
|
@ -42,10 +42,10 @@ class DocType(TransactionBase):
|
||||
|
||||
def validate_reference_value(self, check_for):
|
||||
if check_for == 'Sales Order':
|
||||
get_obj('DocType Mapper', 'Sales Order-Maintenance Visit', with_children = 1).validate_reference_value(self, self.doc.name)
|
||||
pass
|
||||
elif check_for == 'Customer Issue':
|
||||
get_obj('DocType Mapper', 'Customer Issue-Maintenance Visit', with_children = 1).validate_reference_value(self, self.doc.name)
|
||||
|
||||
pass
|
||||
|
||||
def validate_serial_no(self):
|
||||
for d in getlist(self.doclist, 'maintenance_visit_details'):
|
||||
if d.serial_no and not sql("select name from `tabSerial No` where name = '%s' and docstatus != 2" % d.serial_no):
|
||||
|
@ -308,8 +308,9 @@ def checkout():
|
||||
quotation.ignore_permissions = True
|
||||
quotation.submit()
|
||||
|
||||
sales_order = webnotes.bean(webnotes.map_doclist([["Quotation", "Sales Order"], ["Quotation Item", "Sales Order Item"],
|
||||
["Sales Taxes and Charges", "Sales Taxes and Charges"]], quotation.doc.name))
|
||||
from selling.doctype.quotation.quotation import make_sales_order
|
||||
|
||||
sales_order = webnotes.bean(make_sales_order(quotation.doc.name))
|
||||
|
||||
sales_order.ignore_permissions = True
|
||||
sales_order.insert()
|
||||
|
Loading…
x
Reference in New Issue
Block a user