Customer Address Contact report

This commit is contained in:
Anand Doshi 2012-01-23 18:32:20 +05:30
parent 7daed0cad7
commit 9a7ea9285e
8 changed files with 271 additions and 547 deletions

View File

@ -35,4 +35,9 @@ patch_list = [
'patch_file': 'remove_get_tds_button',
'description': "Remove One Get TDS button, which is appearing twice in JV"
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'customer_address_contact',
'description': "Install Customer Address Contact report and run patches regarding primary address and contact"
},
]

View File

@ -1,673 +1,335 @@
# Module Def, Selling
[
# These values are common in all dictionaries
{
'_last_update': None,
'creation': '2011-06-30 15:45:03',
'disabled': 'No',
'creation': '2011-07-01 17:39:08',
'docstatus': 0,
'modified': '2012-01-23 18:25:58',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all Module Def Role
{
'doctype': 'Module Def Role',
'name': '__common__',
'parent': 'Selling',
'parentfield': 'roles',
'parenttype': 'Module Def'
},
# These values are common for all Module Def Item
{
'doctype': 'Module Def Item',
'name': '__common__',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
},
# These values are common for all Module Def
{
'disabled': 'No',
'doctype': u'Module Def',
'doctype_list': 'Print Format, Sales Order\nPrint Format, Quotation Format\nPrint Format, Delivery Note Format',
'file_list': 'crm.gif,FileData/00208',
'idx': None,
'is_hidden': 'No',
'last_updated_date': None,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'module_desc': 'Manage you sales team, with your leads, customers, quotes, orders etc.',
'module_icon': 'Selling.gif',
'module_label': 'Selling',
'module_name': 'Selling',
'module_page': None,
'module_seq': 3,
'name': 'Selling',
'owner': 'Administrator',
'parent': None,
'parentfield': None,
'parenttype': None,
'trash_reason': None,
'widget_code': None
'name': '__common__'
},
# Module Def, Selling
{
'doctype': u'Module Def',
'name': 'Selling'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Database of potential customers you need to keep in touch with',
'display_name': 'Lead',
'doc_name': 'Lead',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\nlead_owner\nlead_name\ncontact_no\ncontact_by\ncontact_date\nexpected_month',
'hide': None,
'icon': None,
'idx': 1,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01284',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'status\nlead_owner\nlead_name\ncontact_no\ncontact_by\ncontact_date\nexpected_month'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Your Customer Database',
'display_name': 'Customer',
'doc_name': 'Customer',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'customer_group\ncountry',
'hide': None,
'icon': None,
'idx': 2,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01285',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'customer_group\ncountry'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Specific requirements from a Lead / Customer',
'display_name': 'Enquiry',
'doc_name': 'Enquiry',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ncompany',
'hide': None,
'icon': None,
'idx': 3,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01286',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ncompany'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Offers you have made to your customers',
'display_name': 'Quotation',
'doc_name': 'Quotation',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ngrand_total\ncompany',
'hide': None,
'icon': None,
'idx': 4,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01287',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'status\ntransaction_date\ncustomer\ncontact_person\ncost_center\ngrand_total\ncompany'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Database of confirmed Sale Orders from your Customers',
'display_name': 'Sales Order',
'doc_name': 'Sales Order',
'doc_type': 'Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'status\ntransaction_date\ncustomer\ncost_center\ngrand_total\nper_delivered\nper_billed\ncompany',
'hide': None,
'icon': None,
'idx': 5,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01288',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'status\ntransaction_date\ncustomer\ncost_center\ngrand_total\nper_delivered\nper_billed\ncompany'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Sales Dashboard',
'doc_name': 'Sales Dashboard',
'doc_type': 'Pages',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 6,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01289',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': None,
'doc_name': 'Reports',
'doc_type': 'Separator',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 7,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01290',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'doc_name': 'Reports',
'doc_type': 'Separator',
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Gross Profit',
'doc_name': 'Delivery Note Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 8,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01291',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Territory, Item Group wise GP',
'doc_name': 'Delivery Note',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 9,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01292',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Itemwise Sales Details',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 10,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01293',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Itemwise Delivery Details',
'doc_name': 'Delivery Note Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 11,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01294',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Sales Personwise Transaction Summary',
'doc_name': 'Sales Person',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 12,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01295',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Total Target Variance Report',
'doc_name': 'Target Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 13,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01296',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Sales Persons Target Variance (Item Group wise)',
'doc_name': 'Target Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 14,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01297',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Territories Target Variance (Item Group wise)',
'doc_name': 'Target Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 15,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01298',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Sales Order Pending Items',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 16,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01299',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Sales Orderwise Booking & Delivery Summary',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 17,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01300',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Sales Orderwise Pending Qty To Deliver',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 18,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01301',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Sales Orderwise Pending Amount To Bill',
'doc_name': 'Sales Order Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 19,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01302',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Delivered Items to be Install',
'doc_name': 'Delivery Note Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 20,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01303',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Itemwise Price List',
'doc_name': 'Ref Rate Detail',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 21,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01304',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': None,
'display_name': 'Follow-up Report',
'doc_name': 'Follow up',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 22,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01305',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Ledger details of your debtors',
'display_name': "Debtor's Ledger",
'doc_name': 'GL Entry',
'doc_type': 'Reports',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': None,
'hide': None,
'icon': None,
'idx': 23,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01306',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'doctype': 'Module Def Item'
},
# Module Def Item
{
'description': 'Report displaying Customer, Primary Address Details & Primary Contact Details',
'display_name': 'Customer Address Contact',
'doc_name': 'Customer',
'doc_type': 'Reports',
'doctype': 'Module Def Item'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Customer Category',
'display_name': 'Customer Group',
'doc_name': 'Customer Group',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'id\ndescription',
'hide': None,
'icon': None,
'idx': 24,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01307',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'id\ndescription'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Sales person details',
'display_name': 'Sales Person',
'doc_name': 'Sales Person',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'id\nterritory\ndepartment\nmobile_no\nemail_id',
'hide': None,
'icon': None,
'idx': 25,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01308',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'id\nterritory\ndepartment\nmobile_no\nemail_id'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Item master',
'display_name': 'Item',
'doc_name': 'Item',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'name\nitem_group\ndescription',
'hide': None,
'icon': None,
'idx': 26,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01309',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'name\nitem_group\ndescription'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Sales partner details',
'display_name': 'Sales Partner',
'doc_name': 'Sales Partner',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'id\npartner_type\nmobile\nemail\nterritory',
'hide': None,
'icon': None,
'idx': 27,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01310',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'id\npartner_type\nmobile\nemail\nterritory'
},
# Module Def Item
{
'click_function': None,
'creation': '2011-06-30 15:45:03',
'description': 'Business campaigns',
'display_name': 'Campaign',
'doc_name': 'Campaign',
'doc_type': 'Setup Forms',
'docstatus': 0,
'doctype': 'Module Def Item',
'fields': 'id\ncampaign_name\ndescription',
'hide': None,
'icon': None,
'idx': 28,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDI01311',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'items',
'parenttype': 'Module Def'
'fields': 'id\ncampaign_name\ndescription'
},
# Module Def Role
{
'creation': '2011-06-30 15:45:03',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 1,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDR00328',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Administrator'
},
# Module Def Role
{
'creation': '2011-06-30 15:45:03',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 2,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDR00329',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Sales Manager'
},
# Module Def Role
{
'creation': '2011-06-30 15:45:03',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 3,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDR00330',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Sales User'
},
# Module Def Role
{
'creation': '2011-06-30 15:45:03',
'docstatus': 0,
'doctype': 'Module Def Role',
'idx': 4,
'modified': '2011-06-30 15:45:03',
'modified_by': 'Administrator',
'name': 'MDR00331',
'owner': 'Administrator',
'parent': 'Selling',
'parentfield': 'roles',
'parenttype': 'Module Def',
'role': 'Sales Master Manager'
}
]

View File

@ -0,0 +1,36 @@
# Search Criteria, customer_address_contact
[
# These values are common in all dictionaries
{
'creation': '2012-01-23 18:28:40',
'docstatus': 0,
'modified': '2012-01-23 18:28:40',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all Search Criteria
{
'add_col': "`tabAddress`.address_line1 AS 'Address Line 1'\n`tabAddress`.address_line2 AS 'Address Line 2'\n`tabAddress`.city AS 'City'\n`tabAddress`.state AS 'State'\n`tabAddress`.pincode AS 'Pincode'\n`tabAddress`.country AS 'Country'\n`tabContact`.first_name AS 'Contact First Name'\n`tabContact`.last_name AS 'Contact Last Name'\n`tabContact`.phone AS 'Contact Phone'\n`tabContact`.mobile_no AS 'Contact Mobile'\n`tabContact`.email_id AS 'Contact Email'",
'add_cond': '`tabAddress`.customer=`tabCustomer`.name\nifnull(`tabAddress`.is_primary_address, 0)=1\n`tabContact`.customer=`tabCustomer`.name\nifnull(`tabContact`.is_primary_contact, 0)=1',
'add_tab': '`tabAddress`\n`tabContact`',
'columns': 'Customer\x01ID,Customer\x01Customer Name',
'criteria_name': 'Customer Address Contact',
'doc_type': 'Customer',
'doctype': 'Search Criteria',
'filters': "{'Customer\x01Saved':1,'Customer\x01Submitted':1}",
'module': 'Selling',
'name': '__common__',
'page_len': 50,
'sort_by': '`tabCustomer`.`customer_name`',
'sort_order': 'ASC',
'standard': 'Yes'
},
# Search Criteria, customer_address_contact
{
'doctype': 'Search Criteria',
'name': 'customer_address_contact'
}
]

View File

@ -4,53 +4,64 @@ import webnotes
from webnotes.model.doc import Document
from webnotes import session, form, msgprint, errprint
sql = webnotes.conn.sql
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def autoname(self):
if self.doc.customer:
self.doc.name = self.doc.customer + '-' + self.doc.address_type
elif self.doc.supplier:
self.doc.name = self.doc.supplier + '-' + self.doc.address_type
elif self.doc.sales_partner:
self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type
# filter out bad characters in name
#self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
def autoname(self):
if self.doc.customer:
self.doc.name = self.doc.customer + '-' + self.doc.address_type
elif self.doc.supplier:
self.doc.name = self.doc.supplier + '-' + self.doc.address_type
elif self.doc.sales_partner:
self.doc.name = self.doc.sales_partner + '-' + self.doc.address_type
# filter out bad characters in name
#self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
#----------------------
# Call to Validate
#----------------------
def validate(self):
self.validate_primary_address()
self.validate_shipping_address()
def validate(self):
self.validate_primary_address()
self.validate_shipping_address()
#----------------------
# Validate that there can only be one primary address for particular customer, supplier
#----------------------
def validate_primary_address(self):
if self.doc.is_primary_address == 1:
if self.doc.customer:
sql("update tabAddress set is_primary_address=0 where customer = '%s'" % (self.doc.customer))
elif self.doc.supplier:
sql("update tabAddress set is_primary_address=0 where supplier = '%s'" % (self.doc.supplier))
elif self.doc.sales_partner:
sql("update tabAddress set is_primary_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
def validate_primary_address(self):
sql = webnotes.conn.sql
if self.doc.is_primary_address == 1:
if self.doc.customer:
sql("update tabAddress set is_primary_address=0 where customer = '%s'" % (self.doc.customer))
elif self.doc.supplier:
sql("update tabAddress set is_primary_address=0 where supplier = '%s'" % (self.doc.supplier))
elif self.doc.sales_partner:
sql("update tabAddress set is_primary_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
elif not self.doc.is_shipping_address:
if self.doc.customer:
if not sql("select name from tabAddress where is_primary_address=1 and customer = '%s'" % (self.doc.customer)):
self.doc.is_primary_address = 1
elif self.doc.supplier:
if not sql("select name from tabAddress where is_primary_address=1 and supplier = '%s'" % (self.doc.supplier)):
self.doc.is_primary_address = 1
elif self.doc.sales_partner:
if not sql("select name from tabAddress where is_primary_address=1 and sales_partner = '%s'" % (self.doc.sales_partner)):
self.doc.is_primary_address = 1
#----------------------
# Validate that there can only be one shipping address for particular customer, supplier
#----------------------
def validate_shipping_address(self):
if self.doc.is_shipping_address == 1:
if self.doc.customer:
sql("update tabAddress set is_shipping_address=0 where customer = '%s'" % (self.doc.customer))
elif self.doc.supplier:
sql("update tabAddress set is_shipping_address=0 where supplier = '%s'" % (self.doc.supplier))
elif self.doc.sales_partner:
sql("update tabAddress set is_shipping_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))
def validate_shipping_address(self):
sql = webnotes.conn.sql
if self.doc.is_shipping_address == 1:
if self.doc.customer:
sql("update tabAddress set is_shipping_address=0 where customer = '%s'" % (self.doc.customer))
elif self.doc.supplier:
sql("update tabAddress set is_shipping_address=0 where supplier = '%s'" % (self.doc.supplier))
elif self.doc.sales_partner:
sql("update tabAddress set is_shipping_address=0 where sales_partner = '%s'" % (self.doc.sales_partner))

View File

@ -3,6 +3,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
if(doc.customer) cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
if(doc.supplier) cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
}
/*
//---------- on refresh ----------------------
cur_frm.cscript.refresh = function(doc,cdt,cdn){

View File

@ -4,40 +4,49 @@ import webnotes
from webnotes.model.doc import Document
from webnotes import session, form, msgprint, errprint
sql = webnotes.conn.sql
# -----------------------------------------------------------------------------------------
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def autoname(self):
if self.doc.customer:
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.customer
elif self.doc.supplier:
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.supplier
elif self.doc.sales_partner:
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.sales_partner
# filter out bad characters in name
#self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','')
def autoname(self):
if self.doc.customer:
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.customer
elif self.doc.supplier:
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.supplier
elif self.doc.sales_partner:
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.sales_partner
# filter out bad characters in name
#self.doc.name = self.doc.name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','')
#----------------------
# Call to Validate
#----------------------
def validate(self):
self.validate_primary_contact()
def validate(self):
self.validate_primary_contact()
#----------------------
# Validate that there can only be one primary contact for particular customer, supplier
#----------------------
def validate_primary_contact(self):
if self.doc.is_primary_contact == 1:
if self.doc.customer:
sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
elif self.doc.supplier:
sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))
elif self.doc.sales_partner:
sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))
def validate_primary_contact(self):
sql = webnotes.conn.sql
if self.doc.is_primary_contact == 1:
if self.doc.customer:
sql("update tabContact set is_primary_contact=0 where customer = '%s'" % (self.doc.customer))
elif self.doc.supplier:
sql("update tabContact set is_primary_contact=0 where supplier = '%s'" % (self.doc.supplier))
elif self.doc.sales_partner:
sql("update tabContact set is_primary_contact=0 where sales_partner = '%s'" % (self.doc.sales_partner))
else:
if self.doc.customer:
if not sql("select name from tabContact where is_primary_contact=1 and customer = '%s'" % (self.doc.customer)):
self.doc.is_primary_contact = 1
elif self.doc.supplier:
if not sql("select name from tabContact where is_primary_contact=1 and supplier = '%s'" % (self.doc.supplier)):
self.doc.is_primary_contact = 1
elif self.doc.sales_partner:
if not sql("select name from tabContact where is_primary_contact=1 and sales_partner = '%s'" % (self.doc.sales_partner)):
self.doc.is_primary_contact = 1

View File

@ -5,14 +5,14 @@
{
'creation': '2010-08-08 17:08:55',
'docstatus': 0,
'modified': '2011-12-19 14:11:08',
'modified': '2012-01-23 16:07:56',
'modified_by': 'Administrator',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1316075905',
'_last_update': '1327314958',
'allow_trash': 1,
'colour': 'White:FFF',
'default_print_format': 'Standard',
@ -26,7 +26,7 @@
'server_code_error': ' ',
'show_in_menu': 0,
'subject': '%(first_name)s %(last_name)s - Email: %(email_id)s | Contact: %(phone)s | Mobile: %(mobile_no)s',
'version': 243
'version': 245
},
# These values are common for all DocField
@ -225,7 +225,7 @@
{
'colour': 'White:FFF',
'default': '0',
'depends_on': 'eval:(cint(doc.is_customer) || cint(doc.is_supplier) || cint(doc.is_sales_partner))',
'depends_on': 'eval:(doc.customer || doc.supplier || doc.sales_partner)',
'doctype': 'DocField',
'fieldname': 'is_primary_contact',
'fieldtype': 'Check',