Merge branch 'develop'

This commit is contained in:
Nabin Hait 2017-04-26 14:45:37 +05:30
commit f26dcbc1a6
4 changed files with 28 additions and 11 deletions

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
__version__ = '8.0.18' __version__ = '8.0.19'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -3,6 +3,10 @@ from frappe import _
def get_data(): def get_data():
return { return {
'fieldname': 'purchase_order', 'fieldname': 'purchase_order',
'non_standard_fieldnames': {
'Journal Entry': 'reference_name',
'Payment Entry': 'reference_name'
},
'internal_links': { 'internal_links': {
'Material Request': ['items', 'material_request'], 'Material Request': ['items', 'material_request'],
'Supplier Quotation': ['items', 'supplier_quotation'], 'Supplier Quotation': ['items', 'supplier_quotation'],
@ -13,6 +17,10 @@ def get_data():
'label': _('Related'), 'label': _('Related'),
'items': ['Purchase Receipt', 'Purchase Invoice'] 'items': ['Purchase Receipt', 'Purchase Invoice']
}, },
{
'label': _('Payment'),
'items': ['Payment Entry', 'Journal Entry']
},
{ {
'label': _('Reference'), 'label': _('Reference'),
'items': ['Material Request', 'Supplier Quotation', 'Project'] 'items': ['Material Request', 'Supplier Quotation', 'Project']
@ -20,6 +28,6 @@ def get_data():
{ {
'label': _('Sub-contracting'), 'label': _('Sub-contracting'),
'items': ['Stock Entry'] 'items': ['Stock Entry']
}, }
] ]
} }

View File

@ -5,6 +5,9 @@ def get_data():
'fieldname': 'sales_order', 'fieldname': 'sales_order',
'non_standard_fieldnames': { 'non_standard_fieldnames': {
'Delivery Note': 'against_sales_order', 'Delivery Note': 'against_sales_order',
'Journal Entry': 'reference_name',
'Payment Entry': 'reference_name',
'Payment Request': 'reference_name'
}, },
'internal_links': { 'internal_links': {
'Quotation': ['items', 'prevdoc_docname'] 'Quotation': ['items', 'prevdoc_docname']
@ -30,5 +33,9 @@ def get_data():
'label': _('Reference'), 'label': _('Reference'),
'items': ['Quotation'] 'items': ['Quotation']
}, },
{
'label': _('Payment'),
'items': ['Payment Entry', 'Payment Request', 'Journal Entry']
},
] ]
} }

View File

@ -101,16 +101,18 @@ def set_batch_nos(doc, warehouse_field, throw = False):
def get_batch_no(item_code, warehouse, qty, throw=False): def get_batch_no(item_code, warehouse, qty, throw=False):
'''get the smallest batch with for the given item_code, warehouse and qty''' '''get the smallest batch with for the given item_code, warehouse and qty'''
batches = sorted(
get_batch_qty(item_code = item_code, warehouse = warehouse),
lambda a, b: 1 if a.qty > b.qty else -1)
batch_no = None batch_no = None
for b in batches:
if b.qty >= qty: batches = get_batch_qty(item_code = item_code, warehouse = warehouse)
batch_no = b.batch_no if batches:
# found! batches = sorted(batches, lambda a, b: 1 if a.qty > b.qty else -1)
break
for b in batches:
if b.qty >= qty:
batch_no = b.batch_no
# found!
break
if not batch_no: if not batch_no:
frappe.msgprint(_('Please select a Batch for Item {0}. Unable to find a single batch that fulfills this requirement').format(frappe.bold(item_code))) frappe.msgprint(_('Please select a Batch for Item {0}. Unable to find a single batch that fulfills this requirement').format(frappe.bold(item_code)))