mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-16 03:29:16 +00:00
restructured erpnext and deleted unwanted
This commit is contained in:
File diff suppressed because one or more lines are too long
331
buying/DocType Mapper/Sales Order-Indent/Sales Order-Indent.txt
Executable file
331
buying/DocType Mapper/Sales Order-Indent/Sales Order-Indent.txt
Executable file
@@ -0,0 +1,331 @@
|
||||
[
|
||||
{
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'DocType Mapper',
|
||||
'from_doctype': 'Sales Order',
|
||||
'idx': None,
|
||||
'modified': '2011-05-04 14:49:55',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'Mapper',
|
||||
'name': 'Sales Order-Indent',
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'ref_doc_submitted': 1,
|
||||
'to_doctype': 'Indent'
|
||||
},
|
||||
{
|
||||
'checking_operator': '>=',
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'transaction_date',
|
||||
'idx': 1,
|
||||
'map': 'No',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000724',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'transaction_date'
|
||||
},
|
||||
{
|
||||
'checking_operator': '=',
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'company',
|
||||
'idx': 2,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000725',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'company'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'fiscal_year',
|
||||
'idx': 3,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000726',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'fiscal_year'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'tc_name',
|
||||
'idx': 4,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000727',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'tc_name'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'terms',
|
||||
'idx': 5,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000728',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'terms'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'letter_head',
|
||||
'idx': 6,
|
||||
'map': 'Yes',
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000729',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'letter_head'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'parent',
|
||||
'idx': 7,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000730',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'sales_order_no'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'item_code',
|
||||
'idx': 8,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000731',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'item_code'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'item_name',
|
||||
'idx': 9,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000732',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'item_name'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'description',
|
||||
'idx': 10,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000733',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'description'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'item_group',
|
||||
'idx': 11,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000734',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'item_group'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'stock_uom',
|
||||
'idx': 12,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000735',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'uom'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'qty',
|
||||
'idx': 13,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000736',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'qty'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'reserved_warehouse',
|
||||
'idx': 14,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000737',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'warehouse'
|
||||
},
|
||||
{
|
||||
'checking_operator': None,
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Field Mapper Detail',
|
||||
'from_field': 'brand',
|
||||
'idx': 15,
|
||||
'map': 'Yes',
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000738',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'field_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'to_field': 'brand'
|
||||
},
|
||||
{
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': 'sales_order_details',
|
||||
'from_table': 'Sales Order Detail',
|
||||
'idx': 1,
|
||||
'match_id': 1,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000739',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'reference_doctype_key': 'prevdoc_doctype',
|
||||
'reference_key': 'prevdoc_detail_docname',
|
||||
'to_field': 'indent_details',
|
||||
'to_table': 'Indent Detail',
|
||||
'validation_logic': 'qty > ifnull(indented_qty,0) and docstatus = 1'
|
||||
},
|
||||
{
|
||||
'creation': '2011-05-09 16:46:12',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Table Mapper Detail',
|
||||
'from_field': None,
|
||||
'from_table': 'Sales Order',
|
||||
'idx': 2,
|
||||
'match_id': 0,
|
||||
'modified': '2011-05-09 16:46:12',
|
||||
'modified_by': 'Administrator',
|
||||
'name': '000000740',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Sales Order-Indent',
|
||||
'parentfield': 'table_mapper_details',
|
||||
'parenttype': 'DocType Mapper',
|
||||
'reference_doctype_key': None,
|
||||
'reference_key': 'prevdoc_docname',
|
||||
'to_field': None,
|
||||
'to_table': 'Indent',
|
||||
'validation_logic': 'docstatus = 1'
|
||||
}
|
||||
]
|
||||
274
buying/Module Def/Buying/Buying.txt
Normal file
274
buying/Module Def/Buying/Buying.txt
Normal file
@@ -0,0 +1,274 @@
|
||||
[
|
||||
{
|
||||
'_last_update': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'disabled': 'No',
|
||||
'docstatus': 0,
|
||||
'doctype': u'Module Def',
|
||||
'doctype_list': 'DocType Mapper, Purchase Receipt-Payable Voucher\nDocType Mapper, Purchase Order-Payable Voucher\nDocType Mapper, Purchase Order-Purchase Receipt\nDocType Mapper, Indent-Purchase Order\nPrint Format, Purchase Order Format\nPrint Format, Purchase Receipt Format',
|
||||
'file_list': 'scm.gif,FileData/00209',
|
||||
'idx': None,
|
||||
'is_hidden': 'No',
|
||||
'last_updated_date': None,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'module_desc': '<p>All details about your Suppliers and past transactions</p>',
|
||||
'module_icon': 'Buying.gif',
|
||||
'module_label': 'Buying',
|
||||
'module_name': 'Buying',
|
||||
'module_page': None,
|
||||
'module_seq': 4,
|
||||
'name': 'Buying',
|
||||
'owner': 'Administrator',
|
||||
'parent': None,
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'trash_reason': None,
|
||||
'widget_code': None
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'description': 'Your Supplier Database',
|
||||
'display_name': 'Supplier',
|
||||
'doc_name': 'Supplier',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'id\nsupplier_type\nsupplier_status\ncompany',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 1,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01312',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'description': 'Buy requests from various people in your company',
|
||||
'display_name': 'Indent',
|
||||
'doc_name': 'Indent',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\ntransaction_date\nsales_order_no\nremark',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 2,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01313',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'description': 'Orders you have placed to your suppliers',
|
||||
'display_name': 'Purchase Order',
|
||||
'doc_name': 'Purchase Order',
|
||||
'doc_type': 'Forms',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': 'status\nsupplier\ntransaction_date\ngrand_total',
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 3,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01314',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'description': None,
|
||||
'display_name': 'Itemwise Receipt Details',
|
||||
'doc_name': 'Purchase Receipt Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 4,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01315',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'description': None,
|
||||
'display_name': 'Purchase in Transit',
|
||||
'doc_name': 'PV Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 5,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01316',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'description': None,
|
||||
'display_name': 'Pending PO Items To Receive',
|
||||
'doc_name': 'PO Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 6,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01317',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'description': None,
|
||||
'display_name': 'Pending PO Items To Bill',
|
||||
'doc_name': 'PO Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 7,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01318',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'description': None,
|
||||
'display_name': 'Itemwise Purchase Details',
|
||||
'doc_name': 'PO Detail',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': None,
|
||||
'idx': 8,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01319',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'click_function': None,
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'description': 'Ledger details of your creditors',
|
||||
'display_name': "Creditor's Ledger",
|
||||
'doc_name': 'GL Entry',
|
||||
'doc_type': 'Reports',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Item',
|
||||
'fields': None,
|
||||
'hide': None,
|
||||
'icon': 'accept.gif',
|
||||
'idx': 9,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDI01320',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'items',
|
||||
'parenttype': 'Module Def'
|
||||
},
|
||||
{
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 1,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00332',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Purchase User'
|
||||
},
|
||||
{
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 2,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00333',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Purchase Manager'
|
||||
},
|
||||
{
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 3,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00334',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Administrator'
|
||||
},
|
||||
{
|
||||
'creation': '2011-06-30 15:47:45',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Module Def Role',
|
||||
'idx': 4,
|
||||
'modified': '2011-06-30 15:47:45',
|
||||
'modified_by': 'Administrator',
|
||||
'name': 'MDR00335',
|
||||
'owner': 'Administrator',
|
||||
'parent': 'Buying',
|
||||
'parentfield': 'roles',
|
||||
'parenttype': 'Module Def',
|
||||
'role': 'Purchase Master Manager'
|
||||
}
|
||||
]
|
||||
1
buying/Role/Purchase Manager/Purchase Manager.txt
Normal file
1
buying/Role/Purchase Manager/Purchase Manager.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'Administrator', 'name': 'Purchase Manager', 'parent': None, 'creation': '2010-04-08 12:07:53', 'modified': '2010-04-08 12:07:53', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Purchase Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
|
||||
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'Administrator', 'name': 'Purchase Master Manager', 'parent': None, 'creation': '2010-04-08 13:50:20', 'modified': '2010-04-08 13:50:20', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Purchase Master Manager', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
|
||||
1
buying/Role/Purchase User/Purchase User.txt
Normal file
1
buying/Role/Purchase User/Purchase User.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'Administrator', 'name': 'Purchase User', 'parent': None, 'creation': '2010-04-08 12:08:01', 'modified': '2010-04-08 12:08:01', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Purchase User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
|
||||
1
buying/Role/Supplier/Supplier.txt
Normal file
1
buying/Role/Supplier/Supplier.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'modified_by': 'Administrator', 'name': 'Supplier', 'parent': None, 'creation': '2009-06-26 14:42:19', 'modified': '2009-06-26 14:42:19', 'module': 'Roles', 'doctype': 'Role', 'idx': None, 'parenttype': None, 'role_name': 'Supplier', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': None}]
|
||||
0
buying/__init__.py
Normal file
0
buying/__init__.py
Normal file
0
buying/doctype/__init__.py
Normal file
0
buying/doctype/__init__.py
Normal file
0
buying/doctype/indent/__init__.py
Normal file
0
buying/doctype/indent/__init__.py
Normal file
121
buying/doctype/indent/indent.js
Normal file
121
buying/doctype/indent/indent.js
Normal file
@@ -0,0 +1,121 @@
|
||||
cur_frm.cscript.tname = "Indent Detail";
|
||||
cur_frm.cscript.fname = "indent_details";
|
||||
|
||||
$import(Purchase Common)
|
||||
$import(SMS Control)
|
||||
//========================== On Load =================================================
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date())
|
||||
if (!doc.status) doc.status = 'Draft';
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
// second call
|
||||
if(doc.__islocal){
|
||||
cur_frm.cscript.get_item_defaults(doc);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.get_item_defaults = function(doc) {
|
||||
var ch = getchildren( 'Indent Detail', doc.name, 'indent_details');
|
||||
if (flt(ch.length) > 0){
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_item_defaults', '', function(r, rt) {refresh_field('indent_details'); });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//======================= Refresh =====================================
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
// Unhide Fields in Next Steps
|
||||
// ---------------------------------
|
||||
|
||||
cur_frm.clear_custom_buttons();
|
||||
|
||||
if(doc.docstatus == 1 && doc.status != 'Stopped'){
|
||||
var ch = getchildren('Indent Detail',doc.name,'indent_details');
|
||||
var is_closed = 1;
|
||||
for(var i in ch){
|
||||
if(flt(ch[i].qty) > flt(ch[i].ordered_qty)) is_closed = 0;
|
||||
}
|
||||
if(!is_closed) {
|
||||
cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order'])
|
||||
cur_frm.add_custom_button('Stop Indent', cur_frm.cscript['Stop Indent'])
|
||||
}
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
||||
}
|
||||
|
||||
if(doc.docstatus == 1 && doc.status == 'Stopped')
|
||||
cur_frm.add_custom_button('Unstop Indent', cur_frm.cscript['Unstop Indent'])
|
||||
|
||||
if(doc.docstatus == 1)
|
||||
unhide_field(['Repair Indent']);
|
||||
else
|
||||
hide_field(['Repair Indent']);
|
||||
}
|
||||
|
||||
//======================= validation ===================================
|
||||
cur_frm.cscript.validate = function(doc,cdt,cdn){
|
||||
is_item_table(doc,cdt,cdn);
|
||||
}
|
||||
//======================= transaction date =============================
|
||||
cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
|
||||
if(doc.__islocal){
|
||||
cur_frm.cscript.get_default_schedule_date(doc);
|
||||
}
|
||||
}
|
||||
|
||||
//=================== Quantity ===================================================================
|
||||
cur_frm.cscript.qty = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (flt(d.qty) < flt(d.min_order_qty))
|
||||
alert("Warning: Indent Qty is less than Minimum Order Qty");
|
||||
}
|
||||
|
||||
// On Button Click Functions
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
// Make Purchase Order
|
||||
cur_frm.cscript['Make Purchase Order'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
n = createLocal('Purchase Order');
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals['Purchase Order'][n]]),
|
||||
'from_doctype':doc.doctype,
|
||||
'to_doctype':'Purchase Order',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Indent','Purchase Order'],['Indent Detail','PO Detail']]"
|
||||
}, function(r,rt) {
|
||||
loaddoc('Purchase Order', n);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Stop INDENT
|
||||
// ==================================================================================================
|
||||
cur_frm.cscript['Stop Indent'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
var check = confirm("Do you really want to STOP this Indent?");
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Un Stop INDENT
|
||||
//====================================================================================================
|
||||
cur_frm.cscript['Unstop Indent'] = function(){
|
||||
var doc = cur_frm.doc
|
||||
var check = confirm("Do you really want to UNSTOP this Indent?");
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
205
buying/doctype/indent/indent.py
Normal file
205
buying/doctype/indent/indent.py
Normal file
@@ -0,0 +1,205 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.defaults = get_defaults()
|
||||
self.tname = 'Indent Detail'
|
||||
self.fname = 'indent_details'
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
|
||||
def get_default_schedule_date(self):
|
||||
get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
|
||||
|
||||
# Pull Sales Order Details
|
||||
# -------------------------
|
||||
def pull_so_details(self):
|
||||
self.check_if_already_pulled()
|
||||
if self.doc.sales_order_no:
|
||||
get_obj('DocType Mapper', 'Sales Order-Indent', with_children=1).dt_map('Sales Order', 'Indent', self.doc.sales_order_no, self.doc, self.doclist, "[['Sales Order', 'Indent'],['Sales Order Detail', 'Indent Detail']]")
|
||||
self.get_item_defaults()
|
||||
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')]
|
||||
|
||||
|
||||
# Get item's other details
|
||||
#- ------------------------
|
||||
def get_item_defaults(self):
|
||||
self.get_default_schedule_date()
|
||||
for d in getlist(self.doclist, 'indent_details'):
|
||||
det = sql("select min_order_qty from tabItem where name = '%s'" % d.item_code)
|
||||
d.min_order_qty = det and flt(det[0][0]) or 0
|
||||
|
||||
# Validate so items
|
||||
# ----------------------------
|
||||
def validate_qty_against_so(self):
|
||||
so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
|
||||
for d in getlist(self.doclist, 'indent_details'):
|
||||
if d.sales_order_no:
|
||||
if not so_items.has_key(d.sales_order_no):
|
||||
so_items[d.sales_order_no] = {d.item_code: flt(d.qty)}
|
||||
else:
|
||||
if not so_items[d.sales_order_no].has_key(d.item_code):
|
||||
so_items[d.sales_order_no][d.item_code] = flt(d.qty)
|
||||
else:
|
||||
so_items[d.sales_order_no][d.item_code] += flt(d.qty)
|
||||
|
||||
for so_no in so_items.keys():
|
||||
for item in so_items[so_no].keys():
|
||||
already_indented = sql("select sum(qty) from `tabIndent Detail` where item_code = '%s' and sales_order_no = '%s' and docstatus = 1 and parent != '%s'" % (item, so_no, self.doc.name))
|
||||
already_indented = already_indented and flt(already_indented[0][0]) or 0
|
||||
|
||||
actual_so_qty = sql("select sum(qty) from `tabSales Order Detail` where parent = '%s' and item_code = '%s' and docstatus = 1 group by parent" % (so_no, item))
|
||||
actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0
|
||||
|
||||
if flt(so_items[so_no][item]) + already_indented > actual_so_qty:
|
||||
msgprint("You can raise indent of maximum qty: %s for item: %s against sales order: %s\n Anyway, you can add more qty in new row for the same item." % (actual_so_qty - already_indented, item, so_no), raise_exception=1)
|
||||
|
||||
|
||||
# Validate fiscal year
|
||||
# ----------------------------
|
||||
def validate_fiscal_year(self):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Indent Date')
|
||||
|
||||
# get item details
|
||||
# ---------------------------------
|
||||
def get_item_details(self, arg =''):
|
||||
return cstr( get_obj(dt='Purchase Common').get_item_details(self,arg) )
|
||||
|
||||
# Get UOM Details
|
||||
# ---------------------------------
|
||||
def get_uom_details(self, arg = ''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_uom_details(arg))
|
||||
|
||||
# GET TERMS & CONDITIONS
|
||||
#-----------------------------
|
||||
def get_tc_details(self):
|
||||
return get_obj('Purchase Common').get_tc_details(self)
|
||||
|
||||
# Validate Schedule Date
|
||||
#--------------------------------
|
||||
def validate_schedule_date(self):
|
||||
#:::::::: validate schedule date v/s indent date ::::::::::::
|
||||
for d in getlist(self.doclist, 'indent_details'):
|
||||
if d.schedule_date < self.doc.transaction_date:
|
||||
msgprint("Expected Schedule Date cannot be before Indent Date")
|
||||
raise Exception
|
||||
|
||||
# Validate
|
||||
# ---------------------
|
||||
def validate(self):
|
||||
self.validate_schedule_date()
|
||||
self.validate_fiscal_year()
|
||||
|
||||
# set status as "Draft"
|
||||
set(self.doc, 'status', 'Draft')
|
||||
|
||||
# Get Purchase Common Obj
|
||||
pc_obj = get_obj(dt='Purchase Common')
|
||||
|
||||
# Validate Mandatory
|
||||
pc_obj.validate_mandatory(self)
|
||||
|
||||
# Validate for items
|
||||
pc_obj.validate_for_items(self)
|
||||
|
||||
# Validate qty against SO
|
||||
self.validate_qty_against_so()
|
||||
|
||||
|
||||
# On Submit Functions
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
# Update Indented Qty in Bin
|
||||
def update_bin(self, is_submit, is_stopped):
|
||||
for d in getlist(self.doclist, 'indent_details'):
|
||||
# Step 1:=> Check if is_stock_item == 'Yes'
|
||||
if cstr(sql("select is_stock_item from `tabItem` where name = '%s'" % cstr(d.item_code))[0][0]) == 'Yes':
|
||||
if not d.warehouse:
|
||||
msgprint('Please Enter Warehouse for Item %s as it is stock item.' % cstr(d.item_code))
|
||||
raise Exception
|
||||
# Step 2:=> Set Qty
|
||||
qty =flt(d.qty)
|
||||
if is_stopped:
|
||||
qty = (d.qty > d.ordered_qty) and flt(flt(d.qty) - flt(d.ordered_qty)) or 0
|
||||
# Step 3 :=> Update Bin's Indent Qty by +- qty
|
||||
get_obj('Warehouse', d.warehouse).update_bin(0, 0, 0, (is_submit and 1 or -1) * flt(qty), 0, d.item_code, self.doc.transaction_date)
|
||||
|
||||
# On Submit
|
||||
#---------------------------------------------------------------------------
|
||||
def on_submit(self):
|
||||
# Step 1:=> Set Status
|
||||
set(self.doc,'status','Submitted')
|
||||
|
||||
# Step 2:=> Update Bin
|
||||
self.update_bin(is_submit = 1, is_stopped = 0)
|
||||
|
||||
def check_modified_date(self):
|
||||
mod_db = sql("select modified from `tabIndent` where name = '%s'" % self.doc.name)
|
||||
date_diff = sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
|
||||
|
||||
if date_diff and date_diff[0][0]:
|
||||
msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ")
|
||||
raise Exception
|
||||
|
||||
# On Stop / unstop
|
||||
#------------------------------------------------------------------------------
|
||||
def update_status(self, status):
|
||||
self.check_modified_date()
|
||||
# Step 1:=> Update Bin
|
||||
self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
|
||||
|
||||
# Step 2:=> Set status
|
||||
set(self.doc,'status',cstr(status))
|
||||
|
||||
# Step 3:=> Acknowledge User
|
||||
msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)) )
|
||||
|
||||
# On Cancel
|
||||
#-----------------------------------------------------------------------------
|
||||
def on_cancel(self):
|
||||
# Step 1:=> Get Purchase Common Obj
|
||||
pc_obj = get_obj(dt='Purchase Common')
|
||||
|
||||
# Step 2:=> Check for stopped status
|
||||
pc_obj.check_for_stopped_status( self.doc.doctype, self.doc.name)
|
||||
|
||||
# Step 3:=> Check if Purchase Order has been submitted against current Indent
|
||||
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
|
||||
# Step 4:=> Update Bin
|
||||
self.update_bin(is_submit = 0, is_stopped = (cstr(self.doc.status) == 'Stopped') and 1 or 0)
|
||||
|
||||
# Step 5:=> Set Status
|
||||
set(self.doc,'status','Cancelled')
|
||||
|
||||
|
||||
# Repair Indent
|
||||
# ===========================================
|
||||
def repair_indent(self):
|
||||
get_obj('Purchase Common', 'Purchase Common').repair_curr_doctype_details(self)
|
||||
551
buying/doctype/indent/indent.txt
Normal file
551
buying/doctype/indent/indent.txt
Normal file
@@ -0,0 +1,551 @@
|
||||
# DocType, Indent
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:04',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-05-04 14:53:17',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1304500997',
|
||||
'allow_print': 0,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'read_only_onload': 1,
|
||||
'search_fields': 'status,transaction_date,sales_order_no',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': '%(per_ordered)s% ordered',
|
||||
'version': 186
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Indent',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Indent',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Indent
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Indent'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 1,
|
||||
'role': 'Purchase Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 0,
|
||||
'role': 'Purchase Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 1,
|
||||
'role': 'Material Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'role': 'Material Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 1,
|
||||
'role': 'Material User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 0,
|
||||
'role': 'Material User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 7,
|
||||
'permlevel': 0,
|
||||
'role': 'Purchase User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 8,
|
||||
'permlevel': 1,
|
||||
'role': 'Purchase User'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Enter items and their details which are falling short in your warehouse and for which you want your purchase department to raise a purchase order.',
|
||||
'description': 'Enter items and their details for which you want your purchase department to raise a purchase order.',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Basic Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 2,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'To manage multiple series please go to Setup > Manage Series',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'label': 'Series',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'naming_series',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'IDT',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'in_filter': 1,
|
||||
'label': 'Status',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nDraft\nSubmitted\nStopped\nCancelled',
|
||||
'permlevel': 1,
|
||||
'reqd': 0,
|
||||
'search_index': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 5,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'The date at which current entry is made in system.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'transaction_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 6,
|
||||
'in_filter': 1,
|
||||
'label': 'Indent Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'transaction_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': '% of materials ordered against this Indent',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'per_ordered',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': '% Ordered',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'per_ordered',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 8,
|
||||
'label': 'Items',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'One or multiple Sales Order no which generated this Indent',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_order_no',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 9,
|
||||
'label': 'Sales Order No',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'sales_order_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'options': 'Sales Order',
|
||||
'permlevel': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 10,
|
||||
'label': 'Pull Sales Order Details',
|
||||
'options': 'pull_so_details',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'indent_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 11,
|
||||
'label': 'Indent Details',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'indent_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Indent Detail',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Give additional details about the indent.',
|
||||
'description': 'Filing in Additional Information about the Indent will help you analyze your data better.',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 12,
|
||||
'label': 'More Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Select the relevant company name if you have multiple companies',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 13,
|
||||
'in_filter': 1,
|
||||
'label': 'Company',
|
||||
'oldfieldname': 'company',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fiscal_year',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 14,
|
||||
'in_filter': 1,
|
||||
'label': 'Fiscal Year',
|
||||
'oldfieldname': 'fiscal_year',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Fiscal Year',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Name of the entity who has requested for the indent',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'requested_by',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 15,
|
||||
'label': 'Requested By',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'requested_by',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 16,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'remark',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 17,
|
||||
'label': 'Remarks',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'remark',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'After cancelling the indent, a dialog box will ask you reason for cancellation which will be reflected in this field',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'cancel_reason',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 18,
|
||||
'label': 'Cancel Reason',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'cancel_reason',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 19,
|
||||
'label': 'Amended From',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amended_from',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '150px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'The date at which current entry is corrected in the system.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amendment_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 20,
|
||||
'label': 'Amendment Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amendment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'description': 'Add Terms and Conditions for the Indent. You can also prepare a master Term Sheet and use the Template',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 21,
|
||||
'label': 'Terms',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'letter_head',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 22,
|
||||
'label': 'Letter Head',
|
||||
'oldfieldname': 'letter_head',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Letter Head',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'tc_name',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 23,
|
||||
'label': 'Select Terms',
|
||||
'oldfieldname': 'tc_name',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Term',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 24,
|
||||
'label': 'Get Terms',
|
||||
'oldfieldtype': 'Button',
|
||||
'options': 'get_tc_details',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 25,
|
||||
'label': 'Terms HTML',
|
||||
'oldfieldtype': 'HTML',
|
||||
'options': 'You can add Terms and Notes that will be printed in the Transaction',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'terms',
|
||||
'fieldtype': 'Text Editor',
|
||||
'idx': 26,
|
||||
'label': 'Terms1',
|
||||
'oldfieldname': 'terms',
|
||||
'oldfieldtype': 'Text Editor',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 27,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 28,
|
||||
'label': 'Repair Indent',
|
||||
'oldfieldtype': 'Button',
|
||||
'options': 'repair_indent',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
||||
0
buying/doctype/indent_detail/__init__.py
Normal file
0
buying/doctype/indent_detail/__init__.py
Normal file
275
buying/doctype/indent_detail/indent_detail.txt
Normal file
275
buying/doctype/indent_detail/indent_detail.txt
Normal file
@@ -0,0 +1,275 @@
|
||||
# DocType, Indent Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:04',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-05-04 14:41:43',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'IDTD/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 29
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Indent Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Indent Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Indent Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'schedule_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 1,
|
||||
'label': 'Required Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'schedule_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 2,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Name',
|
||||
'oldfieldname': 'item_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 4,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'warehouse',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 5,
|
||||
'label': 'Warehouse',
|
||||
'oldfieldname': 'warehouse',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Warehouse',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 0,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'brand',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 6,
|
||||
'label': 'Brand',
|
||||
'oldfieldname': 'brand',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Brand',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_group',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 7,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Group',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'item_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item Group',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Quantity',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '50px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'lead_time_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 9,
|
||||
'label': 'Lead Time Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'lead_time_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'uom',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 10,
|
||||
'label': 'Stock UOM',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'uom',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'UOM',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'width': '50px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'min_order_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'label': 'Min Order Qty',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'min_order_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'width': '70px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'projected_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 12,
|
||||
'label': 'Projected Qty',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'projected_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'width': '70px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'ordered_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 13,
|
||||
'label': 'Ordered Qty',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'ordered_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sales_order_no',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 14,
|
||||
'label': 'Sales Order No',
|
||||
'no_copy': 1,
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'page_break',
|
||||
'fieldtype': 'Check',
|
||||
'idx': 15,
|
||||
'label': 'Page Break',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'page_break',
|
||||
'oldfieldtype': 'Check',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
||||
0
buying/doctype/po_detail/__init__.py
Normal file
0
buying/doctype/po_detail/__init__.py
Normal file
434
buying/doctype/po_detail/po_detail.txt
Normal file
434
buying/doctype/po_detail/po_detail.txt
Normal file
@@ -0,0 +1,434 @@
|
||||
# DocType, PO Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:12',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-11-12 16:53:30',
|
||||
'modified_by': 'sneha@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'POD/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 46
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'PO Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, PO Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'PO Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'schedule_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 0,
|
||||
'idx': 1,
|
||||
'in_filter': 1,
|
||||
'label': 'Reqd By Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'schedule_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 2,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 3,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Name',
|
||||
'oldfieldname': 'item_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 4,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'purchase_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Rate (Default Curr.)',
|
||||
'oldfieldname': 'purchase_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Amount (Default Curr.)',
|
||||
'oldfieldname': 'amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Quantity',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '60px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'import_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 0,
|
||||
'idx': 9,
|
||||
'label': 'Rate',
|
||||
'oldfieldname': 'import_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'uom',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 10,
|
||||
'label': 'UOM',
|
||||
'oldfieldname': 'uom',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'UOM',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'import_amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 10,
|
||||
'label': 'Amount',
|
||||
'oldfieldname': 'import_amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'warehouse',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 11,
|
||||
'label': 'Warehouse',
|
||||
'oldfieldname': 'warehouse',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Warehouse',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'conversion_factor',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 0,
|
||||
'idx': 11,
|
||||
'label': 'Conversion Factor',
|
||||
'oldfieldname': 'conversion_factor',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_doctype',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 12,
|
||||
'label': 'Prevdoc DocType',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'prevdoc_doctype',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 12,
|
||||
'label': 'Stock UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_docname',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 13,
|
||||
'in_filter': 1,
|
||||
'label': 'Indent No',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'prevdoc_docname',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Indent',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1,
|
||||
'width': '120px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 0,
|
||||
'idx': 14,
|
||||
'in_filter': 1,
|
||||
'label': 'Indent Date',
|
||||
'oldfieldname': 'prevdoc_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'prevdoc_detail_docname',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 15,
|
||||
'in_filter': 1,
|
||||
'label': 'Indent Detail No',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': 'prevdoc_detail_docname',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'brand',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 16,
|
||||
'label': 'Brand',
|
||||
'oldfieldname': 'brand',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Brand',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_group',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 17,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Group',
|
||||
'oldfieldname': 'item_group',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item Group',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 0,
|
||||
'idx': 20,
|
||||
'label': 'Stock Qty',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'stock_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'trigger': 'Client',
|
||||
'width': '100px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'received_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 0,
|
||||
'idx': 21,
|
||||
'label': 'Received Qty',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'received_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': '0.00',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'billed_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 0,
|
||||
'idx': 22,
|
||||
'label': 'Billed Quantity',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'billed_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Tax detail table fetched from item master as a string and stored in this field.\nUsed for Purchase Other Charges',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_tax_rate',
|
||||
'fieldtype': 'Small Text',
|
||||
'hidden': 1,
|
||||
'idx': 23,
|
||||
'label': 'Item Tax Rate',
|
||||
'oldfieldname': 'item_tax_rate',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'page_break',
|
||||
'fieldtype': 'Check',
|
||||
'hidden': 0,
|
||||
'idx': 24,
|
||||
'label': 'Page Break',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'page_break',
|
||||
'oldfieldtype': 'Check',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
||||
0
buying/doctype/po_raw_material_detail/__init__.py
Normal file
0
buying/doctype/po_raw_material_detail/__init__.py
Normal file
153
buying/doctype/po_raw_material_detail/po_raw_material_detail.txt
Normal file
153
buying/doctype/po_raw_material_detail/po_raw_material_detail.txt
Normal file
@@ -0,0 +1,153 @@
|
||||
# DocType, PO Raw Material Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:12',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'sneha@webnotestech.com',
|
||||
'owner': 'dhanalekshmi@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'hide_toolbar': 1,
|
||||
'istable': 1,
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 1
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'PO Raw Material Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, PO Raw Material Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'PO Raw Material Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reference_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 1,
|
||||
'in_filter': 0,
|
||||
'label': 'Reference Name',
|
||||
'oldfieldname': 'reference_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom_detail_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'BOM Detail No',
|
||||
'oldfieldname': 'bom_detail_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'main_item_code',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'main_item_code',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rm_item_code',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 4,
|
||||
'label': 'Raw Material Item Code',
|
||||
'oldfieldname': 'rm_item_code',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'required_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 6,
|
||||
'label': 'Required Qty',
|
||||
'oldfieldname': 'required_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Rate',
|
||||
'oldfieldname': 'rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Amount',
|
||||
'oldfieldname': 'amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'conversion_factor',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 1,
|
||||
'idx': 11,
|
||||
'label': 'Conversion Factor',
|
||||
'oldfieldname': 'conversion_factor',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 12,
|
||||
'label': 'Stock Uom',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
0
buying/doctype/pr_raw_material_detail/__init__.py
Normal file
0
buying/doctype/pr_raw_material_detail/__init__.py
Normal file
191
buying/doctype/pr_raw_material_detail/pr_raw_material_detail.txt
Normal file
191
buying/doctype/pr_raw_material_detail/pr_raw_material_detail.txt
Normal file
@@ -0,0 +1,191 @@
|
||||
# DocType, PR Raw Material Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:13',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'sneha@webnotestech.com',
|
||||
'owner': 'wasim@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'hide_toolbar': 0,
|
||||
'istable': 1,
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 17
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'PR Raw Material Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, PR Raw Material Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'PR Raw Material Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reference_name',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 0,
|
||||
'idx': 1,
|
||||
'in_filter': 0,
|
||||
'label': 'Reference Name',
|
||||
'oldfieldname': 'reference_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'bom_detail_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'BOM Detail No',
|
||||
'oldfieldname': 'bom_detail_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'main_item_code',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'main_item_code',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rm_item_code',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 4,
|
||||
'label': 'Raw Material Item Code',
|
||||
'oldfieldname': 'rm_item_code',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 5,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'required_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Required Qty',
|
||||
'oldfieldname': 'required_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'consumed_qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Consumed Qty',
|
||||
'oldfieldname': 'consumed_qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 10,
|
||||
'label': 'Rate',
|
||||
'oldfieldname': 'rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'conversion_factor',
|
||||
'fieldtype': 'Currency',
|
||||
'hidden': 1,
|
||||
'idx': 11,
|
||||
'label': 'Conversion Factor',
|
||||
'oldfieldname': 'conversion_factor',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amount',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 11,
|
||||
'label': 'Amount',
|
||||
'oldfieldname': 'amount',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 12,
|
||||
'label': 'Stock Uom',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'current_stock',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 12,
|
||||
'label': 'Current Stock',
|
||||
'oldfieldname': 'current_stock',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
0
buying/doctype/purchase_common/__init__.py
Normal file
0
buying/doctype/purchase_common/__init__.py
Normal file
508
buying/doctype/purchase_common/purchase_common.js
Normal file
508
buying/doctype/purchase_common/purchase_common.js
Normal file
@@ -0,0 +1,508 @@
|
||||
// Preset
|
||||
// ------
|
||||
// cur_frm.cscript.tname - Details table name
|
||||
// cur_frm.cscript.fname - Details fieldname
|
||||
var tname = cur_frm.cscript.tname;
|
||||
var fname = cur_frm.cscript.fname;
|
||||
|
||||
|
||||
cur_frm.cscript.get_default_schedule_date = function(doc) {
|
||||
var ch = getchildren( tname, doc.name, fname);
|
||||
if (flt(ch.length) > 0){
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_default_schedule_date', '', function(r, rt) { refresh_field(fname); });
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// ======================== Supplier =================================================
|
||||
cur_frm.cscript.supplier = function(doc, cdt, cdn) {
|
||||
if(doc.supplier) get_server_fields('get_supplier_details', doc.supplier,'', doc, cdt, cdn, 1);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// ======================== Conversion Rate ==========================================
|
||||
cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) {
|
||||
cur_frm.cscript.calc_amount( doc, 1);
|
||||
}
|
||||
|
||||
//==================== Item Code Get Query =======================================================
|
||||
// Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed.
|
||||
cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.%(key)s LIKE "%s" LIMIT 50'
|
||||
}
|
||||
|
||||
//==================== Get Item Code Details =====================================================
|
||||
cur_frm.cscript.item_code = function(doc,cdt,cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code) {
|
||||
temp = "{'item_code':'"+(d.item_code?d.item_code:'')+"', 'warehouse':'"+(d.warehouse?d.warehouse:'')+"'}"
|
||||
get_server_fields('get_item_details', temp, fname, doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//==================== Update Stock Qty ==========================================================
|
||||
cur_frm.cscript.update_stock_qty = function(doc,cdt,cdn){
|
||||
d = locals[cdt][cdn]
|
||||
// Step 1:=> Check if qty , uom, conversion_factor
|
||||
if (d.qty && d.uom && d.conversion_factor){
|
||||
// Step 2:=> Set stock_qty = qty * conversion_factor
|
||||
d.stock_qty = flt(flt(d.qty) * flt(d.conversion_factor));
|
||||
// Step 3:=> Refer stock_qty field a that particular row.
|
||||
refresh_field('stock_qty' , d.name,fname);
|
||||
}
|
||||
}
|
||||
|
||||
//==================== Purchase UOM Get Query =======================================================
|
||||
//cur_frm.fields_dict[fname].grid.get_field("uom").get_query = function(doc, cdt, cdn) {
|
||||
// var d = locals[this.doctype][this.docname];
|
||||
// return 'SELECT `tabUOM Conversion Detail`.`uom` FROM `tabUOM Conversion Detail` WHERE `tabUOM Conversion Detail`.`parent` = "' + d.item_code + '" AND `tabUOM Conversion Detail`.uom LIKE "%s"'
|
||||
//}
|
||||
|
||||
|
||||
//==================== UOM ======================================================================
|
||||
cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code && d.uom) {
|
||||
call_back = function(doc, cdt, cdn){
|
||||
//refresh_field('purchase_rate', d.name, fname);
|
||||
//refresh_field('qty' , d.name, fname);
|
||||
//refresh_field('conversion_factor' , d.name, fname);
|
||||
//var doc = locals[cdt][cdn];
|
||||
cur_frm.cscript.calc_amount(doc, 2);
|
||||
}
|
||||
str_arg = {'item_code':d.item_code, 'uom':d.uom, 'stock_qty':flt(d.stock_qty), 'qty': flt(d.qty)}
|
||||
// Updates Conversion Factor, Qty and Purchase Rate
|
||||
get_server_fields('get_uom_details',JSON.stringify(str_arg), fname, doc,cdt,cdn,1, call_back);
|
||||
// don't make mistake of calling update_stock_qty() the get_uom_details returns stock_qty as per conversion factor properly
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//==================== Conversion factor =========================================================
|
||||
cur_frm.cscript.conversion_factor = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.uom(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
//==================== stock qty ======================================================================
|
||||
cur_frm.cscript.stock_qty = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(d.uom && d.qty){
|
||||
d.conversion_factor = flt(d.stock_qty)/flt(d.qty);
|
||||
refresh_field('conversion_factor', d.name, fname);
|
||||
}
|
||||
}
|
||||
|
||||
//==================== Warehouse ================================================================
|
||||
cur_frm.cscript.warehouse = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if (d.item_code && d.warehouse) {
|
||||
str_arg = "{'item_code':'" + (d.item_code?d.item_code:'') + "', 'warehouse':'" + (d.warehouse?d.warehouse:'') + "'}"
|
||||
get_server_fields('get_bin_details', str_arg, fname, doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//=================== Quantity ===================================================================
|
||||
cur_frm.cscript.qty = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
// Step 1: => Update Stock Qty
|
||||
cur_frm.cscript.update_stock_qty(doc,cdt,cdn);
|
||||
// Step 2: => Calculate Amount
|
||||
cur_frm.cscript.calc_amount(doc, 2);
|
||||
}
|
||||
|
||||
|
||||
//=================== Purchase Rate ==============================================================
|
||||
cur_frm.cscript.purchase_rate = function(doc, cdt, cdn) {
|
||||
// Calculate Amount
|
||||
cur_frm.cscript.calc_amount(doc, 2);
|
||||
}
|
||||
|
||||
//==================== Import Rate ================================================================
|
||||
cur_frm.cscript.import_rate = function(doc, cdt, cdn) {
|
||||
// Calculate Amount
|
||||
cur_frm.cscript.calc_amount(doc, 1);
|
||||
}
|
||||
|
||||
|
||||
//====================== Calculate Amount ============================================================
|
||||
/*cur_frm.cscript.calc_amount = function(doc, n) {
|
||||
// Set defaults
|
||||
doc = locals[doc.doctype][doc.name]
|
||||
if (! doc.conversion_rate) doc.conversion_rate = 1;
|
||||
if(!n) n=0;
|
||||
var net_total = 0;
|
||||
var net_total_import = 0;
|
||||
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
|
||||
for(var i=0;i<cl.length;i++)
|
||||
{
|
||||
if(n == 1){
|
||||
set_multiple(tname, cl[i].name, {'purchase_rate': flt(doc.conversion_rate) * flt(cl[i].import_rate) }, fname);
|
||||
set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(doc.conversion_rate) * flt(cl[i].import_rate))}, fname);
|
||||
set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) * flt(cl[i].import_rate))}, fname);
|
||||
}
|
||||
if(n == 2){
|
||||
set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(cl[i].purchase_rate)), 'import_rate': flt(flt(cl[i].purchase_rate) / flt(doc.conversion_rate)) }, fname);
|
||||
set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) * flt(cl[i].purchase_rate) / flt(doc.conversion_rate))}, fname);
|
||||
}
|
||||
net_total += flt(flt(cl[i].qty) * flt(cl[i].purchase_rate));
|
||||
net_total_import += flt(flt(cl[i].qty) * flt(cl[i].import_rate));
|
||||
}
|
||||
doc.net_total = flt(net_total) ;
|
||||
doc.net_total_import = flt(net_total_import) ;
|
||||
refresh_field('net_total');
|
||||
refresh_field('net_total_import');
|
||||
} */
|
||||
|
||||
//==================== check if item table is blank ==============================================
|
||||
var is_item_table = function(doc,cdt,cdn) {
|
||||
// Step 1 :=>Get all childrens/ rows from Detail Table
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
// Step 2 :=> If there are no rows then set validated = false, I hope this will stop further execution of code.
|
||||
if (cl.length == 0) {
|
||||
alert("There is no item in table"); validated = false;
|
||||
}
|
||||
}
|
||||
|
||||
//==================== Validate ====================================================================
|
||||
cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
||||
// Step 1:=> check if item table is blank
|
||||
is_item_table(doc,cdt,cdn);
|
||||
// Step 2:=> Calculate Amount
|
||||
cur_frm.cscript.calc_amount(doc, 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*cur_frm.cscript.other_fname = "purchase_tax_details";
|
||||
other_charges ===> purchase_tax_details
|
||||
RV Tax Detail ===> Purchase Tax Detail
|
||||
cur_frm.cscript.recalc ===> cur_frm.cscript.calc_amount
|
||||
export ===> import
|
||||
other_charges_total ===> total_tax
|
||||
Other Charges Calculation ===> Tax Calculation*/
|
||||
|
||||
// **************** RE-CALCULATE VALUES ***************************
|
||||
|
||||
cur_frm.cscript['Re-Calculate Values'] = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript['Calculate Tax'](doc,cdt,cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript['Calculate Tax'] = function(doc, cdt, cdn) {
|
||||
var other_fname = cur_frm.cscript.other_fname;
|
||||
|
||||
var cl = getchildren('Purchase Tax Detail', doc.name, other_fname, doc.doctype);
|
||||
for(var i = 0; i<cl.length; i++){
|
||||
cl[i].total_tax_amount = 0;
|
||||
cl[i].total_amount = 0;
|
||||
cl[i].tax_amount = 0; // this is done to calculate other charges
|
||||
cl[i].total = 0;
|
||||
if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type) && !cl[i].row_id){
|
||||
alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
if(doc.doctype != 'Payable Voucher') cur_frm.cscript.calc_amount(doc, 1);
|
||||
else if(doc.doctype == 'Payable Voucher') cur_frm.cscript.calc_total(doc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
cur_frm.cscript.get_item_wise_tax_detail = function( doc, rate, cl, i, tax, t) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
var detail = '';
|
||||
detail = cl[i].item_code + " : " + cstr(rate) + NEWLINE;
|
||||
return detail;
|
||||
}
|
||||
|
||||
//if(cur_frm.cscript.custom_recalc)cur_frm.cscript.custom_recalc(doc);
|
||||
|
||||
|
||||
|
||||
cur_frm.cscript.amount = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.calc_amount(doc, 3);
|
||||
}
|
||||
|
||||
|
||||
//====================== Calculate Amount for PO and PR not for PV ============================================================
|
||||
cur_frm.cscript.calc_amount = function(doc, n) {
|
||||
// Set defaults
|
||||
doc = locals[doc.doctype][doc.name]
|
||||
var other_fname = cur_frm.cscript.other_fname;
|
||||
if(!flt(doc.conversion_rate)) { doc.conversion_rate = 1; refresh_field('conversion_rate'); }
|
||||
if(!n) n=0;
|
||||
var net_total = 0;
|
||||
var net_total_import = 0;
|
||||
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
|
||||
for(var i=0;i<cl.length;i++)
|
||||
{
|
||||
if(n == 1){
|
||||
set_multiple(tname, cl[i].name, {'purchase_rate': flt(doc.conversion_rate) * flt(cl[i].import_rate) }, fname);
|
||||
set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(doc.conversion_rate) * flt(cl[i].import_rate))}, fname);
|
||||
set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) * flt(cl[i].import_rate))}, fname);
|
||||
}
|
||||
if(n == 2){
|
||||
set_multiple(tname, cl[i].name, {'amount': flt(flt(cl[i].qty) * flt(cl[i].purchase_rate)), 'import_rate': flt(flt(cl[i].purchase_rate) / flt(doc.conversion_rate)) }, fname);
|
||||
set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) * flt(cl[i].purchase_rate) / flt(doc.conversion_rate))}, fname);
|
||||
}
|
||||
if(n == 3){
|
||||
set_multiple(tname, cl[i].name, {'purchase_rate': flt(flt(cl[i].amount) / flt(cl[i].qty)) }, fname);
|
||||
set_multiple(tname, cl[i].name, {'import_rate': flt(flt(cl[i].purchase_rate) / flt(doc.conversion_rate))}, fname);
|
||||
set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) * flt(cl[i].purchase_rate) / flt(doc.conversion_rate))}, fname);
|
||||
}
|
||||
if (n != 3){
|
||||
net_total += flt(flt(cl[i].qty) * flt(cl[i].purchase_rate));
|
||||
net_total_import += flt(flt(cl[i].qty) * flt(cl[i].import_rate));
|
||||
}
|
||||
else if(n == 3){
|
||||
net_total += flt(cl[i].amount);
|
||||
net_total_import += flt(cl[i].amount) / flt(doc.conversion_rate);
|
||||
}
|
||||
//update stock uom
|
||||
cur_frm.cscript.update_stock_qty(doc, tname, cl[i].name);
|
||||
}
|
||||
doc.net_total = flt(net_total) ;
|
||||
doc.net_total_import = flt(net_total_import) ;
|
||||
refresh_field('net_total');
|
||||
refresh_field('net_total_import');
|
||||
|
||||
cur_frm.cscript.val_cal_charges(doc, cdt, cdn, tname, fname, other_fname);
|
||||
}
|
||||
|
||||
|
||||
//======== Function was broken away from cur_frm.cscript.calc_amount as PV has fieldname 'rate' instead of 'purchase_rate'===========
|
||||
cur_frm.cscript.val_cal_charges = function(doc, cdt, cdn, tname, fname, other_fname){
|
||||
|
||||
doc = locals[doc.doctype][doc.name]
|
||||
if(flt(doc.net_total) > 0) {
|
||||
var cl = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
|
||||
for(var i = 0; i<cl.length; i++){
|
||||
cl[i].total_tax_amount = 0;
|
||||
cl[i].total_amount = 0;
|
||||
cl[i].tax_amount = 0; // this is done to calculate other charges
|
||||
cl[i].total = 0;
|
||||
cl[i].item_wise_tax_detail = "";
|
||||
if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type) && !cl[i].row_id){
|
||||
alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
cur_frm.cscript.calc_other_charges(doc , tname , fname , other_fname); // calculate other charges
|
||||
}
|
||||
cur_frm.cscript.calc_doc_values(doc, cdt, cdn, tname, fname, other_fname); // calculates total amounts
|
||||
|
||||
refresh_many(['net_total','grand_total','rounded_total','grand_total_import','rounded_total_import','in_words','in_words_import','purchase_tax_details','total_tax','other_charges_added', 'other_charges_deducted','net_total_import','other_charges_added_import','other_charges_deducted_import']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ******************************* OTHER CHARGES *************************************
|
||||
cur_frm.cscript.calc_other_charges = function(doc , tname , fname , other_fname) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
// make display area
|
||||
// ------------------
|
||||
|
||||
|
||||
cur_frm.fields_dict['Tax Calculation'].disp_area.innerHTML = '<b style="padding: 8px 0px;">Calculation Details for Other Charges and Landed cost:</b>';
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
var tax = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
|
||||
// make display table
|
||||
// ------------------
|
||||
var otc = make_table(cur_frm.fields_dict['Tax Calculation'].disp_area, cl.length + 1, tax.length + 1, '90%',[],{border:'1px solid #AAA',padding:'2px'});
|
||||
$y(otc,{marginTop:'8px'});
|
||||
|
||||
var tax_desc = {}; var tax_desc_rates = []; var net_total = 0;
|
||||
|
||||
|
||||
for(var i=0;i<cl.length;i++) {
|
||||
var item_tax = 0;
|
||||
if(doc.doctype != 'Payable Voucher') net_total += flt(flt(cl[i].qty) * flt(cl[i].purchase_rate));
|
||||
else if(doc.doctype == 'Payable Voucher') net_total += flt(flt(cl[i].qty) * flt(cl[i].rate));
|
||||
|
||||
var prev_total = flt(cl[i].amount);
|
||||
if(cl[i].item_tax_rate)
|
||||
var check_tax = eval('var a='+cl[i].item_tax_rate+';a'); //to get in dictionary
|
||||
|
||||
// Add Item Code in new Row
|
||||
//--------------------------
|
||||
$td(otc,i+1,0).innerHTML = cl[i].item_code;
|
||||
|
||||
var tax = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
|
||||
var total = net_total;
|
||||
for(var t=0;t<tax.length;t++){
|
||||
|
||||
var account = tax[t].account_head;
|
||||
$td(otc,0,t+1).innerHTML = account?account:'';
|
||||
//Check For Rate
|
||||
if(cl[i].item_tax_rate && check_tax[account]!=null) {rate = flt(check_tax[account]);}
|
||||
else // if particular item doesn't have particular rate it will take other charges rate
|
||||
rate = flt(tax[t].rate);
|
||||
//Check For Rate and get tax amount
|
||||
var tax_amount = cur_frm.cscript.check_charge_type_and_get_tax_amount(doc,tax,t, cl[i], rate);
|
||||
|
||||
//enter item_wise_tax_detail i.e. tax rate on each item
|
||||
|
||||
item_wise_tax_detail = cur_frm.cscript.get_item_wise_tax_detail( doc, rate, cl, i, tax, t);
|
||||
|
||||
|
||||
if(tax[t].add_deduct_tax == 'Add'){
|
||||
// this is calculation part for all types
|
||||
if(tax[t].charge_type != "Actual") tax[t].item_wise_tax_detail += item_wise_tax_detail;
|
||||
tax[t].total_amount = flt(tax_amount.toFixed(2)); //stores actual tax amount in virtual field
|
||||
tax[t].total_tax_amount = flt(prev_total.toFixed(2)); //stores total amount in virtual field
|
||||
tax[t].tax_amount += flt(tax_amount.toFixed(2));
|
||||
var total_amount = flt(tax[t].tax_amount);
|
||||
total_tax_amount = flt(tax[t].total_tax_amount) + flt(total_amount);
|
||||
if(tax[t].category != "For Valuation"){
|
||||
set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)+flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
|
||||
prev_total += flt(tax[t].total_amount);
|
||||
total += flt(tax[t].tax_amount); // for adding total to previous amount
|
||||
}
|
||||
else{
|
||||
set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'amount':total_amount, 'total':flt(total)/*_tax_amount)*/}, other_fname);
|
||||
prev_total = prev_total;
|
||||
}
|
||||
//prev_total += flt(tax[t].total_amount); // for previous row total
|
||||
|
||||
if(tax[t].charge_type == 'Actual')
|
||||
$td(otc,i+1,t+1).innerHTML = fmt_money(tax[t].total_amount);
|
||||
else
|
||||
$td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
|
||||
|
||||
if (tax[t].category != "For Total"){
|
||||
item_tax += tax[t].total_amount;
|
||||
}
|
||||
}
|
||||
else if(tax[t].add_deduct_tax == 'Deduct'){
|
||||
// this is calculation part for all types
|
||||
if(tax[t].charge_type != "Actual") tax[t].item_wise_tax_detail += item_wise_tax_detail;
|
||||
tax[t].total_amount = flt(tax_amount.toFixed(2)); //stores actual tax amount in virtual field
|
||||
tax[t].total_tax_amount = flt(prev_total.toFixed(2)); //stores total amount in virtual field
|
||||
tax[t].tax_amount += flt(tax_amount.toFixed(2));
|
||||
var total_amount = flt(tax[t].tax_amount);
|
||||
total_tax_amount = flt(tax[t].total_tax_amount) - flt(total_amount);
|
||||
if(tax[t].category != "For Valuation"){
|
||||
set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':total_amount, 'total':flt(total)-flt(tax[t].tax_amount)/*_tax_amount)*/}, other_fname);
|
||||
prev_total -= flt(tax[t].total_amount);
|
||||
total -= flt(tax[t].tax_amount); // for adding total to previous amount
|
||||
}
|
||||
else{
|
||||
set_multiple('Purchase Tax Detail', tax[t].name, { 'item_wise_tax_detail':tax[t].item_wise_tax_detail, 'tax_amount':total_amount, 'total':flt(total)/*_tax_amount)*/}, other_fname);
|
||||
prev_total = prev_total;
|
||||
}
|
||||
//prev_total += flt(tax[t].total_amount); // for previous row total
|
||||
|
||||
if(tax[t].charge_type == 'Actual')
|
||||
$td(otc,i+1,t+1).innerHTML = fmt_money(tax[t].total_amount);
|
||||
else
|
||||
$td(otc,i+1,t+1).innerHTML = '('+fmt_money(rate) + '%) ' +fmt_money(tax[t].total_amount);
|
||||
|
||||
if (tax[t].category != "For Total"){
|
||||
item_tax -= tax[t].total_amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
set_multiple(tname, cl[i].name, {'item_tax_amount': item_tax }, fname);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ******* Calculation of total amounts of document (item amount + other charges)****************
|
||||
cur_frm.cscript.calc_doc_values = function(doc, cdt, cdn, tname, fname, other_fname) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
var net_total = 0; var total_tax = 0; var other_charges_added = 0; var other_charges_deducted = 0;
|
||||
var cl = getchildren(tname, doc.name, fname);
|
||||
for(var i = 0; i<cl.length; i++){
|
||||
net_total += flt(cl[i].amount);
|
||||
}
|
||||
var d = getchildren('Purchase Tax Detail', doc.name, other_fname,doc.doctype);
|
||||
for(var j = 0; j<d.length; j++){
|
||||
if(d[j].category != 'For Valuation'){
|
||||
|
||||
if(d[j].add_deduct_tax == 'Add'){
|
||||
other_charges_added += flt(d[j].tax_amount);
|
||||
total_tax += flt(d[j].tax_amount);
|
||||
}
|
||||
if(d[j].add_deduct_tax == 'Deduct'){
|
||||
other_charges_deducted += flt(d[j].tax_amount);
|
||||
total_tax -= flt(d[j].tax_amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
doc.net_total = flt(net_total);
|
||||
doc.total_tax = flt(total_tax);
|
||||
|
||||
doc.other_charges_added = flt(other_charges_added);
|
||||
doc.other_charges_deducted = flt(other_charges_deducted);
|
||||
doc.grand_total = flt(flt(net_total) + flt(other_charges_added) - flt(other_charges_deducted));
|
||||
doc.rounded_total = Math.round(doc.grand_total);
|
||||
doc.net_total_import = flt(flt(net_total) / flt(doc.conversion_rate));
|
||||
doc.other_charges_added_import = flt(flt(other_charges_added) / flt(doc.conversion_rate));
|
||||
doc.other_charges_deducted_import = flt(flt(other_charges_deducted) / flt(doc.conversion_rate));
|
||||
doc.grand_total_import = flt(flt(doc.grand_total) / flt(doc.conversion_rate));
|
||||
doc.rounded_total_import = Math.round(doc.grand_total_import);
|
||||
|
||||
if(doc.doctype == 'Payable Voucher'){
|
||||
var t_tds_tax = 0.0;
|
||||
|
||||
doc.total_tds_on_voucher = flt(doc.ded_amount)
|
||||
// total amount to pay
|
||||
|
||||
doc.total_amount_to_pay = flt(flt(net_total) + flt(other_charges_added) - flt(other_charges_deducted) - flt(doc.total_tds_on_voucher));
|
||||
|
||||
// outstanding amount
|
||||
if(doc.docstatus==0) doc.outstanding_amount = flt(doc.net_total) + flt(other_charges_added) - flt(other_charges_deducted) - flt(doc.total_tds_on_voucher) - flt(doc.total_advance);
|
||||
|
||||
refresh_many(['net_total','total_taxes','grand_total','total_tds_on_voucher','total_amount_to_pay', 'outstanding_amount']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.check_charge_type_and_get_tax_amount = function(doc, tax, t, cl, rate, print_amt) {
|
||||
doc = locals[doc.doctype][doc.name];
|
||||
|
||||
var tax_amount = 0;
|
||||
if(tax[t].charge_type == 'Actual') {
|
||||
var value = flt(tax[t].rate) / flt(doc.net_total); // this give the ratio in which all items are divided
|
||||
return tax_amount = flt(value) * flt(cl.amount);
|
||||
}
|
||||
else if(tax[t].charge_type == 'On Net Total') {
|
||||
return tax_amount = (flt(rate) * flt(cl.amount) / 100);
|
||||
}
|
||||
else if(tax[t].charge_type == 'On Previous Row Amount'){
|
||||
var row_no = (tax[t].row_id).toString();
|
||||
var row = (row_no).split("+"); // splits the values and stores in an array
|
||||
for(var r = 0;r<row.length;r++){
|
||||
var id = cint(row[r].replace(/^\s+|\s+$/g,""));
|
||||
tax_amount += (flt(rate) * flt(tax[id-1].total_amount) / 100);
|
||||
}
|
||||
var row_id = row_no.indexOf("/");
|
||||
if(row_id != -1) {
|
||||
rate = '';
|
||||
var row = (row_no).split("/"); // splits the values and stores in an array
|
||||
if(row.length>2) alert("You cannot enter more than 2 nos. for division");
|
||||
var id1 = cint(row[0].replace(/^\s+|\s+$/g,""));
|
||||
var id2 = cint(row[1].replace(/^\s+|\s+$/g,""));
|
||||
tax_amount = flt(tax[id1-1].total_amount) / flt(tax[id2-1].total_amount);
|
||||
}
|
||||
return tax_amount
|
||||
}
|
||||
else if(tax[t].charge_type == 'On Previous Row Total') {
|
||||
var row = cint(tax[t].row_id);
|
||||
if(tax[row-1].add_deduct_tax == 'Add'){
|
||||
return tax_amount = flt(rate) * (flt(tax[row-1].total_tax_amount)+flt(tax[row-1].total_amount)) / 100;
|
||||
}
|
||||
else if(tax[row-1].add_deduct_tax == 'Deduct'){
|
||||
return tax_amount = flt(rate) * (flt(tax[row-1].total_tax_amount)-flt(tax[row-1].total_amount)) / 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
621
buying/doctype/purchase_common/purchase_common.py
Normal file
621
buying/doctype/purchase_common/purchase_common.py
Normal file
@@ -0,0 +1,621 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
self.chk_tol_for_list = ['Indent - Purchase Order', 'Purchase Order - Purchase Receipt', 'Purchase Order - Payable Voucher']
|
||||
|
||||
self.update_qty = {'Indent - Purchase Order' : 'ordered_qty',
|
||||
'Purchase Order - Purchase Receipt' : 'received_qty',
|
||||
'Purchase Order - Payable Voucher' : 'billed_qty',
|
||||
'Purchase Receipt - Payable Voucher' : 'billed_qty'}
|
||||
|
||||
self.update_percent_field = {'Indent - Purchase Order' : 'per_ordered',
|
||||
'Purchase Order - Purchase Receipt' : 'per_received',
|
||||
'Purchase Order - Payable Voucher' : 'per_billed',
|
||||
'Purchase Receipt - Payable Voucher' : 'per_billed'}
|
||||
|
||||
# used in validation for items and update_prevdoc_detail
|
||||
self.doctype_dict = {'Indent' : 'Indent Detail',
|
||||
'Supplier Quotation' : 'Supplier Quotation Detail',
|
||||
'Purchase Order' : 'PO Detail',
|
||||
'Purchase Receipt' : 'Purchase Receipt Detail'}
|
||||
|
||||
self.repair_percent_field = {
|
||||
'ordered_qty' : 'per_ordered',
|
||||
'received_qty': 'per_received',
|
||||
'billed_qty' : 'per_billed'}
|
||||
|
||||
self.repair_fields = {
|
||||
'Indent Detail' : ['ordered_qty'],
|
||||
'PO Detail' : ['received_qty', 'billed_qty'],
|
||||
'Purchase Receipt Detail': ['billed_qty']
|
||||
}
|
||||
|
||||
self.next_dt_detail = {
|
||||
'ordered_qty' : 'PO Detail',
|
||||
'billed_qty' : 'PV Detail',
|
||||
'received_qty': 'Purchase Receipt Detail'
|
||||
}
|
||||
|
||||
self.msg = []
|
||||
|
||||
|
||||
def get_default_schedule_date( self, obj):
|
||||
for d in getlist( obj.doclist, obj.fname):
|
||||
item = sql("select lead_time_days from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())" % cstr(d.item_code) , as_dict = 1)
|
||||
ltd = item and cint(item[0]['lead_time_days']) or 0
|
||||
if ltd and obj.doc.transaction_date:
|
||||
if d.fields.has_key('lead_time_date') or obj.doc.doctype == 'Indent':
|
||||
d.lead_time_date = cstr(add_days( obj.doc.transaction_date, cint(ltd)))
|
||||
if not d.fields.has_key('prevdoc_docname') or (d.fields.has_key('prevdoc_docname') and not d.prevdoc_docname):
|
||||
d.schedule_date = cstr( add_days( obj.doc.transaction_date, cint(ltd)))
|
||||
|
||||
# Client Trigger functions
|
||||
#------------------------------------------------------------------------------------------------
|
||||
|
||||
# Get Supplier Details
|
||||
def get_supplier_details(self, name = ''):
|
||||
details = sql("select supplier_name,address from `tabSupplier` where name = '%s' and docstatus != 2" %(name), as_dict = 1)
|
||||
if details:
|
||||
ret = {
|
||||
'supplier_name' : details and details[0]['supplier_name'] or '',
|
||||
'supplier_address' : details and details[0]['address'] or ''
|
||||
}
|
||||
# ********** get primary contact details (this is done separately coz. , in case there is no primary contact thn it would not be able to fetch customer details in case of join query)
|
||||
contact_det = sql("select contact_name, contact_no, email_id from `tabContact` where supplier = '%s' and is_supplier = 1 and is_primary_contact = 'Yes' and docstatus != 2" %(name), as_dict = 1)
|
||||
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
|
||||
return cstr(ret)
|
||||
else:
|
||||
msgprint("Supplier : %s does not exists" % (name))
|
||||
raise Exception
|
||||
|
||||
# Get TERMS AND CONDITIONS
|
||||
# =======================================================================================
|
||||
def get_tc_details(self,obj):
|
||||
r = sql("select terms from `tabTerm` where name = %s", obj.doc.tc_name)
|
||||
if r: obj.doc.terms = r[0][0]
|
||||
|
||||
# Get Item Details
|
||||
def get_item_details( self, obj, arg =''):
|
||||
|
||||
arg = eval(arg)
|
||||
item = sql("select item_name,item_group, brand, description, min_order_qty, stock_uom, default_warehouse,lead_time_days, last_purchase_rate from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", (arg['item_code']), as_dict = 1)
|
||||
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg['item_code'])
|
||||
t = {}
|
||||
for x in tax: t[x[0]] = flt(x[1])
|
||||
# get warehouse
|
||||
if arg['warehouse']:
|
||||
wh = arg['warehouse']
|
||||
else:
|
||||
wh = item and item[0]['default_warehouse'] or ''
|
||||
|
||||
ret = {
|
||||
'item_name' : item and item[0]['item_name'] or '',
|
||||
'item_group' : item and item[0]['item_group'] or '',
|
||||
'brand' : item and item[0]['brand'] or '',
|
||||
'description' : item and item[0]['description'] or '',
|
||||
'qty' : 0,
|
||||
'uom' : item and item[0]['stock_uom'] or '',
|
||||
'stock_uom' : item and item[0]['stock_uom'] or '',
|
||||
'conversion_factor' : '1',
|
||||
'warehouse' : wh,
|
||||
'item_tax_rate' : str(t),
|
||||
'batch_no' : ''
|
||||
}
|
||||
|
||||
# get min_order_qty from item
|
||||
if obj.doc.doctype == 'Indent':
|
||||
ret['min_order_qty'] = item and flt(item[0]['min_order_qty']) or 0
|
||||
|
||||
# get projected qty from bin
|
||||
if ret['warehouse']:
|
||||
bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], ret['warehouse']), as_dict=1)
|
||||
ret['projected_qty'] = bin and flt(bin[0]['projected_qty']) or 0
|
||||
|
||||
# get schedule date, lead time date
|
||||
if obj.doc.transaction_date and item and item[0]['lead_time_days']:
|
||||
ret['schedule_date'] = cstr(add_days(obj.doc.transaction_date, cint(item[0]['lead_time_days'])))
|
||||
ret['lead_time_date'] = cstr(add_days(obj.doc.transaction_date, cint(item[0]['lead_time_days'])))
|
||||
|
||||
# get last purchase rate as per stock uom and default currency for following list of doctypes
|
||||
if obj.doc.doctype in ['Supplier Quotation', 'Purchase Order', 'Purchase Receipt']:
|
||||
ret['purchase_rate'] = item and flt(item[0]['last_purchase_rate']) or 0
|
||||
ret['import_rate'] = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(obj.doc.fields.has_key('conversion_rate') and flt(obj.doc.conversion_rate) or 1)
|
||||
|
||||
return cstr(ret)
|
||||
|
||||
# Get Available Qty at Warehouse
|
||||
def get_bin_details( self, arg = ''):
|
||||
arg = eval(arg)
|
||||
bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (arg['item_code'], arg['warehouse']), as_dict=1)
|
||||
ret = { 'projected_qty' : bin and flt(bin[0]['projected_qty']) or 0 }
|
||||
return str(ret)
|
||||
|
||||
# Get UOM Details
|
||||
def get_uom_details(self, arg = ''):
|
||||
arg, ret = eval(arg), {}
|
||||
lpr = sql("select last_purchase_rate from `tabItem` where name = %s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", arg['item_code'], as_dict =1)
|
||||
uom = sql("select conversion_factor from `tabUOM Conversion Detail` where parent = %s and uom = %s", (arg['item_code'],arg['uom']), as_dict = 1)
|
||||
if uom:
|
||||
ret = {
|
||||
'conversion_factor' : flt(uom[0]['conversion_factor']),
|
||||
'qty' : flt(arg['stock_qty']) / flt(uom[0]['conversion_factor']),
|
||||
'purchase_rate' : (lpr and flt(lpr[0]['last_purchase_rate']) * flt(uom[0]['conversion_factor'])) or 0
|
||||
}
|
||||
|
||||
return str(ret)
|
||||
|
||||
# get last purchase rate
|
||||
def get_last_purchase_rate( self, obj):
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
if d.item_code:
|
||||
rate = sql("select last_purchase_rate from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())"% cstr(d.item_code), as_dict = 1 )
|
||||
d.purchase_rate = rate and flt(rate[0]['last_purchase_rate']) * flt(d.conversion_factor) or 0
|
||||
|
||||
if not rate[0]['last_purchase_rate']:
|
||||
msgprint("%s has no Last Purchase Rate."% d.item_code)
|
||||
|
||||
# validation
|
||||
# -------------------------------------------------------------------------------------------------------
|
||||
|
||||
# validate fields
|
||||
def validate_mandatory(self, obj):
|
||||
# check amendment date
|
||||
if obj.doc.amended_from and not obj.doc.amendment_date:
|
||||
msgprint("Please enter amendment date")
|
||||
raise Exception
|
||||
|
||||
# validate for same items and validate is_stock_item , is_purchase_item also validate uom and conversion factor
|
||||
def validate_for_items(self, obj):
|
||||
check_list, chk_dupl_itm=[],[]
|
||||
for d in getlist( obj.doclist, obj.fname):
|
||||
# validation for valid qty
|
||||
if flt(d.qty) < 0 or (d.parenttype != 'Purchase Receipt' and not flt(d.qty)):
|
||||
msgprint("Please enter valid qty for item %s" % cstr(d.item_code))
|
||||
raise Exception
|
||||
|
||||
# udpate with latest quantities
|
||||
bin = sql("select projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
||||
|
||||
f_lst ={'projected_qty': bin and flt(bin[0]['projected_qty']) or 0, 'ordered_qty': 0, 'received_qty' : 0, 'billed_qty': 0}
|
||||
if d.doctype == 'Purchase Receipt Detail':
|
||||
f_lst.pop('received_qty')
|
||||
for x in f_lst :
|
||||
if d.fields.has_key(x):
|
||||
d.fields[x] = f_lst[x]
|
||||
|
||||
item = sql("select is_stock_item, is_purchase_item from tabItem where name=%s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", d.item_code)
|
||||
if not item:
|
||||
msgprint("Item %s does not exist in Item Master." % cstr(d.item_code))
|
||||
raise Exception
|
||||
|
||||
# validate stock item
|
||||
if item[0][0]=='Yes':
|
||||
if not d.warehouse:
|
||||
msgprint("Warehouse is mandatory for %s, since it is a stock item" % d.item_code)
|
||||
raise Exception
|
||||
|
||||
# validate purchase item
|
||||
if not item[0][1]=='Yes':
|
||||
msgprint("Item %s is not purchase item." % (d.item_code))
|
||||
raise Exception
|
||||
|
||||
if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname:
|
||||
# check warehouse, uom in previous doc and in current doc are same.
|
||||
data = sql("select item_code, warehouse, uom from `tab%s` where name = '%s'" % ( self.doctype_dict[d.prevdoc_doctype], d.prevdoc_detail_docname), as_dict = 1)
|
||||
if not data:
|
||||
msgprint("Please fetch data in Row " + cstr(d.idx) + " once again or please contact Administrator.")
|
||||
raise Exception
|
||||
|
||||
# Check if Item Code has been modified.
|
||||
if not cstr(data[0]['item_code']) == cstr(d.item_code):
|
||||
msgprint("Please check Item %s is not present in %s %s ." % (d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
|
||||
raise Exception
|
||||
|
||||
# Check if Warehouse has been modified.
|
||||
if not cstr(data[0]['warehouse']) == cstr(d.warehouse):
|
||||
msgprint("Please check warehouse %s of Item %s which is not present in %s %s ." % (d.warehouse, d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
|
||||
raise Exception
|
||||
|
||||
# Check if UOM has been modified.
|
||||
if not cstr(data[0]['uom']) == cstr(d.uom) and not cstr(d.prevdoc_doctype) == 'Indent':
|
||||
msgprint("Please check UOM %s of Item %s which is not present in %s %s ." % (d.uom, d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
|
||||
raise Exception
|
||||
|
||||
# list criteria that should not repeat if item is stock item
|
||||
e = [d.schedule_date, d.item_code, d.warehouse, d.uom, d.fields.has_key('prevdoc_docname') and d.prevdoc_docname or '', d.fields.has_key('prevdoc_detail_docname') and d.prevdoc_detail_docname or '', d.fields.has_key('batch_no') and d.batch_no or '']
|
||||
|
||||
# if is not stock item
|
||||
f = [d.schedule_date, d.item_code, d.description]
|
||||
|
||||
ch = sql("select is_stock_item from `tabItem` where name = '%s'"%d.item_code)
|
||||
|
||||
if ch and ch[0][0] == 'Yes':
|
||||
# check for same items
|
||||
if e in check_list:
|
||||
msgprint("Item %s has been entered more than once with same schedule date, warehouse and uom." % d.item_code)
|
||||
raise Exception
|
||||
else:
|
||||
check_list.append(e)
|
||||
|
||||
elif ch and ch[0][0] == 'No':
|
||||
# check for same items
|
||||
if f in chk_dupl_itm:
|
||||
msgprint("Item %s has been entered more than once." % d.item_code)
|
||||
raise Exception
|
||||
else:
|
||||
chk_dupl_itm.append(f)
|
||||
|
||||
# validate conversion rate
|
||||
def validate_conversion_rate(self, obj):
|
||||
default_currency = get_obj('Manage Account').doc.default_currency
|
||||
if not default_currency:
|
||||
msgprint('Message: Please enter default currency in Global Defaults')
|
||||
raise Exception
|
||||
|
||||
company_currency = sql("select default_currency from `tabCompany` where name = '%s'" % obj.doc.company)
|
||||
curr = company_currency and cstr(company_currency[0][0]) or default_currency
|
||||
if (obj.doc.currency == curr and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != curr and flt(obj.doc.conversion_rate) == 1.00):
|
||||
msgprint("Message: Please Enter Appropriate Conversion Rate.")
|
||||
raise Exception
|
||||
|
||||
def validate_doc(self, obj, prevdoc_doctype, prevdoc_docname):
|
||||
if prevdoc_docname :
|
||||
get_name = sql("select name from `tab%s` where name = '%s'" % (prevdoc_doctype, prevdoc_docname))
|
||||
name = get_name and get_name[0][0] or ''
|
||||
if name: #check for incorrect docname
|
||||
dt = sql("select company, docstatus from `tab%s` where name = '%s'" % (prevdoc_doctype, name))
|
||||
company_name = dt and cstr(dt[0][0]) or ''
|
||||
docstatus = dt and dt[0][1] or 0
|
||||
|
||||
# check for docstatus
|
||||
if (docstatus != 1):
|
||||
msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " is not Submitted Document.")
|
||||
raise Exception
|
||||
|
||||
# check for company
|
||||
if (company_name != obj.doc.company):
|
||||
msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " does not belong to the Company: " + cstr(obj.doc.company))
|
||||
raise Exception
|
||||
|
||||
if prevdoc_doctype in ['Supplier Quotation','Purchase Order', 'Purchase Receipt']:
|
||||
dt = sql("select supplier, currency from `tab%s` where name = '%s'" % (prevdoc_doctype, name))
|
||||
supplier = dt and dt[0][0] or ''
|
||||
currency = dt and dt[0][1] or ''
|
||||
|
||||
# check for supplier
|
||||
if (supplier != obj.doc.supplier):
|
||||
msgprint("Purchase Order: " + cstr(d.prevdoc_docname) + " supplier :" + cstr(supplier) + " does not match with supplier of current document.")
|
||||
raise Exception
|
||||
|
||||
# check for curency
|
||||
if (currency != obj.doc.currency):
|
||||
msgprint("Purchase Order: " + cstr(d.prevdoc_docname) + " currency :" + cstr(currency) + " does not match with currency of current document.")
|
||||
raise Exception
|
||||
|
||||
else: # if not name than
|
||||
msgprint(cstr(prevdoc_doctype) + ": " + cstr(prevdoc_docname) + " is not a valid " + cstr(prevdoc_doctype))
|
||||
raise Exception
|
||||
|
||||
|
||||
# Validate values with reference document
|
||||
#---------------------------------------
|
||||
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'" % ( doctype, docname))
|
||||
if stopped:
|
||||
msgprint("One cannot do any transaction against %s : %s, it's status is 'Stopped'" % ( doctype, docname))
|
||||
raise Exception
|
||||
|
||||
# Check Docstatus of Next DocType on Cancel AND of Previous DocType on Submit
|
||||
def check_docstatus(self, check, doctype, docname , detail_doctype = ''):
|
||||
|
||||
if check == 'Next':
|
||||
# Convention := doctype => Next Doctype, docname = current_docname , detail_doctype = Next Doctype Detail Table
|
||||
|
||||
submitted = sql("select t1.name from `tab%s` t1,`tab%s` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % ( doctype, detail_doctype, docname))
|
||||
if submitted:
|
||||
msgprint(cstr(doctype) + " : " + cstr(submitted[0][0]) + " has already been submitted !")
|
||||
raise Exception
|
||||
|
||||
if check == 'Previous':
|
||||
# Convention := doctype => Previous Doctype, docname = Previous Docname
|
||||
submitted = sql("select name from `tab%s` where docstatus = 1 and name = '%s'" % (doctype, docname))
|
||||
if not submitted:
|
||||
msgprint(cstr(doctype) + " : " + cstr(submitted[0][0]) + " not submitted !")
|
||||
raise Exception
|
||||
|
||||
# Update Ref Doc
|
||||
# =======================================================
|
||||
def get_qty(self,curr_doctype,ref_tab_fname,ref_tab_dn,ref_doc_tname, transaction, curr_parent_name):
|
||||
# Get total Quantities of current doctype (eg. PR) except for qty of this transaction
|
||||
#------------------------------
|
||||
# please check as UOM changes from Indent - Purchase Order ,so doing following else uom should be same .
|
||||
# i.e. in PO uom is NOS then in PR uom should be NOS
|
||||
# but if in Indent uom KG it can change in PO
|
||||
|
||||
get_qty = (transaction == 'Indent - Purchase Order') and 'qty * conversion_factor' or 'qty'
|
||||
qty = sql("select sum(%s) from `tab%s` where %s = '%s' and docstatus = 1 and parent != '%s'"% ( get_qty, curr_doctype, ref_tab_fname, ref_tab_dn, curr_parent_name))
|
||||
qty = qty and flt(qty[0][0]) or 0
|
||||
|
||||
# get total qty of ref doctype
|
||||
#--------------------
|
||||
max_qty = sql("select qty from `tab%s` where name = '%s' and docstatus = 1"% (ref_doc_tname, ref_tab_dn))
|
||||
max_qty = max_qty and flt(max_qty[0][0]) or 0
|
||||
|
||||
return cstr(qty)+'~~~'+cstr(max_qty)
|
||||
|
||||
|
||||
|
||||
def update_refdoc_qty(self, curr_qty, curr_doctype, ref_dn, ref_dt, ref_tab_fname, ref_tab_dn, transaction, item_code, is_submit, curr_parent_doctype, curr_parent_name):
|
||||
# Get Quantity
|
||||
#------------------------------
|
||||
curr_ref_qty = self.get_qty(curr_doctype,ref_tab_fname,ref_tab_dn,self.doctype_dict[ref_dt], transaction, curr_parent_name)
|
||||
qty, max_qty, max_qty_plus_tol = flt(curr_ref_qty.split('~~~')[0]), flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[1])
|
||||
|
||||
# Qty above Tolerance should be allowed only once.
|
||||
# But there is special case for Transaction 'Indent-Purhcase Order' that there should be no restriction
|
||||
# One can create any no. of PO against same Indent!!!
|
||||
if qty >= max_qty and is_submit and flt(curr_qty) > 0:
|
||||
reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Payable Voucher') and 'Billed'
|
||||
msgprint("Error: Item Code : '%s' of '%s' is already %s." %(item_code,ref_dn,reason))
|
||||
raise Exception
|
||||
|
||||
#check if tolerance added in item master
|
||||
tolerance = flt(get_value('Item',item_code,'tolerance') or 0)
|
||||
|
||||
if not(tolerance):
|
||||
tolerance = flt(get_value('Manage Account',None,'tolerance') or 0)
|
||||
|
||||
if is_submit:
|
||||
qty = qty + flt(curr_qty)
|
||||
|
||||
# Calculate max_qty_plus_tol i.e. max_qty with tolerance
|
||||
#-----------------------------------------------------------------
|
||||
if transaction in self.chk_tol_for_list:
|
||||
max_qty_plus_tol = max_qty * (1 + (flt(tolerance)/ 100))
|
||||
|
||||
if max_qty_plus_tol < qty:
|
||||
reason = (curr_parent_doctype == 'Purchase Order') and 'Ordered' or (curr_parent_doctype == 'Purchase Receipt') and 'Received' or (curr_parent_doctype == 'Payable Voucher') and 'Billed'
|
||||
msgprint("error:Already %s Qty for %s is %s and maximum allowed Qty is %s" % (cstr(reason), item_code, cstr(flt(qty) - flt(curr_qty)) , cstr(max_qty_plus_tol)))
|
||||
raise Exception
|
||||
|
||||
# Update qty
|
||||
#------------------
|
||||
sql("update `tab%s` set %s = '%s',modified = now() where name = '%s'" % (self.doctype_dict[ref_dt],self.update_qty[transaction] , flt(qty), ref_tab_dn))
|
||||
|
||||
def update_ref_doctype_dict(self, curr_qty, curr_doctype, ref_dn, ref_dt, ref_tab_fname, ref_tab_dn, transaction, item_code, is_submit, curr_parent_doctype, curr_parent_name):
|
||||
# update qty
|
||||
self.update_refdoc_qty( curr_qty, curr_doctype, ref_dn, ref_dt, ref_tab_fname, ref_tab_dn, transaction, item_code, is_submit, curr_parent_doctype, curr_parent_name)
|
||||
|
||||
# append distinct ref_dn in doctype_dict
|
||||
if not self.ref_doctype_dict.has_key(ref_dn) and self.update_percent_field.has_key(transaction):
|
||||
self.ref_doctype_dict[ref_dn] = [ ref_dt, self.doctype_dict[ref_dt],transaction]
|
||||
|
||||
|
||||
# update prevdoc detail
|
||||
# --------------------
|
||||
def update_prevdoc_detail(self, obj, is_submit):
|
||||
import math
|
||||
self.ref_doctype_dict= {}
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
|
||||
if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname:
|
||||
transaction = cstr(d.prevdoc_doctype) + ' - ' + cstr(obj.doc.doctype)
|
||||
curr_qty = (transaction == 'Indent - Purchase Order') and flt(d.qty) * flt(d.conversion_factor) or flt(d.qty)
|
||||
self.update_ref_doctype_dict( flt(curr_qty), d.doctype, d.prevdoc_docname, d.prevdoc_doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, transaction, d.item_code, is_submit, obj.doc.doctype, obj.doc.name)
|
||||
|
||||
# for payable voucher
|
||||
if d.fields.has_key('purchase_order') and d.purchase_order:
|
||||
curr_qty = sql("select sum(qty) from `tabPV Detail` where po_detail = '%s' and parent = '%s'" % (cstr(d.po_detail), cstr(obj.doc.name)))
|
||||
curr_qty = curr_qty and flt(curr_qty[0][0]) or 0
|
||||
self.update_ref_doctype_dict( curr_qty, d.doctype, d.purchase_order, 'Purchase Order', 'po_detail', d.po_detail, 'Purchase Order - ' + cstr(obj.doc.doctype), d.item_code, is_submit, obj.doc.doctype, obj.doc.name)
|
||||
|
||||
if d.fields.has_key('purchase_receipt') and d.purchase_receipt:
|
||||
self.update_ref_doctype_dict( flt(d.qty), d.doctype, d.purchase_receipt, 'Purchase Receipt', 'pr_detail', d.pr_detail, 'Purchase Receipt - ' + cstr(obj.doc.doctype), d.item_code, is_submit, obj.doc.doctype, obj.doc.name)
|
||||
|
||||
for ref_dn in self.ref_doctype_dict:
|
||||
# Calculate percentage
|
||||
#----------------------
|
||||
ref_doc_obj = get_obj(self.ref_doctype_dict[ref_dn][0],ref_dn,with_children = 1)
|
||||
count = 0
|
||||
percent = 0
|
||||
for d in getlist(ref_doc_obj.doclist,ref_doc_obj.fname):
|
||||
ref_qty = d.fields[self.update_qty[self.ref_doctype_dict[ref_dn][2]]]
|
||||
if flt(d.qty) - flt(ref_qty) <= 0:
|
||||
percent += 100
|
||||
else:
|
||||
percent += (flt(ref_qty)/flt(d.qty) * 100)
|
||||
count += 1
|
||||
percent_complete = math.floor(flt(percent)/ flt(count))
|
||||
|
||||
# update percent complete and modified
|
||||
#-------------------------------------
|
||||
sql("update `tab%s` set %s = '%s', modified = '%s' where name = '%s'" % (self.ref_doctype_dict[ref_dn][0], self.update_percent_field[self.ref_doctype_dict[ref_dn][2]], percent_complete, obj.doc.modified, ref_dn))
|
||||
|
||||
#update last purchse rate
|
||||
#------------------------------
|
||||
def update_last_purchase_rate(self, obj, is_submit):
|
||||
for d in getlist(obj.doclist,obj.fname):
|
||||
# get last purchase rate from Purchase Order
|
||||
po_lpr = sql ("select t2.purchase_rate/t2.conversion_factor as rate, t1.transaction_date as date from `tabPurchase Order` t1, `tabPO Detail` t2 where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1 and t1.name != '%s' order by t1.transaction_date DESC limit 1"% (d.item_code, obj.doc.name), as_dict = 1 )
|
||||
# get last purchase rate from purchase receipt
|
||||
pr_lpr = sql ("select t2.purchase_rate/t2.conversion_factor as rate, t1.posting_date as date, t1.posting_time from `tabPurchase Receipt` t1, `tabPurchase Receipt Detail` t2 where t1.name = t2.parent and t2.item_code = '%s' and t1.docstatus = 1 and t1.name != '%s' order by t1.posting_date DESC, t1.posting_time DESC limit 1"% (d.item_code, obj.doc.name), as_dict = 1 )
|
||||
# compare dates of Po & Pr
|
||||
date_diff1 = sql("select DATEDIFF('%s', '%s')" % ( po_lpr and po_lpr[0]['date'] or '0000-00-00', pr_lpr and pr_lpr[0]['date'] or '0000-00-00'))
|
||||
|
||||
if flt(date_diff1[0][0]) == 0 or flt(date_diff1[0][0]) < 0: lpr = [pr_lpr and pr_lpr[0]['rate'] or 0, pr_lpr and pr_lpr[0]['date'] or '0000-00-00', 'Purchase Receipt']
|
||||
elif flt(date_diff1[0][0]) > 0 : lpr = [po_lpr and po_lpr[0]['rate'] or 0, po_lpr and po_lpr[0]['date'] or '0000-00-00', 'Purchase Order']
|
||||
|
||||
# compare dates of above lpr and current doctype
|
||||
date_diff2 = sql("select DATEDIFF('%s', '%s')" % ( lpr[1], (obj.doc.doctype == 'Purchase Order') and obj.doc.transaction_date or obj.doc.posting_date ))
|
||||
|
||||
if is_submit == 1 and flt(date_diff2[0][0]) == 0 or flt(date_diff2[0][0]) < 0: lpr = [flt(d.purchase_rate) / flt(d.conversion_factor)]
|
||||
|
||||
# update last purchsae rate
|
||||
sql("update `tabItem` set last_purchase_rate = '%s' where name = '%s'" % (flt(lpr[0]),d.item_code))
|
||||
|
||||
def validate_fiscal_year(self,fiscal_year,transaction_date,dn):
|
||||
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%fiscal_year)
|
||||
ysd=fy and fy[0][0] or ""
|
||||
yed=add_days(str(ysd),365)
|
||||
if str(transaction_date) < str(ysd) or str(transaction_date) > str(yed):
|
||||
msgprint("'%s' Not Within The Fiscal Year"%(dn))
|
||||
raise Exception
|
||||
|
||||
|
||||
#---Other charges starting point------------------------
|
||||
|
||||
# Get other charges from Master
|
||||
# =================================================================================
|
||||
def get_purchase_tax_details(self,obj):
|
||||
self.doc.clear_table(obj.doclist,'purchase_tax_details')
|
||||
idx = 0
|
||||
other_charge = sql("select category, add_deduct_tax, charge_type,row_id,description,account_head,rate,tax_amount from `tabPurchase Tax Detail` where parent = '%s' order by idx" %(obj.doc.purchase_other_charges), as_dict = 1)
|
||||
for other in other_charge:
|
||||
d = addchild(obj.doc, 'purchase_tax_details', 'Purchase Tax Detail', 1, obj.doclist)
|
||||
d.category = other['category']
|
||||
d.add_deduct_tax = other['add_deduct_tax']
|
||||
d.charge_type = other['charge_type']
|
||||
d.row_id = other['row_id']
|
||||
d.description = other['description']
|
||||
d.account_head = other['account_head']
|
||||
d.rate = flt(other['rate'])
|
||||
d.tax_amount = flt(other['tax_amount'])
|
||||
d.idx = idx
|
||||
idx += 1
|
||||
|
||||
|
||||
# Get Tax rate if account type is TAX
|
||||
# =========================================================================
|
||||
def get_rate(self, arg, obj):
|
||||
arg = eval(arg)
|
||||
rate = sql("select account_type, tax_rate from `tabAccount` where name = '%s'" %(arg['account_head']), as_dict=1)
|
||||
|
||||
ret = {
|
||||
'rate' : rate and (rate[0]['account_type'] == 'Tax' and not arg['charge_type'] == 'Actual') and flt(rate[0]['tax_rate']) or 0
|
||||
}
|
||||
#msgprint(ret)
|
||||
return cstr(ret)
|
||||
|
||||
# Check Approving Authority
|
||||
# -------------------------
|
||||
def check_approving_authority(self, doctype_name, grand_total):
|
||||
det = sql("select amount from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount <= '%s'" % (doctype_name, grand_total))
|
||||
amt_list, auth_users = [], []
|
||||
if det:
|
||||
for x in det:
|
||||
amt_list.append(flt(x[0]))
|
||||
max_amount = max(amt_list)
|
||||
# Get names of all approving authority with max amount
|
||||
for d in sql("select approving_authority from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount = '%s'" % (doctype_name, flt(max_amount))): auth_users.append(d[0])
|
||||
for x in sql("select approving_authority from `tabApproval Structure` where doctype_name = '%s' and parent = 'Authorization Rules' and amount > '%s'" % (doctype_name, grand_total)): auth_users.append(x[0])
|
||||
if not has_common(auth_users, session['data']['profile']['roles']):
|
||||
msgprint("You do not have an authority to submit this %s. Only %s can submit since amount exceeds %s. %s" % (doctype_name, auth_users, get_defaults()['currency'], flt(max_amount)))
|
||||
raise Exception
|
||||
|
||||
|
||||
# Get total in words
|
||||
# ==================================================================
|
||||
def get_total_in_words(self, currency, amount):
|
||||
from webnotes.utils import money_in_words
|
||||
return money_in_words(amount, currency)
|
||||
|
||||
# get against document date
|
||||
#-----------------------------
|
||||
def get_prevdoc_date(self, obj):
|
||||
import datetime
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
if d.prevdoc_doctype and d.prevdoc_docname:
|
||||
dt = sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname))
|
||||
d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or ''
|
||||
|
||||
|
||||
#=================================================================================
|
||||
# REPAIR OPTION
|
||||
#=================================================================================
|
||||
|
||||
def get_next_dt_detail_qty(self, next_dt_detail, name, curr_dt, f):
|
||||
get_qty = (curr_dt == 'Indent') and 'qty * conversion_factor' or 'qty'
|
||||
qty = sql("select sum(%s) from `tab%s` where %s = '%s' and docstatus = 1"% (get_qty, next_dt_detail, (f == 'billed_qty') and (curr_dt == 'Purchase Order' and 'po_detail' or 'pr_detail') or 'prevdoc_detail_docname', name))
|
||||
return qty and flt(qty[0][0]) or 0
|
||||
|
||||
def repair_curr_qty_details(self, obj):
|
||||
self.repair_fields_list, count, percent = self.repair_fields[obj.tname], {}, {}
|
||||
# Check and Update Fields in Detail Table
|
||||
for d in getlist(obj.doclist, obj.fname):
|
||||
for f in self.repair_fields_list:
|
||||
qty, update_qty = d.fields.get(f,0), self.get_next_dt_detail_qty(self.next_dt_detail[f], d.name, obj.doc.doctype, f)
|
||||
|
||||
# Check qty
|
||||
if flt(qty) != flt(update_qty):
|
||||
msgprint('<div style="color: RED"> Difference found in %s (Before : %s; After : %s) in %s of %s : %s in Row No : %s </div>' % (f, qty, update_qty, obj.tname, obj.doc.doctype, obj.doc.name, d.name))
|
||||
self.msg.append('<div style="color: RED"> Difference found in %s (Before : %s; After : %s) in %s of %s : %s in Row No : %s</div>' % (f, qty, update_qty, obj.tname, obj.doc.doctype, obj.doc.name, d.name))
|
||||
# update qty
|
||||
#sql("update `tab%s` set %s = '%s' where name = '%s'"% (obj.tname, f, update_qty, d.name))
|
||||
set(d, f, update_qty)
|
||||
|
||||
# Calculate percentage
|
||||
if flt(d.qty) - flt(update_qty) <= 0:
|
||||
percent[f] = percent.get(f, 0) + 100
|
||||
else:
|
||||
percent[f] = percent.get(f, 0) + (flt(update_qty)/flt(d.qty) * 100)
|
||||
count[f] = count.get(f,0) + 1
|
||||
|
||||
return count, percent
|
||||
|
||||
def repair_curr_percent_detail(self, obj, count, percent):
|
||||
import math
|
||||
for f in self.repair_fields_list:
|
||||
per_complete, update_per_complete = flt(obj.doc.fields.get(self.repair_percent_field[f], 0)), math.floor(flt(percent[f]) / flt(count[f]))
|
||||
if flt(obj.doc.fields.get(self.repair_percent_field[f], 0)) != flt(update_per_complete):
|
||||
msgprint('<div style="color: RED">Difference found in %s (Before : %s; After : %s) in %s : %s </div>' % (self.repair_percent_field[f], per_complete, update_per_complete, obj.doc.doctype, obj.doc.name))
|
||||
self.msg.append('<div style="color: RED">Difference found in %s (Before : %s; After : %s) in %s : %s </div>' % (self.repair_percent_field[f], per_complete, update_per_complete, obj.doc.doctype, obj.doc.name))
|
||||
#sql("update `tab%s` set %s = '%s' where name = '%s'" % (obj.doc.doctype, self.repair_percent_field[f], update_per_complete, obj.doc.name))
|
||||
set(obj.doc, self.repair_percent_field[f], update_per_complete)
|
||||
|
||||
def send_mail(self, obj):
|
||||
email_msg = """ Dear Administrator,
|
||||
|
||||
In Account := %s User := %s has Reposted %s : %s and following was found:-
|
||||
|
||||
%s
|
||||
|
||||
""" % (get_value('Control Panel', None,'account_id'), session['user'], obj.doc.doctype, obj.doc.name, '\n'.join(self.msg))
|
||||
|
||||
sendmail(['jai@webnotestech.com'], subject='Repair Option', parts = [('text/plain', email_msg)])
|
||||
|
||||
def repair_curr_doctype_details(self, obj):
|
||||
count, percent = self.repair_curr_qty_details(obj)
|
||||
self.repair_curr_percent_detail(obj, count, percent)
|
||||
if self.msg: self.send_mail(obj)
|
||||
msgprint('<div style="color: GREEN"> ' + cstr(obj.doc.doctype) + ' : ' + cstr(obj.doc.name) + ' has been checked' + cstr(self.msg and ' and repaired successfully.' or '. No changes Found.' + '</div>'))
|
||||
31
buying/doctype/purchase_common/purchase_common.txt
Normal file
31
buying/doctype/purchase_common/purchase_common.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
# DocType, Purchase Common
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:15',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-12-23 10:45:17',
|
||||
'modified_by': 'sneha@webnotestech.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'issingle': 1,
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 187
|
||||
},
|
||||
|
||||
# DocType, Purchase Common
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Purchase Common'
|
||||
}
|
||||
]
|
||||
0
buying/doctype/purchase_order/__init__.py
Normal file
0
buying/doctype/purchase_order/__init__.py
Normal file
248
buying/doctype/purchase_order/purchase_order.js
Normal file
248
buying/doctype/purchase_order/purchase_order.js
Normal file
@@ -0,0 +1,248 @@
|
||||
cur_frm.cscript.tname = "PO Detail";
|
||||
cur_frm.cscript.fname = "po_details";
|
||||
cur_frm.cscript.other_fname = "purchase_tax_details";
|
||||
$import(Purchase Common)
|
||||
$import(Purchase Other Charges)
|
||||
$import(SMS Control)
|
||||
|
||||
//========================== On Load =================================================
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
if(!doc.fiscal_year && doc.__islocal){ //set_default_values(doc);
|
||||
doc.fiscal_year = sys_defaults.fiscal_year;
|
||||
}
|
||||
if(!doc.conversion_rate) doc.conversion_rate = 1;
|
||||
if(!doc.currency) doc.currency = sys_defaults.currency;
|
||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
|
||||
if(doc.__islocal){
|
||||
cur_frm.cscript.get_default_schedule_date(doc);
|
||||
}
|
||||
}
|
||||
|
||||
// ================================== Refresh ==========================================
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
// Show buttons
|
||||
// ---------------------------------
|
||||
cur_frm.clear_custom_buttons();
|
||||
if(doc.docstatus == 1 && doc.status != 'Stopped'){
|
||||
var ch = getchildren('PO Detail',doc.name,'po_details');
|
||||
var allow_billing = 0; var allow_receipt = 0;
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);
|
||||
|
||||
for(var i in ch){
|
||||
if(ch[i].qty > ch[i].received_qty) allow_receipt = 1;
|
||||
if(ch[i].qty > ch[i].billed_qty) allow_billing = 1;
|
||||
}
|
||||
if(allow_receipt)
|
||||
cur_frm.add_custom_button('Make Purchase Receipt', cur_frm.cscript['Make Purchase Receipt']);
|
||||
|
||||
if(allow_billing)
|
||||
cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Purchase Invoice']);
|
||||
|
||||
if(allow_billing || allow_receipt)
|
||||
cur_frm.add_custom_button('Stop', cur_frm.cscript['Stop Purchase Order']);
|
||||
}
|
||||
|
||||
if(doc.docstatus == 1 && doc.status == 'Stopped')
|
||||
cur_frm.add_custom_button('Unstop Purchase Order', cur_frm.cscript['Unstop Purchase Order']);
|
||||
|
||||
if(doc.docstatus == 1) unhide_field(['Repair Purchase Order']);
|
||||
else hide_field(['Repair Purchase Order']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Supplier
|
||||
cur_frm.cscript.supplier = function(doc,dt,dn) {
|
||||
if(doc.supplier) get_server_fields('get_default_supplier_address', JSON.stringify({supplier: doc.supplier}),'', doc, dt, dn, 1);
|
||||
if(doc.supplier) unhide_field(['supplier_name','supplier_address','contact_person','address_display','contact_display','contact_mobile','contact_email']);
|
||||
}
|
||||
|
||||
cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||
if(doc.supplier) get_server_fields('get_supplier_address', JSON.stringify({supplier: doc.supplier, address: doc.supplier_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict.supplier_address.on_new = function(dn) {
|
||||
locals['Address'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
||||
locals['Address'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.contact_person.on_new = function(dn) {
|
||||
locals['Contact'][dn].supplier = locals[cur_frm.doctype][cur_frm.docname].supplier;
|
||||
locals['Contact'][dn].supplier_name = locals[cur_frm.doctype][cur_frm.docname].supplier_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//================ create new contact ============================================================================
|
||||
cur_frm.cscript.new_contact = function(){
|
||||
tn = createLocal('Contact');
|
||||
locals['Contact'][tn].is_supplier = 1;
|
||||
if(doc.supplier) locals['Contact'][tn].supplier = doc.supplier;
|
||||
loaddoc('Contact', tn);
|
||||
}
|
||||
|
||||
//======================= transaction date =============================
|
||||
cur_frm.cscript.transaction_date = function(doc,cdt,cdn){
|
||||
if(doc.__islocal){
|
||||
cur_frm.cscript.get_default_schedule_date(doc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ---------------------- Get project name --------------------------
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` WHERE `tabProject`.status = "Open" AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
|
||||
//==================== Indent No Get Query =======================================================
|
||||
//===== Only those Indents status != 'Completed' and docstatus = 1 i.e. submitted=================
|
||||
cur_frm.fields_dict['indent_no'].get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabIndent`.`name` FROM `tabIndent` WHERE `tabIndent`.company = "' + doc.company + '" and `tabIndent`.`docstatus` = 1 and `tabIndent`.`status` != "Stopped" and ifnull(`tabIndent`.`per_ordered`,0) < 100 and `tabIndent`.%(key)s LIKE "%s" ORDER BY `tabIndent`.`name` DESC LIMIT 50';
|
||||
}
|
||||
|
||||
/*
|
||||
//*********** get approved supplier quotation ********************
|
||||
cur_frm.fields_dict['supplier_qtn'].get_query = function(doc) {
|
||||
var cond='';
|
||||
if(doc.supplier) cond = 'ifnull(`tabSupplier Quotation`.supplier, "") = "'+doc.supplier+'" and';
|
||||
|
||||
return repl('SELECT DISTINCT `tabSupplier Quotation`.`name` FROM `tabSupplier Quotation` WHERE `tabSupplier Quotation`.company = "%(company)s" and`tabSupplier Quotation`.`docstatus` = 1 and `tabSupplier Quotation`.`approval_status` = "Approved" and %(cond)s `tabSupplier Quotation`.%(key)s LIKE "%s" ORDER BY `tabSupplier Quotation`.`name` DESC LIMIT 50', {company:doc.company,cond:cond});
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//========================= Get Last Purhase Rate =====================================
|
||||
cur_frm.cscript['Get Last Purchase Rate'] = function(doc, cdt, cdn){
|
||||
$c_obj(make_doclist(doc.doctype, doc.name), 'get_last_purchase_rate', '',
|
||||
function(r, rt) {
|
||||
refresh_field(cur_frm.cscript.fname);
|
||||
var doc = locals[cdt][cdn];
|
||||
cur_frm.cscript.calc_amount( doc, 2);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
//========================= Make Purchase Receipt =======================================================
|
||||
cur_frm.cscript['Make Purchase Receipt'] = function() {
|
||||
n = createLocal('Purchase Receipt');
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals['Purchase Receipt'][n]]),
|
||||
'from_doctype': cur_frm.doc.doctype,
|
||||
'to_doctype':'Purchase Receipt',
|
||||
'from_docname':cur_frm.doc.name,
|
||||
'from_to_list':"[['Purchase Order','Purchase Receipt'],['PO Detail','Purchase Receipt Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
|
||||
}, function(r,rt) {
|
||||
loaddoc('Purchase Receipt', n);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//========================== Make Purchase Invoice =====================================================
|
||||
cur_frm.cscript['Make Purchase Invoice'] = function() {
|
||||
n = createLocal('Payable Voucher');
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals['Payable Voucher'][n]]),
|
||||
'from_doctype':cur_frm.doc.doctype,
|
||||
'to_doctype':'Payable Voucher',
|
||||
'from_docname': cur_frm.doc.name,
|
||||
'from_to_list':"[['Purchase Order','Payable Voucher'],['PO Detail','PV Detail'],['Purchase Tax Detail','Purchase Tax Detail']]"
|
||||
}, function(r,rt) {
|
||||
loaddoc('Payable Voucher', n);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Stop PURCHASE ORDER
|
||||
// ==================================================================================================
|
||||
cur_frm.cscript['Stop Purchase Order'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
var check = confirm("Do you really want to STOP " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Unstop PURCHASE ORDER
|
||||
// ==================================================================================================
|
||||
cur_frm.cscript['Unstop Purchase Order'] = function() {
|
||||
var doc = cur_frm.doc;
|
||||
var check = confirm("Do you really want to UNSTOP " + doc.name);
|
||||
|
||||
if (check) {
|
||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||
cur_frm.refresh();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// ***************** Get Print Heading *****************
|
||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
|
||||
}
|
||||
//****************** For print sales order no and date*************************
|
||||
cur_frm.pformat.indent_no = function(doc, cdt, cdn){
|
||||
//function to make row of table
|
||||
|
||||
var make_row = function(title,val1, val2, bold){
|
||||
var bstart = '<b>'; var bend = '</b>';
|
||||
|
||||
return '<tr><td style="width:39%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
|
||||
+'<td style="width:61%;text-align:left;">'+val1+(val2?' ('+dateutil.str_to_user(val2)+')':'')+'</td>'
|
||||
+'</tr>'
|
||||
}
|
||||
|
||||
out ='';
|
||||
|
||||
var cl = getchildren('PO Detail',doc.name,'po_details');
|
||||
|
||||
// outer table
|
||||
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 50%"></td><td>';
|
||||
|
||||
// main table
|
||||
out +='<table class="noborder" style="width:100%">';
|
||||
|
||||
// add rows
|
||||
if(cl.length){
|
||||
prevdoc_list = new Array();
|
||||
for(var i=0;i<cl.length;i++){
|
||||
if(cl[i].prevdoc_doctype == 'Indent' && cl[i].prevdoc_docname && prevdoc_list.indexOf(cl[i].prevdoc_docname) == -1) {
|
||||
prevdoc_list.push(cl[i].prevdoc_docname);
|
||||
if(prevdoc_list.length ==1)
|
||||
out += make_row(cl[i].prevdoc_doctype, cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
|
||||
else
|
||||
out += make_row('', cl[i].prevdoc_docname, cl[i].prevdoc_date,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out +='</table></td></tr></table></div>';
|
||||
|
||||
return out;
|
||||
}
|
||||
351
buying/doctype/purchase_order/purchase_order.py
Normal file
351
buying/doctype/purchase_order/purchase_order.py
Normal file
@@ -0,0 +1,351 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
from utilities.transaction_base import TransactionBase
|
||||
|
||||
class DocType(TransactionBase):
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.defaults = get_defaults()
|
||||
self.tname = 'PO Detail'
|
||||
self.fname = 'po_details'
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
def get_default_schedule_date(self):
|
||||
get_obj(dt = 'Purchase Common').get_default_schedule_date(self)
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'PO Date')
|
||||
|
||||
|
||||
# Client Trigger Functions
|
||||
#----------------------------------------------------------------------------------------------------
|
||||
# Get Supplier Details
|
||||
#def get_supplier_details(self, name = ''):
|
||||
#return cstr(get_obj(dt='Purchase Common').get_supplier_details(name))
|
||||
|
||||
# Get Item Details
|
||||
def get_item_details(self, arg =''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_item_details(self,arg))
|
||||
|
||||
# Get UOM Details
|
||||
def get_uom_details(self, arg = ''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_uom_details(arg))
|
||||
|
||||
# get available qty at warehouse
|
||||
def get_bin_details(self, arg = ''):
|
||||
return cstr(get_obj(dt='Purchase Common').get_bin_details(arg))
|
||||
|
||||
# Pull Indent
|
||||
def get_indent_details(self):
|
||||
#self.validate_prev_docname()
|
||||
if self.doc.indent_no:
|
||||
get_obj('DocType Mapper','Indent-Purchase Order').dt_map('Indent','Purchase Order',self.doc.indent_no, self.doc, self.doclist, "[['Indent','Purchase Order'],['Indent Detail', 'PO Detail']]")
|
||||
for d in getlist(self.doclist, 'po_details'):
|
||||
if d.item_code:
|
||||
item = sql("select last_purchase_rate from tabItem where name = '%s'" %(d.item_code), as_dict=1)
|
||||
d.purchase_rate = item and flt(item[0]['last_purchase_rate']) or 0
|
||||
d.import_rate = flt(item and flt(item[0]['last_purchase_rate']) or 0) / flt(self.doc.fields.has_key('conversion_rate') and flt(self.doc.conversion_rate) or 1)
|
||||
if self.doc.supplier_qtn:
|
||||
get_obj('DocType Mapper','Supplier Quotation-Purchase Order').dt_map('Supplier Quotation','Purchase Order',self.doc.supplier_qtn, self.doc, self.doclist, "[['Supplier Quotation','Purchase Order'],['Supplier Quotation Detail', 'PO Detail']]")
|
||||
|
||||
# GET TERMS & CONDITIONS
|
||||
# =====================================================================================
|
||||
def get_tc_details(self):
|
||||
return get_obj('Purchase Common').get_tc_details(self)
|
||||
|
||||
# validate if indent has been pulled twice
|
||||
def validate_prev_docname(self):
|
||||
for d in getlist(self.doclist, 'po_details'):
|
||||
if d.prevdoc_docname and self.doc.indent_no == d.prevdoc_docname:
|
||||
msgprint(cstr(self.doc.indent_no) + " indent details have already been pulled. ")
|
||||
raise Exception
|
||||
|
||||
# get last purchase rate
|
||||
def get_last_purchase_rate(self):
|
||||
get_obj('Purchase Common').get_last_purchase_rate(self)
|
||||
|
||||
# validation
|
||||
#-------------------------------------------------------------------------------------------------------------
|
||||
def validate_doc(self,pc_obj):
|
||||
# Please Check Supplier Quotation - Purchase ORder Transaction , it has to be discussed
|
||||
if self.doc.supp_quo_no:
|
||||
pc_obj.validate_doc(obj = self, prevdoc_doctype = 'Supplier Quotation', prevdoc_docname = cstr(self.doc.supp_quo_no))
|
||||
else:
|
||||
# Validate values with reference document
|
||||
pc_obj.validate_reference_value(obj = self)
|
||||
|
||||
# Check for Stopped status
|
||||
def check_for_stopped_status(self, pc_obj):
|
||||
check_list =[]
|
||||
for d in getlist(self.doclist, 'po_details'):
|
||||
if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname and d.prevdoc_docname not in check_list:
|
||||
check_list.append(d.prevdoc_docname)
|
||||
pc_obj.check_for_stopped_status( d.prevdoc_doctype, d.prevdoc_docname)
|
||||
|
||||
|
||||
# Validate
|
||||
def validate(self):
|
||||
self.validate_fiscal_year()
|
||||
# Step 1:=> set status as "Draft"
|
||||
set(self.doc, 'status', 'Draft')
|
||||
|
||||
# Step 2:=> get Purchase Common Obj
|
||||
pc_obj = get_obj(dt='Purchase Common')
|
||||
|
||||
# Step 3:=> validate mandatory
|
||||
pc_obj.validate_mandatory(self)
|
||||
|
||||
# Step 4:=> validate for items
|
||||
pc_obj.validate_for_items(self)
|
||||
|
||||
# Step 5:=> validate conversion rate
|
||||
pc_obj.validate_conversion_rate(self)
|
||||
|
||||
# Get po date
|
||||
pc_obj.get_prevdoc_date(self)
|
||||
|
||||
# validate_doc
|
||||
self.validate_doc(pc_obj)
|
||||
|
||||
# Check for stopped status
|
||||
self.check_for_stopped_status(pc_obj)
|
||||
|
||||
|
||||
# get total in words
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
||||
|
||||
# update bin
|
||||
# ----------
|
||||
def update_bin(self, is_submit, is_stopped = 0):
|
||||
pc_obj = get_obj('Purchase Common')
|
||||
for d in getlist(self.doclist, 'po_details'):
|
||||
#1. Check if is_stock_item == 'Yes'
|
||||
if sql("select is_stock_item from tabItem where name=%s", d.item_code)[0][0]=='Yes':
|
||||
|
||||
ind_qty, po_qty = 0, flt(d.qty) * flt(d.conversion_factor)
|
||||
if is_stopped:
|
||||
po_qty = flt(d.qty) > flt(d.received_qty) and flt( flt(flt(d.qty) - flt(d.received_qty)) * flt(d.conversion_factor))or 0
|
||||
|
||||
# No updates in Indent on Stop / Unstop
|
||||
if cstr(d.prevdoc_doctype) == 'Indent' and not is_stopped:
|
||||
# get qty and pending_qty of prevdoc
|
||||
curr_ref_qty = pc_obj.get_qty( d.doctype, 'prevdoc_detail_docname', d.prevdoc_detail_docname, 'Indent Detail', 'Indent - Purchase Order', self.doc.name)
|
||||
max_qty, qty, curr_qty = flt(curr_ref_qty.split('~~~')[1]), flt(curr_ref_qty.split('~~~')[0]), 0
|
||||
|
||||
if flt(qty) + flt(po_qty) > flt(max_qty):
|
||||
curr_qty = flt(max_qty) - flt(qty)
|
||||
# special case as there is no restriction for Indent - Purchase Order
|
||||
curr_qty = (curr_qty > 0) and curr_qty or 0
|
||||
else:
|
||||
curr_qty = flt(po_qty)
|
||||
|
||||
ind_qty = -flt(curr_qty)
|
||||
|
||||
#==> Update Bin's Indent Qty by +- ind_qty and Ordered Qty by +- qty
|
||||
get_obj('Warehouse', d.warehouse).update_bin(0, 0, (is_submit and 1 or -1) * flt(po_qty), (is_submit and 1 or -1) * flt(ind_qty), 0, d.item_code, self.doc.transaction_date)
|
||||
|
||||
def check_modified_date(self):
|
||||
mod_db = sql("select modified from `tabPurchase Order` where name = '%s'" % self.doc.name)
|
||||
date_diff = sql("select TIMEDIFF('%s', '%s')" % ( mod_db[0][0],cstr(self.doc.modified)))
|
||||
|
||||
if date_diff and date_diff[0][0]:
|
||||
msgprint(cstr(self.doc.doctype) +" => "+ cstr(self.doc.name) +" has been modified. Please Refresh. ")
|
||||
raise Exception
|
||||
|
||||
# On Close
|
||||
#-------------------------------------------------------------------------------------------------
|
||||
def update_status(self, status):
|
||||
self.check_modified_date()
|
||||
# step 1:=> Set Status
|
||||
set(self.doc,'status',cstr(status))
|
||||
|
||||
# step 2:=> Update Bin
|
||||
self.update_bin(is_submit = (status == 'Submitted') and 1 or 0, is_stopped = 1)
|
||||
|
||||
# step 3:=> Acknowledge user
|
||||
msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)))
|
||||
|
||||
|
||||
# On Submit
|
||||
def on_submit(self):
|
||||
pc_obj = get_obj(dt ='Purchase Common')
|
||||
|
||||
# Step 1 :=> Update Previous Doc i.e. update pending_qty and Status accordingly
|
||||
pc_obj.update_prevdoc_detail(self, is_submit = 1)
|
||||
|
||||
# Step 2 :=> Update Bin
|
||||
self.update_bin(is_submit = 1, is_stopped = 0)
|
||||
|
||||
# Step 3 :=> Check For Approval Authority
|
||||
get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total)
|
||||
|
||||
# Step 4 :=> Update Current PO No. in Supplier as last_purchase_order.
|
||||
update_supplier = sql("update `tabSupplier` set last_purchase_order = '%s' where name = '%s'" % (self.doc.name, self.doc.supplier))
|
||||
|
||||
# Step 5 :=> Update last purchase rate
|
||||
pc_obj.update_last_purchase_rate(self, is_submit = 1)
|
||||
|
||||
# Step 6 :=> Set Status
|
||||
set(self.doc,'status','Submitted')
|
||||
|
||||
self.doc.indent_no = '';
|
||||
|
||||
# on submit notification
|
||||
get_obj('Notification Control').notify_contact('Purchase Order', self.doc.doctype,self.doc.name, self.doc.email_id, self.doc.contact_person)
|
||||
|
||||
# On Cancel
|
||||
# -------------------------------------------------------------------------------------------------------
|
||||
def on_cancel(self):
|
||||
pc_obj = get_obj(dt = 'Purchase Common')
|
||||
|
||||
# 1.Check if PO status is stopped
|
||||
pc_obj.check_for_stopped_status(cstr(self.doc.doctype), cstr(self.doc.name))
|
||||
|
||||
self.check_for_stopped_status(pc_obj)
|
||||
|
||||
# 2.Check if Purchase Receipt has been submitted against current Purchase Order
|
||||
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Receipt', docname = self.doc.name, detail_doctype = 'Purchase Receipt Detail')
|
||||
|
||||
# 3.Check if Payable Voucher has been submitted against current Purchase Order
|
||||
#pc_obj.check_docstatus(check = 'Next', doctype = 'Payable Voucher', docname = self.doc.name, detail_doctype = 'PV Detail')
|
||||
|
||||
submitted = sql("select t1.name from `tabPayable Voucher` t1,`tabPV Detail` t2 where t1.name = t2.parent and t2.purchase_order = '%s' and t1.docstatus = 1" % self.doc.name)
|
||||
if submitted:
|
||||
msgprint("Purchase Invoice : " + cstr(submitted[0][0]) + " has already been submitted !")
|
||||
raise Exception
|
||||
|
||||
# 4.Set Status as Cancelled
|
||||
set(self.doc,'status','Cancelled')
|
||||
|
||||
# 5.Update Indents Pending Qty and accordingly it's Status
|
||||
pc_obj.update_prevdoc_detail(self,is_submit = 0)
|
||||
|
||||
# 6.Update Bin
|
||||
self.update_bin( is_submit = 0, is_stopped = 0)
|
||||
|
||||
# Step 7 :=> Update last purchase rate
|
||||
pc_obj.update_last_purchase_rate(self, is_submit = 0)
|
||||
|
||||
#----------- code for Sub-contracted Items -------------------
|
||||
#--------check for sub-contracted items and accordingly update PO raw material detail table--------
|
||||
def update_rw_material_detail(self):
|
||||
for d in getlist(self.doclist,'po_details'):
|
||||
item_det = sql("select is_sub_contracted_item, is_purchase_item from `tabItem` where name = '%s'"%(d.item_code))
|
||||
|
||||
if item_det[0][0] == 'Yes':
|
||||
if item_det[0][1] == 'Yes':
|
||||
if not self.doc.is_subcontracted:
|
||||
msgprint("Please enter whether purchase order to be made for subcontracting or for purchasing in 'Is Subcontracted' field .")
|
||||
raise Exception
|
||||
if self.doc.is_subcontracted == 'Yes':
|
||||
self.add_bom(d)
|
||||
else:
|
||||
self.doc.clear_table(self.doclist,'po_raw_material_details',1)
|
||||
self.doc.save()
|
||||
elif item_det[0][1] == 'No':
|
||||
self.add_bom(d)
|
||||
|
||||
self.delete_irrelevant_raw_material()
|
||||
#---------------calculate amt in PO Raw Material Detail-------------
|
||||
self.calculate_amount(d)
|
||||
|
||||
def add_bom(self, d):
|
||||
#----- fetching default bom from Bill of Materials instead of Item Master --
|
||||
bom_det = sql("select t1.item, t2.item_code, t2.qty_consumed_per_unit, t2.moving_avg_rate, t2.value_as_per_mar, t2.stock_uom, t2.name, t2.parent from `tabBill Of Materials` t1, `tabBOM Material` t2 where t2.parent = t1.name and t1.item = '%s' and ifnull(t1.is_default,0) = 1 and t1.docstatus = 1" % d.item_code)
|
||||
|
||||
if not bom_det:
|
||||
msgprint("No default BOM exists for item: %s" % d.item_code)
|
||||
raise Exception
|
||||
else:
|
||||
#-------------- add child function--------------------
|
||||
chgd_rqd_qty = []
|
||||
for i in bom_det:
|
||||
if i and not sql("select name from `tabPO Raw Material Detail` where reference_name = '%s' and bom_detail_no = '%s' and parent = '%s' " %(d.name, i[6], self.doc.name)):
|
||||
|
||||
rm_child = addchild(self.doc, 'po_raw_material_details', 'PO Raw Material Detail', 1, self.doclist)
|
||||
|
||||
rm_child.reference_name = d.name
|
||||
rm_child.bom_detail_no = i and i[6] or ''
|
||||
rm_child.main_item_code = i and i[0] or ''
|
||||
rm_child.rm_item_code = i and i[1] or ''
|
||||
rm_child.stock_uom = i and i[5] or ''
|
||||
rm_child.rate = i and flt(i[3]) or flt(i[4])
|
||||
rm_child.conversion_factor = d.conversion_factor
|
||||
rm_child.required_qty = flt(i and flt(i[2]) or 0) * flt(d.qty) * flt(d.conversion_factor)
|
||||
rm_child.amount = flt(flt(rm_child.consumed_qty)*flt(rm_child.rate))
|
||||
rm_child.save()
|
||||
chgd_rqd_qty.append(cstr(i[1]))
|
||||
else:
|
||||
act_qty = flt(i and flt(i[2]) or 0) * flt(d.qty) * flt(d.conversion_factor)
|
||||
for po_rmd in getlist(self.doclist, 'po_raw_material_details'):
|
||||
if i and i[6] == po_rmd.bom_detail_no and (flt(act_qty) != flt(po_rmd.required_qty) or i[1] != po_rmd.rm_item_code):
|
||||
chgd_rqd_qty.append(cstr(i[1]))
|
||||
po_rmd.main_item_code = i[0]
|
||||
po_rmd.rm_item_code = i[1]
|
||||
po_rmd.stock_uom = i[5]
|
||||
po_rmd.required_qty = flt(act_qty)
|
||||
po_rmd.rate = i and flt(i[3]) or flt(i[4])
|
||||
po_rmd.amount = flt(flt(po_rmd.consumed_qty)*flt(po_rmd.rate))
|
||||
|
||||
|
||||
# Delete irrelevant raw material from PR Raw material details
|
||||
#--------------------------------------------------------------
|
||||
def delete_irrelevant_raw_material(self):
|
||||
for d in getlist(self.doclist,'po_raw_material_details'):
|
||||
if not sql("select name from `tabPO Detail` where name = '%s' and parent = '%s'and item_code = '%s'" % (d.reference_name, self.doc.name, d.main_item_code)):
|
||||
d.parent = 'old_par:'+self.doc.name
|
||||
d.save()
|
||||
|
||||
def calculate_amount(self, d):
|
||||
amt = 0
|
||||
for i in getlist(self.doclist,'po_raw_material_details'):
|
||||
|
||||
if(i.reference_name == d.name):
|
||||
i.amount = flt(i.required_qty)* flt(i.rate)
|
||||
amt += i.amount
|
||||
d.rm_supp_cost = amt
|
||||
|
||||
# On Update
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
def on_update(self):
|
||||
self.update_rw_material_detail()
|
||||
|
||||
|
||||
# OTHER CHARGES TRIGGER FUNCTIONS
|
||||
# ====================================================================================
|
||||
|
||||
# *********** Get Tax rate if account type is TAX ********************
|
||||
def get_rate(self,arg):
|
||||
return get_obj('Purchase Common').get_rate(arg,self)
|
||||
|
||||
# **** Pull details from other charges master (Get Other Charges) ****
|
||||
def get_purchase_tax_details(self):
|
||||
return get_obj('Purchase Common').get_purchase_tax_details(self)
|
||||
|
||||
# Repair Purchase Order
|
||||
# ===========================================
|
||||
def repair_purchase_order(self):
|
||||
get_obj('Purchase Common', 'Purchase Common').repair_curr_doctype_details(self)
|
||||
1123
buying/doctype/purchase_order/purchase_order.txt
Normal file
1123
buying/doctype/purchase_order/purchase_order.txt
Normal file
File diff suppressed because it is too large
Load Diff
0
buying/doctype/purchase_other_charges/__init__.py
Normal file
0
buying/doctype/purchase_other_charges/__init__.py
Normal file
160
buying/doctype/purchase_other_charges/purchase_other_charges.js
Normal file
160
buying/doctype/purchase_other_charges/purchase_other_charges.js
Normal file
@@ -0,0 +1,160 @@
|
||||
//$import(Tips Common)
|
||||
|
||||
//--------- ONLOAD -------------
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
cur_frm.cscript.get_tips(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.pformat.purchase_tax_details= function(doc){
|
||||
|
||||
//function to make row of table
|
||||
var make_row = function(title,val,bold){
|
||||
var bstart = '<b>'; var bend = '</b>';
|
||||
return '<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
|
||||
+'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
|
||||
+'<td style="width:25%;text-align:right;">'+val+'</td>'
|
||||
+'</tr>'
|
||||
}
|
||||
|
||||
function convert_rate(val){
|
||||
var new_val = flt(val)/flt(doc.conversion_rate);
|
||||
return new_val;
|
||||
}
|
||||
|
||||
var cl = getchildren('Purchase Tax Detail',doc.name,'purchase_tax_details');
|
||||
|
||||
// outer table
|
||||
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
|
||||
|
||||
// main table
|
||||
out +='<table class="noborder" style="width:100%">'+make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);
|
||||
|
||||
// add rows
|
||||
if(cl.length){
|
||||
for(var i=0;i<cl.length;i++){
|
||||
out += make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);
|
||||
}
|
||||
}
|
||||
|
||||
// grand total
|
||||
out +=make_row('Grand Total',fmt_money(doc.grand_total_import),1)
|
||||
if(doc.in_words_import){
|
||||
out +='</table></td></tr>';
|
||||
out += '<tr><td colspan = "2">';
|
||||
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
|
||||
out+= '<td style="width:50%;">'+doc.in_words_import+'</td></tr>';
|
||||
}
|
||||
out +='</table></td></tr></table></div>';
|
||||
return out;
|
||||
}
|
||||
|
||||
cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.category && d.add_deduct_tax){
|
||||
alert("Please select Category first");
|
||||
d.add_deduct_tax = '';
|
||||
}
|
||||
else if(d.category != 'For Total' && d.add_deduct_tax == 'Deduct'){
|
||||
alert("You cannot Deduct when category is for valuation or for both(i.e total and valuation)");
|
||||
d.add_deduct_tax = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cur_frm.cscript.charge_type = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.category && d.charge_type){
|
||||
alert("Please select Category first");
|
||||
d.charge_type = '';
|
||||
}
|
||||
else if(d.idx == 1 && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
|
||||
alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");
|
||||
d.charge_type = '';
|
||||
}
|
||||
else if((d.category == 'For Valuation' || d.category == 'For Both') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){
|
||||
alert("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'For Total' option for previous row amount or previous row total")
|
||||
d.charge_type = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('charge_type',d.name,'purchase_tax_details');
|
||||
|
||||
cur_frm.cscript.row_id(doc, cdt, cdn);
|
||||
cur_frm.cscript.rate(doc, cdt, cdn);
|
||||
cur_frm.cscript.tax_amount(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.row_id = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.row_id){
|
||||
alert("Please select Charge Type first");
|
||||
d.row_id = '';
|
||||
}
|
||||
else if((d.charge_type == 'Actual' || d.charge_type == 'On Net Total') && d.row_id) {
|
||||
alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");
|
||||
d.row_id = '';
|
||||
}
|
||||
else if((d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total') && d.row_id){
|
||||
if(d.row_id >= d.idx){
|
||||
alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");
|
||||
d.row_id = '';
|
||||
}
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('row_id',d.name,'purchase_tax_details');
|
||||
}
|
||||
|
||||
/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
|
||||
|
||||
cur_frm.fields_dict['purchase_tax_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.name LIKE "%s"'
|
||||
}
|
||||
|
||||
//--------------------filter other charges master company-wise-----------------------------------------
|
||||
/*
|
||||
cur_frm.fields_dict.charge.get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.docstatus !=2 AND `tabOther Charges`.name LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';
|
||||
}
|
||||
*/
|
||||
|
||||
cur_frm.cscript.account_head = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.account_head){
|
||||
alert("Please select Charge Type first");
|
||||
validated = false;
|
||||
d.account_head = '';
|
||||
}
|
||||
else if(d.account_head && d.charge_type) {
|
||||
arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
|
||||
get_server_fields('get_rate', arg, 'purchase_tax_details', doc, cdt, cdn, 1);
|
||||
}
|
||||
refresh_field('account_head',d.name,'purchase_tax_details');
|
||||
}
|
||||
|
||||
cur_frm.cscript.rate = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.rate) {
|
||||
alert("Please select Charge Type first");
|
||||
d.rate = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('rate',d.name,'purchase_tax_details');
|
||||
}
|
||||
|
||||
cur_frm.cscript.tax_amount = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.tax_amount){
|
||||
alert("Please select Charge Type first");
|
||||
d.tax_amount = '';
|
||||
}
|
||||
else if(d.charge_type && d.tax_amount) {
|
||||
alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");
|
||||
d.tax_amount = '';
|
||||
}
|
||||
validated = false;
|
||||
refresh_field('tax_amount',d.name,'purchase_tax_details');
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# Get Tax Rate if account type is Tax
|
||||
# ===================================================================
|
||||
def get_rate(self, arg):
|
||||
return get_obj('Purchase Common').get_rate(arg, self)
|
||||
123
buying/doctype/purchase_other_charges/purchase_other_charges.txt
Normal file
123
buying/doctype/purchase_other_charges/purchase_other_charges.txt
Normal file
@@ -0,0 +1,123 @@
|
||||
# DocType, Purchase Other Charges
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:15',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 17:30:25',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'wasim@webnotestech.com'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'allow_trash': 1,
|
||||
'autoname': 'field:title',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 16
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Purchase Other Charges',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Purchase Other Charges',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Purchase Other Charges
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Purchase Other Charges'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 1,
|
||||
'role': 'All'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 0,
|
||||
'role': 'Purchase Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'role': 'Purchase Master Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'title',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'in_filter': 1,
|
||||
'label': 'Title',
|
||||
'oldfieldname': 'title',
|
||||
'oldfieldtype': 'Data',
|
||||
'reqd': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'purchase_tax_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 2,
|
||||
'label': 'Purchase Tax Details',
|
||||
'oldfieldname': 'purchase_tax_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Purchase Tax Detail'
|
||||
}
|
||||
]
|
||||
0
buying/doctype/qa_inspection_report/__init__.py
Normal file
0
buying/doctype/qa_inspection_report/__init__.py
Normal file
26
buying/doctype/qa_inspection_report/qa_inspection_report.js
Normal file
26
buying/doctype/qa_inspection_report/qa_inspection_report.js
Normal file
@@ -0,0 +1,26 @@
|
||||
cur_frm.cscript.item_code = function(doc, cdt, cdn) {
|
||||
if (doc.item_code)
|
||||
get_server_fields('get_purchase_receipt_item_details','','',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
cur_frm.cscript.inspection_type = function(doc, cdt, cdn) {
|
||||
if(doc.inspection_type == 'Incoming'){
|
||||
doc.delivery_note_no = '';
|
||||
hide_field('delivery_note_no');
|
||||
unhide_field('purchase_receipt_no');
|
||||
}
|
||||
else if(doc.inspection_type == 'Outgoing'){
|
||||
doc.purchase_receipt_no = '';
|
||||
unhide_field('delivery_note_no');
|
||||
hide_field('purchase_receipt_no');
|
||||
|
||||
}
|
||||
else {
|
||||
doc.purchase_receipt_no = '';
|
||||
doc.delivery_note_no = '';
|
||||
hide_field('purchase_receipt_no');
|
||||
hide_field('delivery_note_no');
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
|
||||
47
buying/doctype/qa_inspection_report/qa_inspection_report.py
Normal file
47
buying/doctype/qa_inspection_report/qa_inspection_report.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
# Autoname
|
||||
# ---------
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
|
||||
def get_item_specification_details(self):
|
||||
self.doc.clear_table(self.doclist, 'qa_specification_details')
|
||||
specification = sql("select specification, value from `tabItem Specification Detail` where parent = '%s' order by idx" % (self.doc.item_code))
|
||||
for d in specification:
|
||||
child = addchild(self.doc, 'qa_specification_details', 'QA Specification Detail', 1, self.doclist)
|
||||
child.specification = d[0]
|
||||
child.value = d[1]
|
||||
child.status = 'Accepted'
|
||||
|
||||
def on_submit(self):
|
||||
if self.doc.purchase_receipt_no:
|
||||
sql("update `tabPurchase Receipt Detail` set qa_no = '%s' where parent = '%s' and item_code = '%s'" % (self.doc.name, self.doc.purchase_receipt_no, self.doc.item_code))
|
||||
|
||||
|
||||
def on_cancel(self):
|
||||
if self.doc.purchase_receipt_no:
|
||||
sql("update `tabPurchase Receipt Detail` set qa_no = '' where parent = '%s' and item_code = '%s'" % (self.doc.purchase_receipt_no, self.doc.item_code))
|
||||
359
buying/doctype/qa_inspection_report/qa_inspection_report.txt
Normal file
359
buying/doctype/qa_inspection_report/qa_inspection_report.txt
Normal file
@@ -0,0 +1,359 @@
|
||||
# DocType, QA Inspection Report
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:17',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-04-08 10:53:33',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'print_outline': 'Yes',
|
||||
'search_fields': 'item_code, report_date, purchase_receipt_no, delivery_note_no',
|
||||
'section_style': 'Simple',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 37
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'QA Inspection Report',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'QA Inspection Report',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1,
|
||||
'role': 'Quality Manager'
|
||||
},
|
||||
|
||||
# DocType, QA Inspection Report
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'QA Inspection Report'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'QA Inspection',
|
||||
'no_copy': 0,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 2,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 3,
|
||||
'label': 'Naming Series',
|
||||
'no_copy': 1,
|
||||
'options': '\nQAI/11-12/',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'inspection_type',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'in_filter': 1,
|
||||
'label': 'Inspection Type',
|
||||
'oldfieldname': 'inspection_type',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nIncoming\nOutgoing\nIn Process',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'report_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 5,
|
||||
'in_filter': 1,
|
||||
'label': 'Report Date',
|
||||
'oldfieldname': 'report_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_code',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 6,
|
||||
'in_filter': 1,
|
||||
'label': 'Item Code',
|
||||
'oldfieldname': 'item_code',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'sample_size',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'in_filter': 0,
|
||||
'label': 'Sample Size',
|
||||
'oldfieldname': 'sample_size',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 8,
|
||||
'in_filter': 1,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0,
|
||||
'search_index': 0,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 9,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'item_serial_no',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 10,
|
||||
'label': 'Item Serial No',
|
||||
'oldfieldname': 'item_serial_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Serial No',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'batch_no',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 11,
|
||||
'label': 'Batch No',
|
||||
'oldfieldname': 'batch_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Batch',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'purchase_receipt_no',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 12,
|
||||
'in_filter': 1,
|
||||
'label': 'Purchase Receipt No',
|
||||
'oldfieldname': 'purchase_receipt_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Purchase Receipt',
|
||||
'permlevel': 0,
|
||||
'search_index': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'delivery_note_no',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 0,
|
||||
'idx': 13,
|
||||
'in_filter': 1,
|
||||
'label': 'Delivery Note No',
|
||||
'oldfieldname': 'delivery_note_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Delivery Note',
|
||||
'permlevel': 0,
|
||||
'print_hide': 0,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'inspected_by',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 14,
|
||||
'label': 'Inspected By',
|
||||
'oldfieldname': 'inspected_by',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'remarks',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 15,
|
||||
'label': 'Remarks',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'remarks',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'verified_by',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 16,
|
||||
'label': 'Verified By',
|
||||
'oldfieldname': 'verified_by',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 17,
|
||||
'label': 'Amended From',
|
||||
'oldfieldname': 'amended_from',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amendment_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 18,
|
||||
'label': 'Amendment Date',
|
||||
'oldfieldname': 'amendment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 19,
|
||||
'label': 'Specification Details',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 20,
|
||||
'label': 'Get Specification Details',
|
||||
'oldfieldtype': 'Button',
|
||||
'options': 'get_item_specification_details',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qa_specification_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 21,
|
||||
'label': 'QA Specification Details',
|
||||
'oldfieldname': 'qa_specification_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'QA Specification Detail',
|
||||
'permlevel': 0
|
||||
}
|
||||
]
|
||||
0
buying/doctype/qa_specification_detail/__init__.py
Normal file
0
buying/doctype/qa_specification_detail/__init__.py
Normal file
@@ -0,0 +1,188 @@
|
||||
# DocType, QA Specification Detail
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:17',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'QASD/.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 2
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'QA Specification Detail',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocType, QA Specification Detail
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'QA Specification Detail'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'specification',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 1,
|
||||
'label': 'Parameter',
|
||||
'oldfieldname': 'specification',
|
||||
'oldfieldtype': 'Data',
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'value',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Acceptance Criteria',
|
||||
'oldfieldname': 'value',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_1',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 3,
|
||||
'label': 'Reading 1',
|
||||
'oldfieldname': 'reading_1',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_2',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 4,
|
||||
'label': 'Reading 2',
|
||||
'oldfieldname': 'reading_2',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_3',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 5,
|
||||
'label': 'Reading 3',
|
||||
'oldfieldname': 'reading_3',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_4',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 6,
|
||||
'label': 'Reading 4',
|
||||
'oldfieldname': 'reading_4',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_5',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 7,
|
||||
'label': 'Reading 5',
|
||||
'oldfieldname': 'reading_5',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_6',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 8,
|
||||
'label': 'Reading 6',
|
||||
'oldfieldname': 'reading_6',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_7',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 9,
|
||||
'label': 'Reading 7',
|
||||
'oldfieldname': 'reading_7',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_8',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 10,
|
||||
'label': 'Reading 8',
|
||||
'oldfieldname': 'reading_8',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_9',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 11,
|
||||
'label': 'Reading 9',
|
||||
'oldfieldname': 'reading_9',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'reading_10',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 12,
|
||||
'label': 'Reading 10',
|
||||
'oldfieldname': 'reading_10',
|
||||
'oldfieldtype': 'Data'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': 'Accepted',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 13,
|
||||
'label': 'Status',
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'Accepted\nRejected'
|
||||
}
|
||||
]
|
||||
0
buying/doctype/raw_materials_supplied/__init__.py
Normal file
0
buying/doctype/raw_materials_supplied/__init__.py
Normal file
148
buying/doctype/raw_materials_supplied/raw_materials_supplied.txt
Normal file
148
buying/doctype/raw_materials_supplied/raw_materials_supplied.txt
Normal file
@@ -0,0 +1,148 @@
|
||||
# DocType, Raw Materials Supplied
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:18',
|
||||
'docstatus': 0,
|
||||
'modified': '2010-09-20 14:06:57',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'RMS/.######',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'istable': 1,
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'section_style': 'Tray',
|
||||
'show_in_menu': 0,
|
||||
'version': 8
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Raw Materials Supplied',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# DocType, Raw Materials Supplied
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Raw Materials Supplied'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'po_item',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 1,
|
||||
'label': 'PO Item',
|
||||
'oldfieldname': 'po_item',
|
||||
'oldfieldtype': 'Select',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'raw_material',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 2,
|
||||
'label': 'Raw Material',
|
||||
'oldfieldname': 'raw_material',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Item',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'description',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 3,
|
||||
'label': 'Description',
|
||||
'oldfieldname': 'description',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 0,
|
||||
'width': '300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'source_warehouse',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 5,
|
||||
'label': 'Source Warehouse',
|
||||
'oldfieldname': 'source_warehouse',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Warehouse',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'ma_valuation_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 7,
|
||||
'label': 'Valuation Rate (MA)',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'ma_valuation_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fifo_valuation_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 8,
|
||||
'label': 'Valuation Rate (FIFO)',
|
||||
'oldfieldname': 'fifo_valuation_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'qty',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 9,
|
||||
'label': 'Qty',
|
||||
'oldfieldname': 'qty',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'stock_uom',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 12,
|
||||
'label': 'Stock UOM',
|
||||
'oldfieldname': 'stock_uom',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
0
buying/doctype/supplier/__init__.py
Normal file
0
buying/doctype/supplier/__init__.py
Normal file
153
buying/doctype/supplier/supplier.js
Normal file
153
buying/doctype/supplier/supplier.js
Normal file
@@ -0,0 +1,153 @@
|
||||
$import(Contact Control)
|
||||
|
||||
cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
|
||||
// history doctypes and scripts
|
||||
cur_frm.history_dict = {
|
||||
'Purchase Order' : 'cur_frm.cscript.make_po_list(this.body, this.doc)',
|
||||
'Purchase Receipt' : 'cur_frm.cscript.make_pr_list(this.body, this.doc)',
|
||||
'Purchase Invoice' : 'cur_frm.cscript.make_pi_list(this.body, this.doc)'
|
||||
}
|
||||
|
||||
// make contact, history list body
|
||||
//cur_frm.cscript.make_cl_body();
|
||||
cur_frm.cscript.make_hl_body();
|
||||
}
|
||||
|
||||
cur_frm.cscript.refresh = function(doc,dt,dn) {
|
||||
if(sys_defaults.supp_master_name == 'Supplier Name')
|
||||
hide_field('naming_series');
|
||||
else
|
||||
unhide_field('naming_series');
|
||||
|
||||
if(doc.__islocal){
|
||||
hide_field(['Address HTML','Contact HTML']);
|
||||
//if(doc.country) cur_frm.cscript.get_states(doc,dt,dn);
|
||||
// set message
|
||||
//cur_frm.cscript.set_cl_msg(doc);
|
||||
//cur_frm.cscript.set_hl_msg(doc);
|
||||
}
|
||||
else{
|
||||
unhide_field(['Address HTML','Contact HTML']);
|
||||
// make lists
|
||||
cur_frm.cscript.make_address(doc,dt,dn);
|
||||
cur_frm.cscript.make_contact(doc,dt,dn);
|
||||
cur_frm.cscript.make_history(doc,dt,dn);
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_address = function() {
|
||||
if(!cur_frm.address_list) {
|
||||
cur_frm.address_list = new wn.widgets.Listing({
|
||||
parent: cur_frm.fields_dict['Address HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Address",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Address"][dn];
|
||||
ndoc.supplier = cur_frm.doc.name;
|
||||
ndoc.supplier_name = cur_frm.doc.supplier_name;
|
||||
ndoc.address_type = 'Office';
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.address_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, address_type, address_line1, address_line2, city, state, country, pincode, fax, email_id, phone, is_primary_address, is_shipping_address from tabAddress where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_address desc"
|
||||
},
|
||||
as_dict: 1,
|
||||
no_results_message: 'No addresses created',
|
||||
render_row: function(wrapper, data) {
|
||||
$(wrapper).css('padding','5px 0px');
|
||||
var link = $ln(wrapper,cstr(data.name), function() { loaddoc("Address", this.dn); }, {fontWeight:'bold'});
|
||||
link.dn = data.name
|
||||
|
||||
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_address ? '[Primary]' : '') + (data.is_shipping_address ? '[Shipping]' : ''));
|
||||
$a(wrapper,'div','',{marginTop:'5px', color:'#555'},
|
||||
(data.address_line1 ? data.address_line1 + '<br />' : '') +
|
||||
(data.address_line2 ? data.address_line2 + '<br />' : '') +
|
||||
(data.city ? data.city + '<br />' : '') +
|
||||
(data.state ? data.state + ', ' : '') +
|
||||
(data.country ? data.country + '<br />' : '') +
|
||||
(data.pincode ? 'Pincode: ' + data.pincode + '<br />' : '') +
|
||||
(data.phone ? 'Phone: ' + data.phone + '<br />' : '') +
|
||||
(data.fax ? 'Fax: ' + data.fax + '<br />' : '') +
|
||||
(data.email_id ? 'Email: ' + data.email_id + '<br />' : ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
cur_frm.address_list.run();
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_contact = function() {
|
||||
if(!cur_frm.contact_list) {
|
||||
cur_frm.contact_list = new wn.widgets.Listing({
|
||||
parent: cur_frm.fields_dict['Contact HTML'].wrapper,
|
||||
page_length: 2,
|
||||
new_doctype: "Contact",
|
||||
new_doc_onload: function(dn) {
|
||||
ndoc = locals["Contact"][dn];
|
||||
ndoc.supplier = cur_frm.doc.name;
|
||||
ndoc.supplier_name = cur_frm.doc.supplier_name;
|
||||
},
|
||||
new_doc_onsave: function(dn) {
|
||||
cur_frm.contact_list.run()
|
||||
},
|
||||
get_query: function() {
|
||||
return "select name, first_name, last_name, email_id, phone, mobile_no, department, designation, is_primary_contact from tabContact where supplier='"+cur_frm.docname+"' and docstatus != 2 order by is_primary_contact desc"
|
||||
},
|
||||
as_dict: 1,
|
||||
no_results_message: 'No contacts created',
|
||||
render_row: function(wrapper, data) {
|
||||
$(wrapper).css('padding', '5px 0px');
|
||||
var link = $ln(wrapper, cstr(data.name), function() { loaddoc("Contact", this.dn); }, {fontWeight:'bold'});
|
||||
link.dn = data.name
|
||||
|
||||
$a(wrapper,'span','',{marginLeft:'5px', color: '#666'},(data.is_primary_contact ? '[Primary]' : ''));
|
||||
$a(wrapper,'div', '',{marginTop:'5px', color:'#555'}, data.first_name + (data.last_name ? ' ' + data.last_name + '<br />' : '<br>') + (data.phone ? 'Tel: ' + data.phone + '<br />' : '') + (data.mobile_no ? 'Mobile: ' + data.mobile_no + '<br />' : '') + (data.email_id ? 'Email: ' + data.email_id + '<br />' : '') + (data.department ? 'Department: ' + data.department + '<br />' : '') + (data.designation ? 'Designation: ' + data.designation + '<br />' : ''));
|
||||
}
|
||||
});
|
||||
}
|
||||
cur_frm.contact_list.run();
|
||||
}
|
||||
|
||||
// make purchase order list
|
||||
cur_frm.cscript.make_po_list = function(parent, doc){
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','25%','20%','25%','25%'];
|
||||
lst.colnames = ['Sr.','Id','Status','PO Date','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Currency'];
|
||||
lst.coloptions = ['','Purchase Order','','','',''];
|
||||
|
||||
var q = repl("select name,status,transaction_date, grand_total from `tabPurchase Order` where supplier='%(sup)s' order by transaction_date desc", {'sup':doc.name});
|
||||
var q_max = repl("select count(name) from `tabPurchase Order` where supplier='%(sup)s'", {'sup':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Order','Purchase Order');
|
||||
}
|
||||
|
||||
// make purchase receipt list
|
||||
cur_frm.cscript.make_pr_list = function(parent,doc){
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
|
||||
lst.colnames = ['Sr.','Id','Status','Receipt Date','% Billed','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
|
||||
lst.coloptions = ['','Purchase Receipt','','','',''];
|
||||
|
||||
var q = repl("select name,status,transaction_date,per_billed,grand_total from `tabPurchase Receipt` where supplier='%(sup)s' order by transaction_date desc", {'sup':doc.name});
|
||||
var q_max = repl("select count(name) from `tabPurchase Receipt` where supplier='%(sup)s'", {'sup':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Receipt','Purchase Receipt');
|
||||
}
|
||||
|
||||
// make purchase invoice list
|
||||
cur_frm.cscript.make_pi_list = function(parent,doc){
|
||||
var lst = new Listing();
|
||||
lst.colwidths = ['5%','20%','20%','20%','15%','20%'];
|
||||
lst.colnames = ['Sr.','Id','Posting Date','Credit To','Bill Date','Grand Total'];
|
||||
lst.coltypes = ['Data','Link','Data','Data','Currency','Currency'];
|
||||
lst.coloptions = ['','Payable Voucher','','','',''];
|
||||
|
||||
var q = repl("select name, posting_date, credit_to, bill_date, grand_total from `tabPayable Voucher` where supplier='%(sup)s' order by posting_date desc", {'sup':doc.name});
|
||||
var q_max = repl("select count(name) from `tabPayable Voucher` where supplier='%(sup)s'", {'sup':doc.name});
|
||||
|
||||
cur_frm.cscript.run_list(lst,parent,q,q_max,doc,'Purchase Invoice','Payable Voucher');
|
||||
}
|
||||
148
buying/doctype/supplier/supplier.py
Normal file
148
buying/doctype/supplier/supplier.py
Normal file
@@ -0,0 +1,148 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def autoname(self):
|
||||
#get default naming conventional from control panel
|
||||
supp_master_name = get_defaults()['supp_master_name']
|
||||
|
||||
if supp_master_name == 'Supplier Name':
|
||||
|
||||
# filter out bad characters in name
|
||||
#supp = self.doc.supplier_name.replace('&','and').replace('.','').replace("'",'').replace('"','').replace(',','').replace('`','')
|
||||
supp = self.doc.supplier_name
|
||||
|
||||
cust = sql("select name from `tabCustomer` where name = '%s'" % (supp))
|
||||
cust = cust and cust[0][0] or ''
|
||||
|
||||
if cust:
|
||||
msgprint("You already have a Customer with same name")
|
||||
raise Exception
|
||||
self.doc.name = supp
|
||||
|
||||
else:
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
# ----------------------------------------
|
||||
# update credit days and limit in account
|
||||
# ----------------------------------------
|
||||
def update_credit_days_limit(self):
|
||||
sql("update tabAccount set credit_days = '%s' where name = '%s'" % (self.doc.credit_days, self.doc.name + " - " + self.get_company_abbr()))
|
||||
|
||||
|
||||
def on_update(self):
|
||||
if not self.doc.naming_series:
|
||||
self.doc.naming_series = ''
|
||||
|
||||
|
||||
# create address
|
||||
addr_flds = [self.doc.address_line1, self.doc.address_line2, self.doc.city, self.doc.state, self.doc.country, self.doc.pincode]
|
||||
address_line = "\n".join(filter(lambda x : (x!='' and x!=None),addr_flds))
|
||||
set(self.doc,'address', address_line)
|
||||
|
||||
# create account head
|
||||
self.create_account_head()
|
||||
|
||||
# update credit days and limit in account
|
||||
self.update_credit_days_limit()
|
||||
|
||||
|
||||
def check_state(self):
|
||||
return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
|
||||
|
||||
# ACCOUNTS
|
||||
# -------------------------------------------
|
||||
def get_payables_group(self):
|
||||
g = sql("select payables_group from tabCompany where name=%s", self.doc.company)
|
||||
g = g and g[0][0] or ''
|
||||
if not g:
|
||||
msgprint("Update Company master, assign a default group for Payables")
|
||||
raise Exception
|
||||
return g
|
||||
|
||||
def add_account(self, ac, par, abbr):
|
||||
arg = {'account_name':ac,'parent_account':par, 'group_or_ledger':'Group', 'company':self.doc.company,'account_type':'','tax_rate':'0'}
|
||||
t = get_obj('GL Control').add_ac(cstr(arg))
|
||||
msgprint("Created Group " + t)
|
||||
|
||||
def get_company_abbr(self):
|
||||
return sql("select abbr from tabCompany where name=%s", self.doc.company)[0][0]
|
||||
|
||||
def get_parent_account(self, abbr):
|
||||
if (not self.doc.supplier_type):
|
||||
msgprint("Supplier Type is mandatory")
|
||||
raise Exception
|
||||
|
||||
if not sql("select name from tabAccount where name=%s", (self.doc.supplier_type + " - " + abbr)):
|
||||
|
||||
# if not group created , create it
|
||||
self.add_account(self.doc.supplier_type, self.get_payables_group(), abbr)
|
||||
|
||||
return self.doc.supplier_type + " - " + abbr
|
||||
|
||||
|
||||
def validate(self):
|
||||
#validation for Naming Series mandatory field...
|
||||
if get_defaults()['supp_master_name'] == 'Naming Series':
|
||||
if not self.doc.naming_series:
|
||||
msgprint("Series is Mandatory.")
|
||||
raise Exception
|
||||
|
||||
|
||||
# create accont head - in tree under zone + territory
|
||||
# -------------------------------------------------------
|
||||
def create_account_head(self):
|
||||
if self.doc.company :
|
||||
abbr = self.get_company_abbr()
|
||||
|
||||
if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
|
||||
parent_account = self.get_parent_account(abbr)
|
||||
|
||||
arg = {'account_name':self.doc.name,'parent_account': parent_account, 'group_or_ledger':'Ledger', 'company':self.doc.company,'account_type':'','tax_rate':'0','master_type':'Supplier','master_name':self.doc.name,'address':self.doc.address}
|
||||
# create
|
||||
ac = get_obj('GL Control').add_ac(cstr(arg))
|
||||
msgprint("Created Account Head: "+ac)
|
||||
|
||||
else :
|
||||
msgprint("Please select Company under which you want to create account head")
|
||||
|
||||
|
||||
def get_contacts(self,nm):
|
||||
if nm:
|
||||
contact_details =convert_to_lists(sql("select name, CONCAT(IFNULL(first_name,''),' ',IFNULL(last_name,'')),contact_no,email_id from `tabContact` where supplier = '%s'"%nm))
|
||||
|
||||
return contact_details
|
||||
else:
|
||||
return ''
|
||||
|
||||
def delete_supplier_address(self):
|
||||
for rec in sql("select * from `tabAddress` where supplier='%s'" %(self.doc.name), as_dict=1):
|
||||
sql("delete from `tabAddress` where name=%s",(rec['name']))
|
||||
|
||||
def delete_supplier_contact(self):
|
||||
for rec in sql("select * from `tabContact` where supplier='%s'" %(self.doc.name), as_dict=1):
|
||||
sql("delete from `tabContact` where name=%s",(rec['name']))
|
||||
|
||||
def on_trash(self):
|
||||
self.delete_supplier_address()
|
||||
self.delete_supplier_contact()
|
||||
349
buying/doctype/supplier/supplier.txt
Normal file
349
buying/doctype/supplier/supplier.txt
Normal file
@@ -0,0 +1,349 @@
|
||||
# DocType, Supplier
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-08-08 17:09:26',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-05-10 17:42:21',
|
||||
'modified_by': 'Administrator',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'_last_update': '1306471021',
|
||||
'allow_trash': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'document_type': 'Master',
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'search_fields': 'supplier_name,supplier_type',
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'subject': ' ',
|
||||
'tag_fields': 'supplier_type',
|
||||
'version': 86
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Supplier',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Supplier',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Supplier
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Supplier'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 1,
|
||||
'role': 'Purchase Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 0,
|
||||
'role': 'Purchase Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 1,
|
||||
'role': 'Purchase Master Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'role': 'Purchase Master Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 1,
|
||||
'label': 'Basic Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 2,
|
||||
'label': 'Supplier Name',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'supplier_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_type',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 3,
|
||||
'label': 'Supplier Type',
|
||||
'oldfieldname': 'supplier_type',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Supplier Type',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 5,
|
||||
'label': 'Series',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'naming_series',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nSUPP\nSUPP/10-11/',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 6,
|
||||
'label': 'Supplier Status',
|
||||
'oldfieldname': 'supplier_status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nApproved\nUnapproved',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 7,
|
||||
'label': 'Address & Contacts',
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 8,
|
||||
'label': 'Address Desc',
|
||||
'options': '<em>Addresses will appear only when you save the supplier</em>',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 9,
|
||||
'label': 'Address HTML',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 10,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 11,
|
||||
'label': 'Contact Desc',
|
||||
'options': '<em>Contact Details will appear only when you save the supplier</em>',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 12,
|
||||
'label': 'Contact HTML',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 13,
|
||||
'label': 'More Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Enter the company name under which Account Head will be created for this Supplier',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 14,
|
||||
'in_filter': 1,
|
||||
'label': 'Company',
|
||||
'oldfieldname': 'company',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Statutory info and other general information about your Supplier',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_details',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 15,
|
||||
'label': 'Supplier Details',
|
||||
'oldfieldname': 'supplier_details',
|
||||
'oldfieldtype': 'Code',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 16,
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'credit_days',
|
||||
'fieldtype': 'Int',
|
||||
'idx': 17,
|
||||
'label': 'Credit Days',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'website',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 18,
|
||||
'label': 'Website',
|
||||
'oldfieldname': 'website',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 19,
|
||||
'label': 'Transaction History',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'depends_on': 'eval:!doc.__islocal',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 20,
|
||||
'label': 'History HTML',
|
||||
'oldfieldtype': 'HTML',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'trash_reason',
|
||||
'fieldtype': 'Small Text',
|
||||
'idx': 21,
|
||||
'label': 'Trash Reason',
|
||||
'oldfieldname': 'trash_reason',
|
||||
'oldfieldtype': 'Small Text',
|
||||
'permlevel': 1
|
||||
}
|
||||
]
|
||||
0
buying/doctype/supplier_quotation/__init__.py
Executable file
0
buying/doctype/supplier_quotation/__init__.py
Executable file
82
buying/doctype/supplier_quotation/supplier_quotation.js
Executable file
82
buying/doctype/supplier_quotation/supplier_quotation.js
Executable file
@@ -0,0 +1,82 @@
|
||||
cur_frm.cscript.tname = "Supplier Quotation Detail";
|
||||
cur_frm.cscript.fname = "supplier_quotation_details";
|
||||
|
||||
$import(Purchase Common)
|
||||
|
||||
// ======================= OnLoad =============================================
|
||||
cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
|
||||
|
||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
|
||||
if(!doc.conversion_rate) set_multiple(cdt,cdn,{conversion_rate:'1'});
|
||||
if(!doc.currency) set_multiple(cdt,cdn,{currency:sys_defaults.currency});
|
||||
|
||||
if(doc.__islocal && has_common(user_roles,['Partner','Supplier'])){
|
||||
get_server_fields('get_contact_details','','',doc,cdt,cdn,1);
|
||||
}
|
||||
else if(doc.__islocal && doc.supplier){
|
||||
get_server_fields('get_supplier_details',doc.supplier,'',doc,cdt,cdn,1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//======================= Refresh ==============================================
|
||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||
|
||||
if(has_common(user_roles,['Purchase User','Purchase Manager'])){
|
||||
unhide_field(['Approve / Unapprove']);
|
||||
if(doc.approval_status == 'Approved' && doc.status == 'Submitted') { unhide_field(['Create PO']);}
|
||||
else { hide_field(['Create PO']);}
|
||||
}
|
||||
else{
|
||||
hide_field(['Create PO']);
|
||||
hide_field(['Approve / Unapprove']);
|
||||
}
|
||||
}
|
||||
|
||||
//======================= RFQ NO Get Query ===============================================
|
||||
cur_frm.fields_dict['rfq_no'].get_query = function(doc){
|
||||
return 'SELECT DISTINCT `tabRFQ`.name FROM `tabRFQ` WHERE `tabRFQ`.docstatus = 1 AND `tabRFQ`.name LIKE "%s"';
|
||||
}
|
||||
|
||||
// ***************** Get Contact Person based on supplier selected *****************
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabContact`.contact_name FROM `tabContact` WHERE `tabContact`.is_supplier = 1 AND `tabContact`.supplier = "'+ doc.supplier+'" AND `tabContact`.docstatus != 2 AND `tabContact`.docstatus != 2 AND `tabContact`.contact_name LIKE "%s" ORDER BY `tabContact`.contact_name ASC LIMIT 50';
|
||||
}
|
||||
|
||||
//=================== On Button Click Functions =====================
|
||||
|
||||
//======================== Create Purchase Order =========================================
|
||||
cur_frm.cscript['Create PO'] = function(doc,cdt,cdn){
|
||||
n = createLocal("Purchase Order");
|
||||
$c('dt_map', args={
|
||||
'docs':compress_doclist([locals["Purchase Order"][n]]),
|
||||
'from_doctype':'Supplier Quotation',
|
||||
'to_doctype':'Purchase Order',
|
||||
'from_docname':doc.name,
|
||||
'from_to_list':"[['Supplier Quotation', 'Purchase Order'], ['Supplier Quotation Detail', 'PO Detail']]"
|
||||
}
|
||||
, function(r,rt) {
|
||||
loaddoc("Purchase Order", n);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//======================== Get Report ===================================================
|
||||
cur_frm.cscript['Get Report'] = function(doc,cdt,cdn) {
|
||||
var callback = function(report){
|
||||
report.set_filter('PO Detail', 'Ref Doc',doc.name)
|
||||
}
|
||||
loadreport('PO Detail','Itemwise Purchase Details', callback);
|
||||
}
|
||||
|
||||
cur_frm.cscript['Approve / Unapprove'] = function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
|
||||
$c_obj(make_doclist(doc.doctype, doc.name),'update_approval_status','', function(r,rt){
|
||||
refresh_field('approval_status');
|
||||
doc.approval_status = r.message;
|
||||
cur_frm.cscript.refresh(d, d.cdt, d.cdn);
|
||||
});
|
||||
}
|
||||
104
buying/doctype/supplier_quotation/supplier_quotation.py
Executable file
104
buying/doctype/supplier_quotation/supplier_quotation.py
Executable file
@@ -0,0 +1,104 @@
|
||||
class DocType:
|
||||
def __init__(self,doc,doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
self.fname = 'supplier_quotation_details'
|
||||
self.tname = 'Supplier Quotation Detail'
|
||||
|
||||
def autoname(self):
|
||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
||||
|
||||
def get_contact_details(self):
|
||||
cd = sql("select concat_ws(' ',t2.first_name,t2.last_name),t2.contact_no, t2.email_id, t2.supplier, t2.supplier_name, t2.supplier_address from `tabProfile` t1, `tabContact` t2 where t1.email=t2.email_id and t1.name=%s", session['user'])
|
||||
ret = {
|
||||
'contact_person' : cd and cd[0][0] or '',
|
||||
'contact_no' : cd and cd[0][1] or '',
|
||||
'email' : cd and cd[0][2] or '',
|
||||
'supplier' : cd and cd[0][3] or '',
|
||||
'supplier_name' : cd and cd[0][4] or '',
|
||||
'supplier_address': cd and cd[0][5] or ''
|
||||
}
|
||||
return cstr(ret)
|
||||
|
||||
def get_rfq_details(self):
|
||||
self.doc.clear_table(self.doclist, 'supplier_quotation_details')
|
||||
get_obj('DocType Mapper','RFQ-Supplier Quotation').dt_map('RFQ','Supplier Quotation',self.doc.rfq_no, self.doc, self.doclist, "[['RFQ Detail', 'Supplier Quotation Detail']]")
|
||||
|
||||
#update approval status
|
||||
def update_approval_status(self):
|
||||
if not self.doc.approval_status or self.doc.approval_status == 'Not Approved':
|
||||
set(self.doc, 'approval_status','Approved')
|
||||
return cstr(self.doc.approval_status)
|
||||
elif self.doc.approval_status == 'Approved':
|
||||
pc_obj = get_obj('Purchase Common')
|
||||
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
|
||||
set(self.doc, 'approval_status', 'Not Approved')
|
||||
return cstr(self.doc.approval_status)
|
||||
|
||||
def validate_item_list(self):
|
||||
if not getlist(self.doclist, 'supplier_quotation_details'):
|
||||
msgprint("Please fetch RFQ details against which this quotation is prapared")
|
||||
raise Exception
|
||||
|
||||
# On Validate
|
||||
#---------------------------------------------------------------------------------------------------------
|
||||
def validate(self):
|
||||
self.validate_item_list()
|
||||
pc_obj = get_obj(dt='Purchase Common')
|
||||
pc_obj.validate_for_items(self)
|
||||
pc_obj.validate_conversion_rate(self)
|
||||
pc_obj.validate_doc(obj = self, prevdoc_doctype = 'RFQ', prevdoc_docname = self.doc.rfq_no)
|
||||
|
||||
def on_update(self):
|
||||
set(self.doc, 'status', 'Draft')
|
||||
|
||||
# checks whether previous documents doctstatus is submitted.
|
||||
def check_previous_docstatus(self):
|
||||
pc_obj = get_obj(dt = 'Purchase Common')
|
||||
for d in getlist(self.doclist, 'rfq_details'):
|
||||
if d.prevdoc_docname:
|
||||
pc_obj.check_docstatus(check = 'Previous', doctype = 'Indent', docname = d.prevdoc_docname)
|
||||
|
||||
#update rfq
|
||||
def update_rfq(self, status):
|
||||
prevdoc=''
|
||||
for d in getlist(self.doclist, 'supplier_quotation_details'):
|
||||
if d.prevdoc_docname:
|
||||
prevdoc = d.prevdoc_docname
|
||||
|
||||
if status == 'Submitted':
|
||||
sql("update `tabRFQ` set status = 'Quotation Received' where name=%s", prevdoc)
|
||||
elif status == 'Cancelled':
|
||||
sql("update `tabRFQ` set status = 'Submitted' where name=%s", prevdoc)
|
||||
|
||||
# On Submit
|
||||
def on_submit(self):
|
||||
# checks whether previous documents doctstatus is submitted.
|
||||
self.check_previous_docstatus()
|
||||
set(self.doc, 'status', 'Submitted')
|
||||
self.update_rfq('Submitted')
|
||||
|
||||
# On Cancel
|
||||
#---------------------------------------------------------------------------------------------------------
|
||||
#def check_next_docstatus(self):
|
||||
# submitted = sql("selct name from `tabPurchase Order` where ref_sq = '%s' and docstatus = 1" % self.doc.name)
|
||||
# if submitted:
|
||||
# msgprint("Purchase Order : " + cstr(submitted[0][0]) + " has already been submitted !")
|
||||
# raise Exception
|
||||
|
||||
def on_cancel(self):
|
||||
pc_obj = get_obj('Purchase Common')
|
||||
pc_obj.check_docstatus(check = 'Next', doctype = 'Purchase Order', docname = self.doc.name, detail_doctype = 'PO Detail')
|
||||
#self.check_next_docstatus()
|
||||
set(self.doc, 'status', 'Cancelled')
|
||||
self.update_rfq('Cancelled')
|
||||
|
||||
# GET TERMS & CONDITIONS
|
||||
# =====================================================================================
|
||||
def get_tc_details(self):
|
||||
return get_obj('Purchase Common').get_tc_details(self)
|
||||
|
||||
# Get Supplier Details
|
||||
# --------------------
|
||||
def get_supplier_details(self, name = ''):
|
||||
return cstr(get_obj('Purchase Common').get_supplier_details(name))
|
||||
607
buying/doctype/supplier_quotation/supplier_quotation.txt
Executable file
607
buying/doctype/supplier_quotation/supplier_quotation.txt
Executable file
@@ -0,0 +1,607 @@
|
||||
# DocType, Supplier Quotation
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2010-10-27 12:55:42',
|
||||
'docstatus': 0,
|
||||
'modified': '2011-01-28 11:41:36',
|
||||
'modified_by': 'rakesh@iwebnotes.com',
|
||||
'owner': 'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'autoname': 'SQ.#####',
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'in_create': 1,
|
||||
'module': 'Buying',
|
||||
'name': '__common__',
|
||||
'read_only': 1,
|
||||
'section_style': 'Tabbed',
|
||||
'server_code_error': ' ',
|
||||
'show_in_menu': 0,
|
||||
'version': 241
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'name': '__common__',
|
||||
'parent': 'Supplier Quotation',
|
||||
'parentfield': 'fields',
|
||||
'parenttype': 'DocType'
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': 'Supplier Quotation',
|
||||
'parentfield': 'permissions',
|
||||
'parenttype': 'DocType',
|
||||
'read': 1
|
||||
},
|
||||
|
||||
# DocType, Supplier Quotation
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': 'Supplier Quotation'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 1,
|
||||
'permlevel': 0,
|
||||
'role': 'System Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 2,
|
||||
'permlevel': 0,
|
||||
'role': 'Supplier',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 3,
|
||||
'permlevel': 0,
|
||||
'role': 'Purchase User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 4,
|
||||
'permlevel': 0,
|
||||
'role': 'Purchase Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 5,
|
||||
'permlevel': 1,
|
||||
'role': 'All'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 6,
|
||||
'permlevel': 2,
|
||||
'role': 'Purchase User',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'cancel': 0,
|
||||
'doctype': 'DocPerm',
|
||||
'idx': 7,
|
||||
'permlevel': 2,
|
||||
'role': 'Purchase Manager',
|
||||
'submit': 0,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 1,
|
||||
'label': 'Create PO',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 2,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Enter item rates and details of supplier who is providing quotation',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 2,
|
||||
'label': 'Basic Info',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 3,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'naming_series',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 4,
|
||||
'in_filter': 1,
|
||||
'label': 'Series',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'naming_series',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nSQTN',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': 'Draft',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 5,
|
||||
'in_filter': 1,
|
||||
'label': 'Status',
|
||||
'oldfieldname': 'status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nDraft\nQuotation Sent\nOrder Confirmed\nCancelled',
|
||||
'permlevel': 1,
|
||||
'reqd': 1,
|
||||
'search_index': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'default': 'Today',
|
||||
'description': 'The date at which current entry is made in system.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'transaction_date',
|
||||
'fieldtype': 'Date',
|
||||
'idx': 6,
|
||||
'in_filter': 1,
|
||||
'label': 'Quotation Date',
|
||||
'oldfieldname': 'transaction_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'activity_log_text',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 7,
|
||||
'label': 'Activity Log Text',
|
||||
'oldfieldname': 'activity_log_text',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 2
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'company',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 8,
|
||||
'in_filter': 1,
|
||||
'label': 'For Company',
|
||||
'oldfieldname': 'company',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Company',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'fiscal_year',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 9,
|
||||
'in_filter': 1,
|
||||
'label': 'Fiscal Year',
|
||||
'oldfieldname': 'fiscal_year',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Fiscal Year',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amended_from',
|
||||
'fieldtype': 'Data',
|
||||
'hidden': 1,
|
||||
'idx': 10,
|
||||
'label': 'Amended From',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amended_from',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'amendment_date',
|
||||
'fieldtype': 'Date',
|
||||
'hidden': 1,
|
||||
'idx': 11,
|
||||
'label': 'Amendment Date',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'amendment_date',
|
||||
'oldfieldtype': 'Date',
|
||||
'permlevel': 1,
|
||||
'print_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 12,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'description': 'You can create PO when quotation gets approved.',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'approval_status',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 13,
|
||||
'label': 'Approval Status',
|
||||
'oldfieldname': 'approval_status',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': '\nApproved\nNot Approved',
|
||||
'permlevel': 2
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 14,
|
||||
'label': 'Approve / Unapprove',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 2,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 15,
|
||||
'in_filter': 1,
|
||||
'label': 'Supplier',
|
||||
'oldfieldname': 'supplier',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Supplier',
|
||||
'permlevel': 0,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_name',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 16,
|
||||
'in_filter': 1,
|
||||
'label': 'Supplier Name',
|
||||
'oldfieldname': 'supplier_name',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_address',
|
||||
'fieldtype': 'Text',
|
||||
'idx': 17,
|
||||
'label': 'Supplier Address',
|
||||
'oldfieldname': 'supplier_address',
|
||||
'oldfieldtype': 'Text',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_person',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 18,
|
||||
'in_filter': 0,
|
||||
'label': 'Contact Person',
|
||||
'oldfieldname': 'contact_person',
|
||||
'oldfieldtype': 'Link',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'contact_no',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 19,
|
||||
'label': 'Contact No',
|
||||
'oldfieldname': 'contact_no',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'email',
|
||||
'fieldtype': 'Data',
|
||||
'idx': 20,
|
||||
'label': 'Email',
|
||||
'oldfieldname': 'email',
|
||||
'oldfieldtype': 'Data',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 21,
|
||||
'label': 'Item Details',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'rfq_no',
|
||||
'fieldtype': 'Link',
|
||||
'hidden': 1,
|
||||
'idx': 22,
|
||||
'label': 'RFQ No',
|
||||
'oldfieldname': 'rfq_no',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'RFQ',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 23,
|
||||
'label': 'Get Items',
|
||||
'oldfieldtype': 'Button',
|
||||
'options': 'get_rfq_details',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Column Break',
|
||||
'idx': 24,
|
||||
'oldfieldtype': 'Column Break',
|
||||
'permlevel': 0,
|
||||
'width': '50%'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': "Supplier's currency",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'currency',
|
||||
'fieldtype': 'Select',
|
||||
'idx': 25,
|
||||
'label': 'Currency',
|
||||
'oldfieldname': 'currency',
|
||||
'oldfieldtype': 'Select',
|
||||
'options': 'link:Currency',
|
||||
'permlevel': 0,
|
||||
'reqd': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'default': '1',
|
||||
'description': "Rate at which supplier's currency is converted to your currency",
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'conversion_rate',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 26,
|
||||
'label': 'Conversion Rate',
|
||||
'no_copy': 1,
|
||||
'oldfieldname': 'conversion_rate',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'reqd': 1,
|
||||
'trigger': 'Client'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 27,
|
||||
'oldfieldtype': 'Section Break',
|
||||
'options': 'Simple',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'supplier_quotation_details',
|
||||
'fieldtype': 'Table',
|
||||
'idx': 28,
|
||||
'label': 'Quotation Details1',
|
||||
'oldfieldname': 'supplier_quotation_details',
|
||||
'oldfieldtype': 'Table',
|
||||
'options': 'Supplier Quotation Detail',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'net_total',
|
||||
'fieldtype': 'Currency',
|
||||
'idx': 29,
|
||||
'label': 'Net Total',
|
||||
'oldfieldname': 'net_total',
|
||||
'oldfieldtype': 'Currency',
|
||||
'permlevel': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': 'Enter terms and conditions which you want to include',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 30,
|
||||
'label': 'Terms',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'tc_name',
|
||||
'fieldtype': 'Link',
|
||||
'idx': 31,
|
||||
'label': 'Select Terms',
|
||||
'oldfieldname': 'tc_name',
|
||||
'oldfieldtype': 'Link',
|
||||
'options': 'Term',
|
||||
'permlevel': 0,
|
||||
'print_hide': 1,
|
||||
'report_hide': 1
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 32,
|
||||
'label': 'Get Terms',
|
||||
'oldfieldtype': 'Button',
|
||||
'options': 'get_tc_details',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'HTML',
|
||||
'idx': 33,
|
||||
'label': 'Terms HTML',
|
||||
'oldfieldtype': 'HTML',
|
||||
'options': 'You can add Terms and Notes that will be printed in the Transaction',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': 'DocField',
|
||||
'fieldname': 'terms',
|
||||
'fieldtype': 'Text Editor',
|
||||
'idx': 34,
|
||||
'label': 'Terms and Conditions',
|
||||
'oldfieldname': 'terms',
|
||||
'oldfieldtype': 'Text Editor',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'colour': 'White:FFF',
|
||||
'description': "Next steps will be visible when you submit the supplier quotation and approval status is 'Approved'",
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Section Break',
|
||||
'idx': 35,
|
||||
'label': 'Next Steps',
|
||||
'oldfieldtype': 'Section Break',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 1,
|
||||
'colour': 'White:FFF',
|
||||
'doctype': 'DocField',
|
||||
'fieldtype': 'Button',
|
||||
'idx': 36,
|
||||
'label': 'Get Report',
|
||||
'oldfieldtype': 'Button',
|
||||
'permlevel': 0,
|
||||
'trigger': 'Client'
|
||||
}
|
||||
]
|
||||
0
buying/page/__init__.py
Normal file
0
buying/page/__init__.py
Normal file
0
buying/search_criteria/__init__.py
Normal file
0
buying/search_criteria/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
report.customize_filters = function() {
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'From PO Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'To PO Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
'add_col': None,
|
||||
'add_cond': None,
|
||||
'add_tab': None,
|
||||
'columns': 'Purchase Order\x01ID,Purchase Order\x01PO Date,Purchase Order\x01Grand Total,PO Detail\x01Item Code,PO Detail\x01Item Name,PO Detail\x01Quantity,PO Detail\x01Stock UOM,PO Detail\x01Purchase Rate,PO Detail\x01Amount,PO Detail\x01Warehouse',
|
||||
'creation': '2010-08-08 17:09:31',
|
||||
'criteria_name': 'Itemwise Purchase Details',
|
||||
'custom_query': '',
|
||||
'description': None,
|
||||
'dis_filters': None,
|
||||
'disabled': None,
|
||||
'doc_type': 'PO Detail',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Company Name':''}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': None,
|
||||
'idx': None,
|
||||
'modified': '2010-03-31 12:39:57',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'SRM',
|
||||
'name': 'itemwise_purchase_details',
|
||||
'owner': 'Administrator',
|
||||
'page_len': None,
|
||||
'parent': None,
|
||||
'parent_doc_type': 'Purchase Order',
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'report_script': None,
|
||||
'server_script': None,
|
||||
'sort_by': '`tabPurchase Order`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
report.customize_filters = function() {
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From Transaction Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To Transaction Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
'add_col': None,
|
||||
'add_cond': None,
|
||||
'add_tab': None,
|
||||
'columns': 'Purchase Receipt\x01ID,Purchase Receipt\x01Posting Date,Purchase Receipt Detail\x01Item Code,Purchase Receipt Detail\x01Item Name,Purchase Receipt Detail\x01Accepted Quantity,Purchase Receipt Detail\x01Rejected Quantity,Purchase Receipt Detail\x01Accepted Warehouse,Purchase Receipt Detail\x01Rejected Warehouse,Purchase Receipt Detail\x01Amount',
|
||||
'creation': '2010-12-14 10:33:08',
|
||||
'criteria_name': 'Itemwise Receipt Details',
|
||||
'custom_query': '',
|
||||
'description': None,
|
||||
'dis_filters': None,
|
||||
'disabled': None,
|
||||
'doc_type': 'Purchase Receipt Detail',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Purchase Receipt\x01Saved':1,'Purchase Receipt\x01Submitted':1,'Purchase Receipt\x01Status':'','Purchase Receipt\x01Fiscal Year':''}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': None,
|
||||
'idx': None,
|
||||
'modified': '2010-10-22 14:36:11',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'SRM',
|
||||
'name': 'itemwise_receipt_details',
|
||||
'owner': 'Administrator',
|
||||
'page_len': 50,
|
||||
'parent': None,
|
||||
'parent_doc_type': 'Purchase Receipt',
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'report_script': None,
|
||||
'server_script': None,
|
||||
'sort_by': '`tabPurchase Receipt`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,4 @@
|
||||
report.customize_filters = function() {
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
'add_col': '(CASE WHEN (`tabPO Detail`.qty- ifnull(`tabPO Detail`.billed_qty, 0) > 0 ) THEN (`tabPO Detail`.qty-ifnull(`tabPO Detail`.billed_qty, 0) ) ELSE 0 END) AS "Pending To Bill"',
|
||||
'add_cond': '(`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0) > 0 or `tabPO Detail`.qty - ifnull(`tabPO Detail`.billed_qty, 0) > 0)\n`tabPurchase Order`.status != "Stopped"',
|
||||
'add_tab': None,
|
||||
'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01Supplier Name,Purchase Order\x01Status,Purchase Order\x01PO Date,Purchase Order\x01Fiscal Year,PO Detail\x01Indent No,PO Detail\x01Item Code,PO Detail\x01Item Name,PO Detail\x01Description,PO Detail\x01Quantity,PO Detail\x01UOM,PO Detail\x01Received Qty',
|
||||
'creation': '2011-05-09 11:04:19',
|
||||
'criteria_name': 'Pending PO Items To Bill',
|
||||
'custom_query': '',
|
||||
'description': 'Pending PO Items To Bill',
|
||||
'dis_filters': None,
|
||||
'disabled': None,
|
||||
'doc_type': 'PO Detail',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': None,
|
||||
'idx': None,
|
||||
'modified': '2011-03-29 14:26:49',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'SRM',
|
||||
'name': 'pending_po_items_to_bill',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'page_len': 50,
|
||||
'parent': None,
|
||||
'parent_doc_type': 'Purchase Order',
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'report_script': None,
|
||||
'server_script': None,
|
||||
'sort_by': '`tabPurchase Order`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,4 @@
|
||||
report.customize_filters = function() {
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
colwidths[col_idx['Pending Quantity To Receive']] = '200px'
|
||||
colwidths[col_idx['Pending Amount To Receive']] = '200px'
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
'add_col': '`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0) AS "Pending Quantity To Receive"\n(`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0)) * `tabPO Detail`.purchase_rate AS "Pending Amount To Receive"',
|
||||
'add_cond': '`tabPO Detail`.qty - ifnull(`tabPO Detail`.received_qty, 0) > 0 \n`tabPurchase Order`.status != "Stopped"',
|
||||
'add_tab': None,
|
||||
'columns': 'Purchase Order\x01ID,Purchase Order\x01Supplier,Purchase Order\x01Supplier Name,Purchase Order\x01Status,Purchase Order\x01PO Date,Purchase Order\x01Fiscal Year,PO Detail\x01Indent No,PO Detail\x01Item Code,PO Detail\x01Item Name,PO Detail\x01Description,PO Detail\x01Quantity,PO Detail\x01UOM,PO Detail\x01Received Qty',
|
||||
'creation': '2011-05-09 11:04:19',
|
||||
'criteria_name': 'Pending PO Items To Receive',
|
||||
'custom_query': '',
|
||||
'description': 'Pending PO Items To Receive',
|
||||
'dis_filters': None,
|
||||
'disabled': None,
|
||||
'doc_type': 'PO Detail',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Purchase Order\x01Saved':1,'Purchase Order\x01Submitted':1,'Purchase Order\x01Status':'','Purchase Order\x01Fiscal Year':''}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': None,
|
||||
'idx': None,
|
||||
'modified': '2011-04-01 17:19:03',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'SRM',
|
||||
'name': 'pending_po_items_to_receive',
|
||||
'owner': 'dhanalekshmi@webnotestech.com',
|
||||
'page_len': 50,
|
||||
'parent': None,
|
||||
'parent_doc_type': 'Purchase Order',
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'report_script': None,
|
||||
'server_script': None,
|
||||
'sort_by': '`tabPurchase Order`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,32 @@
|
||||
report.customize_filters = function() {
|
||||
|
||||
this.hide_all_filters();
|
||||
|
||||
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Credit To'].df.filter_hide = 0;
|
||||
|
||||
|
||||
this.add_filter({fieldname:'pr_posting_date', label:'PR Posting Date', fieldtype:'Date', ignore : 1, parent:'Purchase Receipt'});
|
||||
|
||||
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Credit To'].df.in_first_page = 0;
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
|
||||
|
||||
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From PR Posting Date'].df.ignore = 1;
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To PR Posting Date'].df.ignore = 1;
|
||||
|
||||
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From PR Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To PR Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
|
||||
this.filter_fields_dict['Payable Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
|
||||
|
||||
}
|
||||
|
||||
this.mytabs.items['Select Columns'].hide();
|
||||
@@ -0,0 +1,7 @@
|
||||
#check mendatory
|
||||
if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
|
||||
msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section")
|
||||
raise Exception
|
||||
else:
|
||||
from_date = filter_values.get('posting_date')
|
||||
to_date = filter_values.get('posting_date1')
|
||||
@@ -0,0 +1,37 @@
|
||||
[
|
||||
{
|
||||
'add_col': "`tabPurchase Receipt`.`posting_date` AS 'PR Posting Date'",
|
||||
'add_cond': "`tabPV Detail`.`purchase_receipt` = `tabPurchase Receipt`.`name`\n`tabPurchase Receipt`.`posting_date` >= '%(pr_posting_date)s'\n`tabPurchase Receipt`.`posting_date` <= '%(pr_posting_date1)s'\n`tabPurchase Receipt`.`posting_date` > `tabPayable Voucher`.`posting_date`",
|
||||
'add_tab': '`tabPurchase Receipt`',
|
||||
'columns': 'Payable Voucher\x01ID,Payable Voucher\x01Voucher Date,Payable Voucher\x01Posting Date,Payable Voucher\x01Credit To,PV Detail\x01Rate,PV Detail\x01Qty,PV Detail\x01Amount,PV Detail\x01Pur Order,PV Detail\x01Pur Receipt',
|
||||
'creation': '2010-09-01 15:47:57',
|
||||
'criteria_name': 'Purchase in Transit',
|
||||
'custom_query': '',
|
||||
'description': 'List of PR whose posting date is after PV posting date',
|
||||
'dis_filters': '`tabPurchase Receipt`.`pr_posting_date`',
|
||||
'disabled': None,
|
||||
'doc_type': 'PV Detail',
|
||||
'docstatus': 0,
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': "{'Payable Voucher\x01Submitted':1,'Payable Voucher\x01From Posting Date\x01lower':'2009-04-01','Payable Voucher\x01To Posting Date\x01upper':'2010-01-11','Payable Voucher\x01Is Opening':'','Payable Voucher\x01Fiscal Year':'','Payable Voucher\x01Company':'','Purchase Receipt\x01From PR Posting Date\x01lower':'2009-04-01','Purchase Receipt\x01To PR Posting Date\x01upper':'2010-01-11'}",
|
||||
'graph_series': None,
|
||||
'graph_values': None,
|
||||
'group_by': '',
|
||||
'idx': None,
|
||||
'modified': '2010-08-30 13:04:44',
|
||||
'modified_by': 'Administrator',
|
||||
'module': 'SRM',
|
||||
'name': 'purchase_in_transit',
|
||||
'owner': 'Administrator',
|
||||
'page_len': 50,
|
||||
'parent': None,
|
||||
'parent_doc_type': 'Payable Voucher',
|
||||
'parentfield': None,
|
||||
'parenttype': None,
|
||||
'report_script': None,
|
||||
'server_script': None,
|
||||
'sort_by': '`tabPayable Voucher`.`name`',
|
||||
'sort_order': 'DESC',
|
||||
'standard': 'Yes'
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user