[mappers] cleanup, remove dt_map, map_doclist and other such functions
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py
index 059073a..3060a1e 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -65,7 +65,6 @@
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 @@
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):
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index ecfa9a8..d6ca510 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -212,19 +212,10 @@
//-----------------------------
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() {
diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py
index 2d20e3c..4bccce0 100644
--- a/buying/doctype/purchase_common/purchase_common.py
+++ b/buying/doctype/purchase_common/purchase_common.py
@@ -231,16 +231,6 @@
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 @@
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 = ''):
diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py
index d1ce3cc..e3e43e4 100644
--- a/hr/doctype/salary_slip/salary_slip.py
+++ b/hr/doctype/salary_slip/salary_slip.py
@@ -62,7 +62,8 @@
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]
diff --git a/hr/doctype/salary_structure/salary_structure.py b/hr/doctype/salary_structure/salary_structure.py
index d777756..f890024 100644
--- a/hr/doctype/salary_structure/salary_structure.py
+++ b/hr/doctype/salary_structure/salary_structure.py
@@ -22,8 +22,6 @@
from webnotes import msgprint, _
sql = webnotes.conn.sql
-
-
class DocType:
def __init__(self,doc,doclist=[]):
diff --git a/patches/december_2012/remove_project_mapper.py b/patches/december_2012/remove_project_mapper.py
deleted file mode 100644
index 39aae6b..0000000
--- a/patches/december_2012/remove_project_mapper.py
+++ /dev/null
@@ -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)
\ No newline at end of file
diff --git a/patches/february_2013/p06_material_request_mappers.py b/patches/february_2013/p06_material_request_mappers.py
deleted file mode 100644
index 374588b..0000000
--- a/patches/february_2013/p06_material_request_mappers.py
+++ /dev/null
@@ -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")
\ No newline at end of file
diff --git a/patches/july_2012/reload_pr_po_mapper.py b/patches/july_2012/reload_pr_po_mapper.py
deleted file mode 100644
index a53e3dd..0000000
--- a/patches/july_2012/reload_pr_po_mapper.py
+++ /dev/null
@@ -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')
\ No newline at end of file
diff --git a/patches/july_2012/supplier_quotation.py b/patches/july_2012/supplier_quotation.py
deleted file mode 100644
index 0a1ab35..0000000
--- a/patches/july_2012/supplier_quotation.py
+++ /dev/null
@@ -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')
-
\ No newline at end of file
diff --git a/patches/july_2013/p01_remove_doctype_mappers.py b/patches/july_2013/p01_remove_doctype_mappers.py
index 901b1b6..8aa69b8 100644
--- a/patches/july_2013/p01_remove_doctype_mappers.py
+++ b/patches/july_2013/p01_remove_doctype_mappers.py
@@ -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])
\ No newline at end of file
+ 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")
\ No newline at end of file
diff --git a/patches/mar_2012/so_rv_mapper_fix.py b/patches/mar_2012/so_rv_mapper_fix.py
deleted file mode 100644
index e018cf5..0000000
--- a/patches/mar_2012/so_rv_mapper_fix.py
+++ /dev/null
@@ -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'""")
diff --git a/patches/october_2012/reload_gl_mapper.py b/patches/october_2012/reload_gl_mapper.py
deleted file mode 100644
index 50a5ab5..0000000
--- a/patches/october_2012/reload_gl_mapper.py
+++ /dev/null
@@ -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")
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index ad01ce6..2f6daad 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -20,7 +20,6 @@
"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 @@
"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 @@
"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 @@
"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 @@
"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 @@
"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')",
diff --git a/selling/doctype/installation_note/installation_note.py b/selling/doctype/installation_note/installation_note.py
index 62c5b66..74c9478 100644
--- a/selling/doctype/installation_note/installation_note.py
+++ b/selling/doctype/installation_note/installation_note.py
@@ -65,8 +65,7 @@
'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")
diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js
index 97fd714..98a8c42 100644
--- a/selling/doctype/quotation/quotation.js
+++ b/selling/doctype/quotation/quotation.js
@@ -135,25 +135,10 @@
//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
diff --git a/selling/doctype/quotation/quotation.py b/selling/doctype/quotation/quotation.py
index 69177f4..3f0974e 100644
--- a/selling/doctype/quotation/quotation.py
+++ b/selling/doctype/quotation/quotation.py
@@ -37,26 +37,11 @@
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 @@
# --------------------------------------------------------------
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
# ----------------------
diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js
index 4c12580..54f3b7f 100644
--- a/selling/doctype/sales_order/sales_order.js
+++ b/selling/doctype/sales_order/sales_order.js
@@ -89,7 +89,6 @@
},
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
diff --git a/stock/doctype/material_request/material_request.js b/stock/doctype/material_request/material_request.js
index d33ca80..7efd49b 100644
--- a/stock/doctype/material_request/material_request.js
+++ b/stock/doctype/material_request/material_request.js
@@ -72,6 +72,13 @@
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",
diff --git a/stock/doctype/material_request/material_request.py b/stock/doctype/material_request/material_request.py
index d423b3c..861162a 100644
--- a/stock/doctype/material_request/material_request.py
+++ b/stock/doctype/material_request/material_request.py
@@ -21,15 +21,6 @@
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_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)
diff --git a/stock/doctype/material_request/material_request.txt b/stock/doctype/material_request/material_request.txt
index ad94503..a5907c7 100644
--- a/stock/doctype/material_request/material_request.txt
+++ b/stock/doctype/material_request/material_request.txt
@@ -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.",
diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py
index daf31ad..fabcb40 100644
--- a/stock/doctype/material_request/test_material_request.py
+++ b/stock/doctype/material_request/test_material_request.py
@@ -116,17 +116,8 @@
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 @@
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 @@
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 @@
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",
diff --git a/stock/doctype/stock_entry/test_stock_entry.py b/stock/doctype/stock_entry/test_stock_entry.py
index 7b058be..9051d6b 100644
--- a/stock/doctype/stock_entry/test_stock_entry.py
+++ b/stock/doctype/stock_entry/test_stock_entry.py
@@ -278,7 +278,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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
diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.py b/support/doctype/maintenance_schedule/maintenance_schedule.py
index dad63eb..1c25e06 100644
--- a/support/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/support/doctype/maintenance_schedule/maintenance_schedule.py
@@ -194,7 +194,7 @@
# 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'):
diff --git a/support/doctype/maintenance_visit/maintenance_visit.py b/support/doctype/maintenance_visit/maintenance_visit.py
index d87d6e9..678385d 100644
--- a/support/doctype/maintenance_visit/maintenance_visit.py
+++ b/support/doctype/maintenance_visit/maintenance_visit.py
@@ -42,10 +42,10 @@
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):
diff --git a/website/helpers/cart.py b/website/helpers/cart.py
index 98edc07..099fb68 100644
--- a/website/helpers/cart.py
+++ b/website/helpers/cart.py
@@ -308,8 +308,9 @@
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()