diff --git a/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt b/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt index 096050d252..4673189ad3 100644 --- a/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt +++ b/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt @@ -3,11 +3,11 @@ # These values are common in all dictionaries { - 'creation': '2012-07-03 13:30:49', - 'docstatus': 0, - 'modified': '2012-07-12 14:08:27', - 'modified_by': u'Administrator', - 'owner': u'wasim@webnotestech.com' + u'creation': '2012-09-18 11:20:24', + u'docstatus': 0, + u'modified': '2012-09-28 12:19:57', + u'modified_by': u'Administrator', + u'owner': u'wasim@webnotestech.com' }, # These values are common for all DocType @@ -16,11 +16,11 @@ 'autoname': u'PVTD.######', 'colour': u'White:FFF', 'default_print_format': u'Standard', - 'doctype': 'DocType', + u'doctype': u'DocType', 'hide_heading': 1, 'istable': 1, 'module': u'Accounts', - 'name': '__common__', + u'name': u'__common__', 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, @@ -29,8 +29,8 @@ # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Purchase Taxes and Charges', 'parentfield': u'fields', 'parenttype': u'DocType' @@ -38,13 +38,13 @@ # DocType, Purchase Taxes and Charges { - 'doctype': 'DocType', - 'name': u'Purchase Taxes and Charges' + u'doctype': u'DocType', + u'name': u'Purchase Taxes and Charges' }, # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'charge_type', 'fieldtype': u'Select', 'label': u'Type', @@ -58,7 +58,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'account_head', 'fieldtype': u'Link', 'label': u'Account Head', @@ -72,7 +72,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'cost_center', 'fieldtype': u'Link', 'label': u'Cost Center', @@ -85,7 +85,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'description', 'fieldtype': u'Small Text', 'label': u'Description', @@ -98,7 +98,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'rate', 'fieldtype': u'Currency', 'label': u'Rate', @@ -111,7 +111,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'tax_amount', 'fieldtype': u'Currency', 'label': u'Amount', @@ -124,7 +124,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'total', 'fieldtype': u'Currency', 'label': u'Total', @@ -135,7 +135,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'row_id', 'fieldtype': u'Data', 'hidden': 0, @@ -149,8 +149,8 @@ # DocField { 'colour': u'White:FFF', - 'description': u'For Both', - 'doctype': u'DocField', + 'default': u'Valuation and Total', + u'doctype': u'DocField', 'fieldname': u'category', 'fieldtype': u'Select', 'label': u'Consider Tax or Charge for', @@ -165,7 +165,7 @@ { 'colour': u'White:FFF', 'default': u'Add', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'add_deduct_tax', 'fieldtype': u'Select', 'label': u'Add or Deduct', @@ -180,7 +180,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'item_wise_tax_detail', 'fieldtype': u'Small Text', 'hidden': 1, @@ -193,7 +193,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'parenttype', 'fieldtype': u'Data', 'hidden': 1, @@ -209,7 +209,7 @@ # DocField { 'description': u'Cheating Field\nPlease do not delete ', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'total_tax_amount', 'fieldtype': u'Currency', 'hidden': 1, @@ -225,7 +225,7 @@ # DocField { 'description': u'Cheating Field\nPlease do not delete ', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'total_amount', 'fieldtype': u'Currency', 'hidden': 1, diff --git a/erpnext/patches/september_2012/rebuild_trees.py b/erpnext/patches/september_2012/rebuild_trees.py new file mode 100644 index 0000000000..8340df76ad --- /dev/null +++ b/erpnext/patches/september_2012/rebuild_trees.py @@ -0,0 +1,9 @@ +def execute(): + from webnotes.utils.nestedset import rebuild_tree + + rebuild_tree("Item Group", "parent_item_group") + rebuild_tree("Customer Group", "parent_customer_group") + rebuild_tree("Territory", "parent_territory") + rebuild_tree("Account", "parent_account") + rebuild_tree("Cost Center", "parent_cost_center") + rebuild_tree("Sales Person", "parent_sales_person") \ No newline at end of file diff --git a/patches/patch_list.py b/patches/patch_list.py index e14be4b814..92e48a0bcd 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -600,4 +600,8 @@ patch_list = [ 'patch_module': 'patches.september_2012', 'patch_file': 'reload_gross_profit', }, + { + 'patch_module': 'patches.september_2012', + 'patch_file': 'rebuild_trees', + }, ] diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py index 4f197fa921..d0a715d204 100644 --- a/selling/doctype/lead/lead.py +++ b/selling/doctype/lead/lead.py @@ -83,7 +83,7 @@ class DocType: def on_update(self): - if self.doc.contact_by: + if self.doc.contact_date: self.add_calendar_event() if not self.doc.naming_series: @@ -104,44 +104,19 @@ class DocType: # delete any earlier event by this lead sql("delete from tabEvent where ref_type='Lead' and ref_name=%s", self.doc.name) - in_calendar_of = self.doc.lead_owner - - # get profile (id) if exists for contact_by - email_id = webnotes.conn.get_value('Sales Person', self.doc.contact_by, 'email_id') - if webnotes.conn.exists('Profile', email_id): - in_calendar_of = email_id - + # create new event ev = Document('Event') - ev.owner = in_calendar_of - ev.description = 'Contact ' + cstr(self.doc.lead_name) + '.By : ' + cstr(self.doc.contact_by) + '.To Discuss : ' + cstr(self.doc.remark) + ev.owner = self.doc.lead_owner + ev.description = ('Contact ' + cstr(self.doc.lead_name)) + \ + (self.doc.contact_by and ('. By : ' + cstr(self.doc.contact_by)) or '') + \ + (self.doc.remark and ('.To Discuss : ' + cstr(self.doc.remark)) or '') ev.event_date = self.doc.contact_date ev.event_hour = '10:00' ev.event_type = 'Private' ev.ref_type = 'Lead' ev.ref_name = self.doc.name ev.save(1) - - def add_in_follow_up(self,message,type): - import datetime - child = addchild( self.doc, 'follow_up', 'Communication Log', 1, self.doclist) - child.date = datetime.datetime.now().date().strftime('%Y-%m-%d') - child.notes = message - child.follow_up_type = type - child.save() - -#-------------------SMS---------------------------------------------- - def send_sms(self): - if not self.doc.sms_message or not self.doc.mobile_no: - msgprint("Please enter mobile number in Basic Info Section and message in SMS Section ") - raise Exception - else: - receiver_list = [] - if self.doc.mobile_no: - receiver_list.append(self.doc.mobile_no) - for d in getlist(self.doclist,'lead_sms_detail'): - if d.other_mobile_no: - receiver_list.append(d.other_mobile_no) - if receiver_list: - msgprint(get_obj('SMS Control', 'SMS Control').send_sms(receiver_list, self.doc.sms_message)) - # self.add_in_follow_up(self.doc.sms_message,'SMS') + event_user = addchild(ev, 'event_individuals', 'Event User') + event_user.person = self.doc.contact_by + event_user.save() diff --git a/selling/doctype/sales_order/sales_order.txt b/selling/doctype/sales_order/sales_order.txt index bdb61263f1..8d6b8a8e3f 100644 --- a/selling/doctype/sales_order/sales_order.txt +++ b/selling/doctype/sales_order/sales_order.txt @@ -3,11 +3,11 @@ # These values are common in all dictionaries { - 'creation': '2012-07-11 11:54:24', - 'docstatus': 0, - 'modified': '2012-07-16 16:24:26', - 'modified_by': u'Administrator', - 'owner': u'Administrator' + u'creation': '2012-09-18 11:20:27', + u'docstatus': 0, + u'modified': '2012-09-26 13:05:15', + u'modified_by': u'Administrator', + u'owner': u'Administrator' }, # These values are common for all DocType @@ -16,13 +16,13 @@ 'allow_attach': 1, 'colour': u'White:FFF', 'default_print_format': u'Standard', - 'doctype': 'DocType', + u'doctype': u'DocType', 'document_type': u'Transaction', 'is_submittable': 1, 'is_transaction_doc': 1, 'issingle': 0, 'module': u'Selling', - 'name': '__common__', + u'name': u'__common__', 'read_only_onload': 1, 'search_fields': u'status,transaction_date,customer,customer_name, territory,order_type,company', 'section_style': u'Tabbed', @@ -35,8 +35,8 @@ # These values are common for all DocField { - 'doctype': u'DocField', - 'name': '__common__', + u'doctype': u'DocField', + u'name': u'__common__', 'parent': u'Sales Order', 'parentfield': u'fields', 'parenttype': u'DocType' @@ -44,24 +44,23 @@ # These values are common for all DocPerm { - 'doctype': u'DocPerm', - 'name': '__common__', + u'doctype': u'DocPerm', + u'name': u'__common__', 'parent': u'Sales Order', 'parentfield': u'permissions', - 'parenttype': u'DocType', - 'read': 1 + 'parenttype': u'DocType' }, # DocType, Sales Order { - 'doctype': 'DocType', - 'name': u'Sales Order' + u'doctype': u'DocType', + u'name': u'Sales Order' }, # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'basic_info', 'fieldtype': u'Section Break', 'label': u'Basic Info', @@ -72,7 +71,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break0', 'fieldtype': u'Column Break', 'in_filter': 0, @@ -86,7 +85,7 @@ { 'colour': u'White:FFF', 'description': u'To manage multiple series please go to Setup > Manage Series', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'naming_series', 'fieldtype': u'Select', 'label': u'Series', @@ -103,7 +102,7 @@ { 'colour': u'White:FFF', 'description': u'Select Customer', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'customer', 'fieldtype': u'Link', 'in_filter': 1, @@ -120,7 +119,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'customer_name', 'fieldtype': u'Data', 'hidden': 1, @@ -130,7 +129,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'address_display', 'fieldtype': u'Small Text', 'hidden': 1, @@ -140,7 +139,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_display', 'fieldtype': u'Small Text', 'hidden': 1, @@ -150,7 +149,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_mobile', 'fieldtype': u'Text', 'hidden': 1, @@ -160,7 +159,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_email', 'fieldtype': u'Text', 'hidden': 1, @@ -173,7 +172,7 @@ { 'colour': u'White:FFF', 'default': u'Sales', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'order_type', 'fieldtype': u'Select', 'label': u'Order Type', @@ -187,7 +186,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break1', 'fieldtype': u'Column Break', 'oldfieldtype': u'Column Break', @@ -199,7 +198,7 @@ { 'default': u'Today', 'description': u'The date at which current entry is made in system.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'transaction_date', 'fieldtype': u'Date', 'in_filter': 1, @@ -218,7 +217,7 @@ { 'colour': u'White:FFF', 'depends_on': u"eval:doc.order_type == 'Sales'", - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'delivery_date', 'fieldtype': u'Date', 'hidden': 0, @@ -237,7 +236,7 @@ { 'colour': u'White:FFF', 'description': u'Purchase Order sent by customer', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'po_no', 'fieldtype': u'Data', 'hidden': 0, @@ -254,7 +253,7 @@ { 'colour': u'White:FFF', 'depends_on': u'eval:doc.po_no', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'po_date', 'fieldtype': u'Date', 'hidden': 0, @@ -269,7 +268,8 @@ # DocField { - 'doctype': u'DocField', + 'colour': u'White:FFF', + u'doctype': u'DocField', 'fieldname': u'shipping_address_name', 'fieldtype': u'Data', 'hidden': 1, @@ -282,9 +282,11 @@ # DocField { - 'doctype': u'DocField', + 'colour': u'White:FFF', + u'doctype': u'DocField', 'fieldname': u'shipping_address', 'fieldtype': u'Small Text', + 'hidden': 1, 'in_filter': 0, 'label': u'Shipping Address', 'permlevel': 1, @@ -294,7 +296,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'items', 'fieldtype': u'Section Break', 'label': u'Items', @@ -306,7 +308,7 @@ { 'allow_on_submit': 1, 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'sales_order_details', 'fieldtype': u'Table', 'label': u'Sales Order Items', @@ -319,7 +321,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'section_break0', 'fieldtype': u'Section Break', 'permlevel': 0 @@ -327,7 +329,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'col_break20', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -336,7 +338,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'net_total', 'fieldtype': u'Currency', 'label': u'Net Total*', @@ -350,7 +352,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'recalculate_values', 'fieldtype': u'Button', 'label': u'Re-Calculate Values', @@ -363,7 +365,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'col_break_21', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -374,7 +376,7 @@ { 'colour': u'White:FFF', 'description': u'Quotation no against which this Sales Order is made ', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'quotation_no', 'fieldtype': u'Link', 'in_filter': 1, @@ -394,7 +396,7 @@ { 'colour': u'White:FFF', 'depends_on': u'eval:doc.quotation_no', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'quotation_date', 'fieldtype': u'Date', 'hidden': 1, @@ -410,7 +412,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'pull_quotation_details', 'fieldtype': u'Button', 'label': u'Pull Quotation Items', @@ -422,7 +424,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'sec_break45', 'fieldtype': u'Section Break', 'label': u'Price List and Currency', @@ -433,7 +435,7 @@ { 'colour': u'White:FFF', 'description': u'Select the price list as entered in "Price List" master. This will pull the reference rates of items against this price list as specified in "Item" master.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'price_list_name', 'fieldtype': u'Select', 'label': u'Price List', @@ -450,7 +452,7 @@ # DocField { 'description': u'Select the currency in which price list is maintained', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'price_list_currency', 'fieldtype': u'Select', 'label': u'Price List Currency', @@ -464,7 +466,7 @@ { 'colour': u'White:FFF', 'description': u"Rate at which Price list currency is converted to company's base currency", - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'plc_conversion_rate', 'fieldtype': u'Float', 'label': u'Price List Currency Conversion Rate', @@ -475,7 +477,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break2', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -486,7 +488,7 @@ { 'colour': u'White:FFF', 'description': u"Customer's currency", - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'currency', 'fieldtype': u'Select', 'label': u'Currency', @@ -504,7 +506,7 @@ 'colour': u'White:FFF', 'default': u'1.00', 'description': u"Rate at which customer's currency is converted to company's base currency", - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'conversion_rate', 'fieldtype': u'Float', 'label': u'Conversion Rate', @@ -520,7 +522,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'taxes', 'fieldtype': u'Section Break', 'label': u'Taxes', @@ -531,7 +533,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'charge', 'fieldtype': u'Link', 'label': u'Sales Taxes and Charges', @@ -544,7 +546,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'get_charges', 'fieldtype': u'Button', 'label': u'Get Taxes and Charges', @@ -555,7 +557,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'other_charges', 'fieldtype': u'Table', 'label': u'Sales Taxes and Charges', @@ -567,7 +569,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'calculate_charges', 'fieldtype': u'Button', 'label': u'Calculate Taxes and Charges', @@ -579,7 +581,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'other_charges_total', 'fieldtype': u'Currency', 'label': u'Taxes and Charges Total*', @@ -592,7 +594,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'other_charges_calculation', 'fieldtype': u'HTML', 'label': u'Taxes and Charges Calculation', @@ -604,7 +606,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'totals', 'fieldtype': u'Section Break', 'label': u'Totals', @@ -615,7 +617,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'grand_total', 'fieldtype': u'Currency', 'label': u'Grand Total*', @@ -629,7 +631,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'rounded_total', 'fieldtype': u'Currency', 'label': u'Rounded Total', @@ -644,7 +646,7 @@ { 'colour': u'White:FFF', 'description': u'In Words will be visible once you save the Sales Order.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'in_words', 'fieldtype': u'Data', 'label': u'In Words', @@ -657,7 +659,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break3', 'fieldtype': u'Column Break', 'oldfieldtype': u'Column Break', @@ -668,7 +670,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'grand_total_export', 'fieldtype': u'Currency', 'label': u'Grand Total (Export)', @@ -682,7 +684,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'rounded_total_export', 'fieldtype': u'Currency', 'label': u'Rounded Total (Export)', @@ -696,7 +698,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'in_words_export', 'fieldtype': u'Data', 'label': u'In Words (Export)', @@ -710,7 +712,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'terms_section_break', 'fieldtype': u'Section Break', 'label': u'Terms and Conditions', @@ -721,7 +723,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'tc_name', 'fieldtype': u'Link', 'label': u'Select Terms and Conditions', @@ -735,7 +737,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'get_terms', 'fieldtype': u'Button', 'label': u'Get Terms and Conditions', @@ -747,7 +749,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'terms_html', 'fieldtype': u'HTML', 'label': u'Terms and Conditions HTML', @@ -759,7 +761,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'terms', 'fieldtype': u'Text Editor', 'label': u'Terms and Conditions Details', @@ -771,7 +773,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_info', 'fieldtype': u'Section Break', 'label': u'Contact Info', @@ -780,7 +782,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'col_break45', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -789,7 +791,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'customer_address', 'fieldtype': u'Link', 'hidden': 0, @@ -802,7 +804,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'contact_person', 'fieldtype': u'Link', 'in_filter': 1, @@ -814,7 +816,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'territory', 'fieldtype': u'Link', 'in_filter': 1, @@ -828,7 +830,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'col_break46', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -839,7 +841,7 @@ { 'colour': u'White:FFF', 'description': u'Category of customer as entered in Customer master', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'customer_group', 'fieldtype': u'Link', 'in_filter': 1, @@ -855,7 +857,7 @@ { 'colour': u'White:FFF', 'description': u'Filling in additional information about the Sales Order will help you analyze your data better.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'more_info', 'fieldtype': u'Section Break', 'label': u'More Info', @@ -866,7 +868,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break4', 'fieldtype': u'Column Break', 'oldfieldtype': u'Column Break', @@ -878,7 +880,7 @@ # DocField { 'allow_on_submit': 1, - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'letter_head', 'fieldtype': u'Select', 'label': u'Letter Head', @@ -893,7 +895,7 @@ { 'allow_on_submit': 1, 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'select_print_heading', 'fieldtype': u'Link', 'label': u'Select Print Heading', @@ -910,7 +912,7 @@ { 'colour': u'White:FFF', 'depends_on': u"eval:doc.source == 'Campaign'", - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'campaign', 'fieldtype': u'Link', 'label': u'Campaign', @@ -923,7 +925,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'amended_from', 'fieldtype': u'Data', 'hidden': 1, @@ -940,7 +942,7 @@ { 'colour': u'White:FFF', 'description': u'The date at which current entry is corrected in the system.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'amendment_date', 'fieldtype': u'Date', 'hidden': 1, @@ -957,7 +959,7 @@ { 'colour': u'White:FFF', 'description': u'Select the relevant company name if you have multiple companies.', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'company', 'fieldtype': u'Link', 'in_filter': 1, @@ -975,7 +977,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'fiscal_year', 'fieldtype': u'Select', 'in_filter': 1, @@ -994,7 +996,7 @@ { 'colour': u'White:FFF', 'depends_on': u'eval:!doc.__islocal', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'cancel_reason', 'fieldtype': u'Data', 'label': u'Cancel Reason', @@ -1008,7 +1010,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break5', 'fieldtype': u'Column Break', 'oldfieldtype': u'Column Break', @@ -1020,7 +1022,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'source', 'fieldtype': u'Select', 'label': u'Source', @@ -1035,7 +1037,7 @@ { 'colour': u'White:FFF', 'description': u'Track this Sales Order against any Project', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'project_name', 'fieldtype': u'Link', 'in_filter': 1, @@ -1051,7 +1053,7 @@ # DocField { 'default': u'Draft', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'status', 'fieldtype': u'Select', 'in_filter': 1, @@ -1072,7 +1074,7 @@ 'colour': u'White:FFF', 'depends_on': u'eval:!doc.__islocal', 'description': u'% of materials delivered against this Sales Order', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'per_delivered', 'fieldtype': u'Currency', 'in_filter': 1, @@ -1090,7 +1092,7 @@ 'colour': u'White:FFF', 'depends_on': u'eval:!doc.__islocal', 'description': u'% of materials billed against this Sales Order', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'per_billed', 'fieldtype': u'Currency', 'in_filter': 1, @@ -1105,7 +1107,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'delivery_status', 'fieldtype': u'Select', 'hidden': 1, @@ -1119,7 +1121,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'billing_status', 'fieldtype': u'Select', 'hidden': 1, @@ -1135,7 +1137,7 @@ { 'colour': u'White:FFF', 'description': u'Display all the individual items delivered with the main items', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'packing_list', 'fieldtype': u'Section Break', 'hidden': 0, @@ -1148,7 +1150,7 @@ # DocField { 'colour': u'White:FFF', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'packing_details', 'fieldtype': u'Table', 'label': u'Packing Details', @@ -1161,7 +1163,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'sales_team_section_break', 'fieldtype': u'Section Break', 'label': u'Sales Team', @@ -1172,7 +1174,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break6', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -1184,7 +1186,7 @@ { 'colour': u'White:FFF', 'description': u'Name as entered in Sales Partner master', - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'sales_partner', 'fieldtype': u'Link', 'in_filter': 1, @@ -1201,7 +1203,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'column_break7', 'fieldtype': u'Column Break', 'permlevel': 0, @@ -1211,7 +1213,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'commission_rate', 'fieldtype': u'Currency', 'label': u'Commission Rate', @@ -1225,7 +1227,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'total_commission', 'fieldtype': u'Currency', 'label': u'Total Commission', @@ -1238,7 +1240,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'section_break1', 'fieldtype': u'Section Break', 'options': u'Simple', @@ -1248,7 +1250,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'sales_team', 'fieldtype': u'Table', 'label': u'Sales Team1', @@ -1261,7 +1263,7 @@ # DocField { - 'doctype': u'DocField', + u'doctype': u'DocField', 'fieldname': u'file_list', 'fieldtype': u'Text', 'hidden': 1, @@ -1271,13 +1273,21 @@ 'print_hide': 1 }, + # DocPerm + { + u'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Production Manager' + }, + # DocPerm { 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'permlevel': 1, + 'read': 1, 'role': u'Sales Manager', 'submit': 0, 'write': 0 @@ -1288,8 +1298,9 @@ 'amend': 1, 'cancel': 1, 'create': 1, - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'permlevel': 0, + 'read': 1, 'role': u'Sales Manager', 'submit': 1, 'write': 1 @@ -1300,8 +1311,9 @@ 'amend': 1, 'cancel': 1, 'create': 1, - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'permlevel': 0, + 'read': 1, 'role': u'Sales User', 'submit': 1, 'write': 1 @@ -1312,8 +1324,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'permlevel': 1, + 'read': 1, 'role': u'Sales User', 'submit': 0, 'write': 0 @@ -1321,16 +1334,18 @@ # DocPerm { - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'match': u'customer_name', 'permlevel': 0, + 'read': 1, 'role': u'Customer' }, # DocPerm { - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'permlevel': 2, + 'read': 1, 'role': u'Accounts User', 'write': 1 }, @@ -1340,8 +1355,9 @@ 'amend': 1, 'cancel': 1, 'create': 1, - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'permlevel': 0, + 'read': 1, 'role': u'Maintenance Manager', 'submit': 1, 'write': 1 @@ -1349,8 +1365,9 @@ # DocPerm { - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'permlevel': 1, + 'read': 1, 'role': u'Maintenance Manager' }, @@ -1359,8 +1376,9 @@ 'amend': 1, 'cancel': 1, 'create': 1, - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'permlevel': 0, + 'read': 1, 'role': u'Maintenance User', 'submit': 1, 'write': 1 @@ -1368,8 +1386,9 @@ # DocPerm { - 'doctype': u'DocPerm', + u'doctype': u'DocPerm', 'permlevel': 1, + 'read': 1, 'role': u'Maintenance User' } ] \ No newline at end of file diff --git a/setup/doctype/global_defaults/global_defaults.py b/setup/doctype/global_defaults/global_defaults.py index b4b2381938..26590fea70 100644 --- a/setup/doctype/global_defaults/global_defaults.py +++ b/setup/doctype/global_defaults/global_defaults.py @@ -42,14 +42,7 @@ keydict = { class DocType: def __init__(self, d, dl): - self.doc, self.doclist = d, dl - - def get_bal(self,arg): - """get account balance (??)""" - from webnotes.utils import fmt_money, flt - bal = webnotes.conn.sql("select `tabAccount Balance`.balance,`tabAccount`.debit_or_credit from `tabAccount`,`tabAccount Balance` where `tabAccount Balance`.account=%s and `tabAccount Balance`.period=%s and `tabAccount Balance`.account=`tabAccount`.name ",(arg,self.doc.current_fiscal_year)) - if bal: - return fmt_money(flt(bal[0][0])) + ' ' + bal[0][1] + self.doc, self.doclist = d, dl def on_update(self): """update defaults""" diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.py b/stock/doctype/stock_reconciliation/stock_reconciliation.py index 5416ff80d2..4e701d3c26 100644 --- a/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -111,8 +111,6 @@ class DocType: if self.doc.file_list: self.get_reconciliation_data() - - def get_system_stock(self, it, wh): """get actual qty on reconciliation date and time as per system""" bin = sql("select name from tabBin where item_code=%s and warehouse=%s", (it, wh)) @@ -123,10 +121,9 @@ class DocType: 'val_rate' : prev_sle.get('valuation_rate', 0) } - - def get_incoming_rate(self, row, qty_diff, sys_stock, is_submit): + def get_incoming_rate(self, row, qty_diff, sys_stock): """Calculate incoming rate to maintain valuation rate""" - if qty_diff and is_submit: + if qty_diff: if self.val_method == 'Moving Average': in_rate = flt(row[3]) + (flt(sys_stock['actual_qty'])*(flt(row[3]) - flt(sys_stock['val_rate'])))/ flt(qty_diff) elif not sys_stock and not row[3]: @@ -138,10 +135,9 @@ class DocType: return in_rate - - def make_sl_entry(self, is_submit, row, qty_diff, sys_stock): + def make_sl_entry(self, row, qty_diff, sys_stock): """Make stock ledger entry""" - in_rate = self.get_incoming_rate(row, qty_diff, sys_stock, is_submit) + in_rate = self.get_incoming_rate(row, qty_diff, sys_stock) values = [{ 'item_code' : row[0], 'warehouse' : row[1], @@ -151,27 +147,24 @@ class DocType: 'voucher_type' : self.doc.doctype, 'voucher_no' : self.doc.name, 'voucher_detail_no' : self.doc.name, - 'actual_qty' : flt(is_submit) * flt(qty_diff), + 'actual_qty' : flt(qty_diff), 'stock_uom' : sys_stock['stock_uom'], 'incoming_rate' : in_rate, 'company' : get_defaults()['company'], 'fiscal_year' : get_defaults()['fiscal_year'], - 'is_cancelled' : (is_submit==1) and 'No' or 'Yes', + 'is_cancelled' : 'No', 'batch_no' : '', 'serial_no' : '' }] get_obj('Stock Ledger', 'Stock Ledger').update_stock(values) - - - def make_entry_for_valuation(self, row, sys_stock, is_submit): - self.make_sl_entry(is_submit, row, 1, sys_stock) + def make_entry_for_valuation(self, row, sys_stock): + self.make_sl_entry(row, 1, sys_stock) sys_stock['val_rate'] = row[3] sys_stock['actual_qty'] += 1 - self.make_sl_entry(is_submit, row, -1, sys_stock) + self.make_sl_entry(row, -1, sys_stock) - - def do_stock_reco(self, is_submit = 1): + def do_stock_reco(self): """ Make stock entry of qty diff, calculate incoming rate to maintain valuation rate. If no qty diff, but diff in valuation rate, make (+1,-1) entry to update valuation @@ -187,19 +180,18 @@ class DocType: # Make sl entry if qty_diff: - self.make_sl_entry(is_submit, row, qty_diff, sys_stock) + self.make_sl_entry(row, qty_diff, sys_stock) sys_stock['actual_qty'] += qty_diff if (not qty_diff and rate_diff) or qty_diff < 0 and self.val_method == 'Moving Average': - self.make_entry_for_valuation(row, sys_stock, is_submit) + self.make_entry_for_valuation(row, sys_stock) - if is_submit == 1: - r = [cstr(i) for i in row] + [cstr(qty_diff), cstr(rate_diff)] - self.store_diff_info(r) + + r = [cstr(i) for i in row] + [cstr(qty_diff), cstr(rate_diff)] + self.store_diff_info(r) msgprint("Stock Reconciliation Completed Successfully...") - def store_diff_info(self, r): """Add diffs column in attached file""" @@ -222,11 +214,25 @@ class DocType: if not self.doc.file_list: msgprint("Please attach file before submitting.", raise_exception=1) else: - self.do_stock_reco(is_submit = 1) + self.do_stock_reco() def on_cancel(self): - msgprint("Cancellation of stock reconciliation is temporarily suspended. The feature will come back soon.") - raise Exception + self.cancel_stock_ledger_entries() + self.update_entries_after() + + def cancel_stock_ledger_entries(self): + webnotes.conn.sql(""" + update `tabStock Ledger Entry` + set is_cancelled = 'Yes' + where voucher_type = 'Stock Reconciliation' and voucher_no = %s + """, self.doc.name) + + def update_entries_after(self): self.get_reconciliation_data(submit = 0) - self.do_stock_reco(is_submit = -1) \ No newline at end of file + from webnotes.model.code import get_obj + for d in self.data: + bin = webnotes.conn.sql("select name from `tabBin` where item_code = %s and \ + warehouse = %s", (d[0], d[1])) + get_obj('Bin', bin[0][0]).update_entries_after(self.doc.reconciliation_date, \ + self.doc.reconciliation_time) \ No newline at end of file diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 0e10eeacb0..75f41414ed 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -83,7 +83,7 @@ class TransactionBase: cond = 'name="%s"' % address_name if is_shipping_address: - details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1) + details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc, is_primary_address desc limit 1" % cond, as_dict = 1) else: details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1) @@ -146,7 +146,7 @@ class TransactionBase: # Get Customer Shipping Address # ----------------------- def get_shipping_address(self, name): - details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where customer = '%s' and docstatus != 2 order by is_shipping_address desc limit 1" %(name), as_dict = 1) + details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where customer = '%s' and docstatus != 2 order by is_shipping_address desc, is_primary_address desc limit 1" %(name), as_dict = 1) extract = lambda x: details and details[0] and details[0].get(x,'') or '' address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone')]