mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-09 00:01:18 +00:00
Merge branch 'version-11-hotfix' into version-11
This commit is contained in:
@@ -5,7 +5,7 @@ import frappe
|
||||
from erpnext.hooks import regional_overrides
|
||||
from frappe.utils import getdate
|
||||
|
||||
__version__ = '11.1.56'
|
||||
__version__ = '11.1.57'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
||||
@@ -432,7 +432,6 @@ def get_customer_id(doc, customer=None):
|
||||
|
||||
return cust_id
|
||||
|
||||
|
||||
def make_customer_and_address(customers):
|
||||
customers_list = []
|
||||
for customer, data in iteritems(customers):
|
||||
@@ -449,7 +448,6 @@ def make_customer_and_address(customers):
|
||||
frappe.db.commit()
|
||||
return customers_list
|
||||
|
||||
|
||||
def add_customer(data):
|
||||
customer = data.get('full_name') or data.get('customer')
|
||||
if frappe.db.exists("Customer", customer.strip()):
|
||||
@@ -466,21 +464,18 @@ def add_customer(data):
|
||||
frappe.db.commit()
|
||||
return customer_doc.name
|
||||
|
||||
|
||||
def get_territory(data):
|
||||
if data.get('territory'):
|
||||
return data.get('territory')
|
||||
|
||||
return frappe.db.get_single_value('Selling Settings','territory') or _('All Territories')
|
||||
|
||||
|
||||
def get_customer_group(data):
|
||||
if data.get('customer_group'):
|
||||
return data.get('customer_group')
|
||||
|
||||
return frappe.db.get_single_value('Selling Settings', 'customer_group') or frappe.db.get_value('Customer Group', {'is_group': 0}, 'name')
|
||||
|
||||
|
||||
def make_contact(args, customer):
|
||||
if args.get('email_id') or args.get('phone'):
|
||||
name = frappe.db.get_value('Dynamic Link',
|
||||
@@ -506,7 +501,6 @@ def make_contact(args, customer):
|
||||
doc.flags.ignore_mandatory = True
|
||||
doc.save(ignore_permissions=True)
|
||||
|
||||
|
||||
def make_address(args, customer):
|
||||
if not args.get('address_line1'):
|
||||
return
|
||||
@@ -521,7 +515,10 @@ def make_address(args, customer):
|
||||
address = frappe.get_doc('Address', name)
|
||||
else:
|
||||
address = frappe.new_doc('Address')
|
||||
address.country = frappe.get_cached_value('Company', args.get('company'), 'country')
|
||||
if args.get('company'):
|
||||
address.country = frappe.get_cached_value('Company',
|
||||
args.get('company'), 'country')
|
||||
|
||||
address.append('links', {
|
||||
'link_doctype': 'Customer',
|
||||
'link_name': customer
|
||||
@@ -533,7 +530,6 @@ def make_address(args, customer):
|
||||
address.flags.ignore_mandatory = True
|
||||
address.save(ignore_permissions=True)
|
||||
|
||||
|
||||
def make_email_queue(email_queue):
|
||||
name_list = []
|
||||
for key, data in iteritems(email_queue):
|
||||
@@ -550,7 +546,6 @@ def make_email_queue(email_queue):
|
||||
|
||||
return name_list
|
||||
|
||||
|
||||
def validate_item(doc):
|
||||
for item in doc.get('items'):
|
||||
if not frappe.db.exists('Item', item.get('item_code')):
|
||||
@@ -569,7 +564,6 @@ def validate_item(doc):
|
||||
item_doc.save(ignore_permissions=True)
|
||||
frappe.db.commit()
|
||||
|
||||
|
||||
def submit_invoice(si_doc, name, doc, name_list):
|
||||
try:
|
||||
si_doc.insert()
|
||||
@@ -585,7 +579,6 @@ def submit_invoice(si_doc, name, doc, name_list):
|
||||
|
||||
return name_list
|
||||
|
||||
|
||||
def save_invoice(doc, name, name_list):
|
||||
try:
|
||||
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
|
||||
|
||||
@@ -206,9 +206,9 @@ class SalesInvoice(SellingController):
|
||||
total_amount_in_payments = 0
|
||||
for payment in self.payments:
|
||||
total_amount_in_payments += payment.amount
|
||||
|
||||
if total_amount_in_payments < self.rounded_total:
|
||||
frappe.throw(_("Total payments amount can't be greater than {}".format(-self.rounded_total)))
|
||||
invoice_total = self.rounded_total or self.grand_total
|
||||
if total_amount_in_payments < invoice_total:
|
||||
frappe.throw(_("Total payments amount can't be greater than {}".format(-invoice_total)))
|
||||
|
||||
def validate_pos_paid_amount(self):
|
||||
if len(self.payments) == 0 and self.is_pos:
|
||||
|
||||
@@ -1762,6 +1762,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
this.si_docs = this.get_submitted_invoice() || [];
|
||||
this.email_queue_list = this.get_email_queue() || {};
|
||||
this.customers_list = this.get_customers_details() || {};
|
||||
|
||||
if(this.customer_doc) {
|
||||
this.freeze = this.customer_doc.display
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
|
||||
set_other_values(out, party, party_type)
|
||||
set_price_list(out, party, party_type, price_list, pos_profile)
|
||||
|
||||
out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_type)
|
||||
out["taxes_and_charges"] = set_taxes(party.name, party_type, posting_date, company, out.customer_group, out.supplier_group)
|
||||
|
||||
if fetch_payment_terms_template:
|
||||
out["payment_terms_template"] = get_pyt_term_template(party.name, party_type, company)
|
||||
|
||||
@@ -196,8 +196,10 @@ class ReceivablePayableReport(object):
|
||||
if self.filters.based_on_payment_terms and gl_entries_data:
|
||||
self.payment_term_map = self.get_payment_term_detail(voucher_nos)
|
||||
|
||||
self.gle_inclusion_map = {}
|
||||
for gle in gl_entries_data:
|
||||
if self.is_receivable_or_payable(gle, self.dr_or_cr, future_vouchers, return_entries):
|
||||
self.gle_inclusion_map[gle.name] = True
|
||||
outstanding_amount, credit_note_amount, payment_amount = self.get_outstanding_amount(
|
||||
gle,self.filters.report_date, self.dr_or_cr, return_entries)
|
||||
temp_outstanding_amt = outstanding_amount
|
||||
@@ -408,7 +410,9 @@ class ReceivablePayableReport(object):
|
||||
for e in self.get_gl_entries_for(gle.party, gle.party_type, gle.voucher_type, gle.voucher_no):
|
||||
if getdate(e.posting_date) <= report_date \
|
||||
and (e.name!=gle.name or (e.voucher_no in return_entries and not return_entries.get(e.voucher_no))):
|
||||
|
||||
if e.name!=gle.name and self.gle_inclusion_map.get(e.name):
|
||||
continue
|
||||
self.gle_inclusion_map[e.name] = True
|
||||
amount = flt(e.get(reverse_dr_or_cr), self.currency_precision) - flt(e.get(dr_or_cr), self.currency_precision)
|
||||
if e.voucher_no not in return_entries:
|
||||
payment_amount += amount
|
||||
|
||||
@@ -135,11 +135,11 @@ def get_chart_data(filters, columns, asset, liability, equity):
|
||||
|
||||
datasets = []
|
||||
if asset_data:
|
||||
datasets.append({'name':'Assets', 'values': asset_data})
|
||||
datasets.append({'name':_('Assets'), 'values': asset_data})
|
||||
if liability_data:
|
||||
datasets.append({'name':'Liabilities', 'values': liability_data})
|
||||
datasets.append({'name':_('Liabilities'), 'values': liability_data})
|
||||
if equity_data:
|
||||
datasets.append({'name':'Equity', 'values': equity_data})
|
||||
datasets.append({'name':_('Equity'), 'values': equity_data})
|
||||
|
||||
chart = {
|
||||
"data": {
|
||||
@@ -153,4 +153,4 @@ def get_chart_data(filters, columns, asset, liability, equity):
|
||||
else:
|
||||
chart["type"] = "line"
|
||||
|
||||
return chart
|
||||
return chart
|
||||
|
||||
@@ -39,8 +39,8 @@ def execute(filters=None):
|
||||
return columns, data
|
||||
|
||||
def validate_filters(filters):
|
||||
if (filters.get("payment_type") == "Incoming" and filters.get("party_type") == "Supplier") or \
|
||||
(filters.get("payment_type") == "Outgoing" and filters.get("party_type") == "Customer"):
|
||||
if (filters.get("payment_type") == _("Incoming") and filters.get("party_type") == "Supplier") or \
|
||||
(filters.get("payment_type") == _("Outgoing") and filters.get("party_type") == "Customer"):
|
||||
frappe.throw(_("{0} payment entries can not be filtered by {1}")\
|
||||
.format(filters.payment_type, filters.party_type))
|
||||
|
||||
@@ -51,7 +51,7 @@ def get_columns(filters):
|
||||
_("Party Type") + "::100",
|
||||
_("Party") + ":Dynamic Link/Party Type:140",
|
||||
_("Posting Date") + ":Date:100",
|
||||
_("Invoice") + (":Link/Purchase Invoice:130" if filters.get("payment_type") == "Outgoing" else ":Link/Sales Invoice:130"),
|
||||
_("Invoice") + (":Link/Purchase Invoice:130" if filters.get("payment_type") == _("Outgoing") else ":Link/Sales Invoice:130"),
|
||||
_("Invoice Posting Date") + ":Date:130",
|
||||
_("Payment Due Date") + ":Date:130",
|
||||
_("Debit") + ":Currency:120",
|
||||
@@ -69,7 +69,7 @@ def get_conditions(filters):
|
||||
conditions = []
|
||||
|
||||
if not filters.party_type:
|
||||
if filters.payment_type == "Outgoing":
|
||||
if filters.payment_type == _("Outgoing"):
|
||||
filters.party_type = "Supplier"
|
||||
else:
|
||||
filters.party_type = "Customer"
|
||||
@@ -101,7 +101,7 @@ def get_entries(filters):
|
||||
|
||||
def get_invoice_posting_date_map(filters):
|
||||
invoice_details = {}
|
||||
dt = "Sales Invoice" if filters.get("payment_type") == "Incoming" else "Purchase Invoice"
|
||||
dt = "Sales Invoice" if filters.get("payment_type") == _("Incoming") else "Purchase Invoice"
|
||||
for t in frappe.db.sql("select name, posting_date, due_date from `tab{0}`".format(dt), as_dict=1):
|
||||
invoice_details[t.name] = t
|
||||
|
||||
|
||||
@@ -371,7 +371,7 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
|
||||
return frappe.db.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.report_type = "Profit and Loss"
|
||||
or tabAccount.account_type in ("Expense Account", "Fixed Asset", "Temporary", "Asset Received But Not Billed"))
|
||||
or tabAccount.account_type in ("Expense Account", "Fixed Asset", "Temporary", "Asset Received But Not Billed", "Capital Work in Progress"))
|
||||
and tabAccount.is_group=0
|
||||
and tabAccount.docstatus!=2
|
||||
and tabAccount.{key} LIKE %(txt)s
|
||||
|
||||
@@ -31,7 +31,7 @@ class SellingController(StockController):
|
||||
|
||||
def onload(self):
|
||||
super(SellingController, self).onload()
|
||||
if self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"):
|
||||
if self.docstatus==0 and self.doctype in ("Sales Order", "Delivery Note", "Sales Invoice"):
|
||||
for item in self.get("items"):
|
||||
item.update(get_bin_details(item.item_code, item.warehouse))
|
||||
|
||||
@@ -45,6 +45,7 @@ class SellingController(StockController):
|
||||
self.set_gross_profit()
|
||||
set_default_income_account_for_item(self)
|
||||
self.set_customer_address()
|
||||
self.validate_for_duplicate_items()
|
||||
|
||||
def set_missing_values(self, for_validate=False):
|
||||
|
||||
@@ -381,6 +382,34 @@ class SellingController(StockController):
|
||||
if self.get(address_field):
|
||||
self.set(address_display_field, get_address_display(self.get(address_field)))
|
||||
|
||||
def validate_for_duplicate_items(self):
|
||||
check_list, chk_dupl_itm = [], []
|
||||
if cint(frappe.db.get_single_value("Selling Settings", "allow_multiple_items")):
|
||||
return
|
||||
|
||||
for d in self.get('items'):
|
||||
if self.doctype == "Sales Invoice":
|
||||
e = [d.item_code, d.description, d.warehouse, d.sales_order or d.delivery_note, d.batch_no or '']
|
||||
f = [d.item_code, d.description, d.sales_order or d.delivery_note]
|
||||
elif self.doctype == "Delivery Note":
|
||||
e = [d.item_code, d.description, d.warehouse, d.against_sales_order or d.against_sales_invoice, d.batch_no or '']
|
||||
f = [d.item_code, d.description, d.against_sales_order or d.against_sales_invoice]
|
||||
elif self.doctype == "Sales Order":
|
||||
e = [d.item_code, d.description, d.warehouse, d.batch_no or '']
|
||||
f = [d.item_code, d.description]
|
||||
|
||||
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1:
|
||||
if e in check_list:
|
||||
frappe.throw(_("Note: Item {0} entered multiple times").format(d.item_code))
|
||||
else:
|
||||
check_list.append(e)
|
||||
else:
|
||||
if f in chk_dupl_itm:
|
||||
frappe.throw(_("Note: Item {0} entered multiple times").format(d.item_code))
|
||||
else:
|
||||
chk_dupl_itm.append(f)
|
||||
|
||||
|
||||
def validate_items(self):
|
||||
# validate items to see if they have is_sales_item enabled
|
||||
from erpnext.controllers.buying_controller import validate_item_type
|
||||
|
||||
@@ -69,9 +69,7 @@ class SalesOrder(SellingController):
|
||||
frappe.msgprint(_("Warning: Sales Order {0} already exists against Customer's Purchase Order {1}").format(so[0][0], self.po_no))
|
||||
|
||||
def validate_for_items(self):
|
||||
check_list = []
|
||||
for d in self.get('items'):
|
||||
check_list.append(cstr(d.item_code))
|
||||
|
||||
# used for production plan
|
||||
d.transaction_date = self.transaction_date
|
||||
@@ -80,13 +78,6 @@ class SalesOrder(SellingController):
|
||||
where item_code = %s and warehouse = %s", (d.item_code, d.warehouse))
|
||||
d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
|
||||
|
||||
# check for same entry multiple times
|
||||
unique_chk_list = set(check_list)
|
||||
if len(unique_chk_list) != len(check_list) and \
|
||||
not cint(frappe.db.get_single_value("Selling Settings", "allow_multiple_items")):
|
||||
frappe.msgprint(_("Same item has been entered multiple times"),
|
||||
title=_("Warning"), indicator='orange')
|
||||
|
||||
def product_bundle_has_stock_item(self, product_bundle):
|
||||
"""Returns true if product bundle has stock item"""
|
||||
ret = len(frappe.db.sql("""select i.name from tabItem i, `tabProduct Bundle Item` pbi
|
||||
|
||||
@@ -4,7 +4,7 @@ frappe.provide('erpnext.pos');
|
||||
frappe.pages['point-of-sale'].on_page_load = function(wrapper) {
|
||||
frappe.ui.make_app_page({
|
||||
parent: wrapper,
|
||||
title: 'Point of Sale',
|
||||
title: __("Point of Sale"),
|
||||
single_column: true
|
||||
});
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ def get_items(start, page_length, price_list, item_group, search_value="", pos_p
|
||||
batch_no = data.get("batch_no") if data.get("batch_no") else ""
|
||||
barcode = data.get("barcode") if data.get("barcode") else ""
|
||||
|
||||
item_code, condition = get_conditions(item_code, serial_no, batch_no, barcode)
|
||||
condition = get_conditions(item_code, serial_no, batch_no, barcode)
|
||||
|
||||
if pos_profile:
|
||||
condition += get_item_group_condition(pos_profile)
|
||||
@@ -38,58 +38,60 @@ def get_items(start, page_length, price_list, item_group, search_value="", pos_p
|
||||
# locate function is used to sort by closest match from the beginning of the value
|
||||
|
||||
|
||||
if display_items_in_stock == 0:
|
||||
res = frappe.db.sql("""select i.name as item_code, i.item_name, i.image as item_image, i.idx as idx,
|
||||
i.is_stock_item, item_det.price_list_rate, item_det.currency
|
||||
from `tabItem` i LEFT JOIN
|
||||
(select item_code, price_list_rate, currency from
|
||||
`tabItem Price` where price_list=%(price_list)s) item_det
|
||||
ON
|
||||
(item_det.item_code=i.name or item_det.item_code=i.variant_of)
|
||||
where
|
||||
i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1
|
||||
and i.item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt})
|
||||
and {condition} order by idx desc limit {start}, {page_length}""".format(start=start,page_length=page_length,lft=lft, rgt=rgt, condition=condition),
|
||||
{
|
||||
'item_code': item_code,
|
||||
'price_list': price_list
|
||||
} , as_dict=1)
|
||||
result = []
|
||||
|
||||
res = {
|
||||
'items': res
|
||||
}
|
||||
items_data = frappe.db.sql(""" SELECT name as item_code,
|
||||
item_name, image as item_image, idx as idx,is_stock_item
|
||||
FROM
|
||||
`tabItem`
|
||||
WHERE
|
||||
disabled = 0 and has_variants = 0 and is_sales_item = 1
|
||||
and item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt})
|
||||
and {condition} order by idx desc limit {start}, {page_length}"""
|
||||
.format(
|
||||
start=start, page_length=page_length,
|
||||
lft=lft, rgt=rgt,
|
||||
condition=condition
|
||||
), as_dict=1)
|
||||
|
||||
elif display_items_in_stock == 1:
|
||||
query = """select i.name as item_code, i.item_name, i.image as item_image, i.idx as idx,
|
||||
i.is_stock_item, item_det.price_list_rate, item_det.currency
|
||||
from `tabItem` i LEFT JOIN
|
||||
(select item_code, price_list_rate, currency from
|
||||
`tabItem Price` where price_list=%(price_list)s) item_det
|
||||
ON
|
||||
(item_det.item_code=i.name or item_det.item_code=i.variant_of) INNER JOIN"""
|
||||
if items_data:
|
||||
items = [d.item_code for d in items_data]
|
||||
item_prices_data = frappe.get_all("Item Price",
|
||||
fields = ["item_code", "price_list_rate", "currency"],
|
||||
filters = {'price_list': price_list, 'item_code': ['in', items]})
|
||||
|
||||
if warehouse is not None:
|
||||
query = query + """ (select item_code,actual_qty from `tabBin` where warehouse=%(warehouse)s and actual_qty > 0 group by item_code) item_se"""
|
||||
else:
|
||||
query = query + """ (select item_code,sum(actual_qty) as actual_qty from `tabBin` group by item_code) item_se"""
|
||||
item_prices, bin_data = {}, {}
|
||||
for d in item_prices_data:
|
||||
item_prices[d.item_code] = d
|
||||
|
||||
res = frappe.db.sql(query + """
|
||||
ON
|
||||
((item_se.item_code=i.name or item_det.item_code=i.variant_of) and item_se.actual_qty>0)
|
||||
where
|
||||
i.disabled = 0 and i.has_variants = 0 and i.is_sales_item = 1
|
||||
and i.item_group in (select name from `tabItem Group` where lft >= {lft} and rgt <= {rgt})
|
||||
and {condition} order by idx desc limit {start}, {page_length}""".format
|
||||
(start=start,page_length=page_length,lft=lft, rgt=rgt, condition=condition),
|
||||
{
|
||||
'item_code': item_code,
|
||||
'price_list': price_list,
|
||||
'warehouse': warehouse
|
||||
} , as_dict=1)
|
||||
|
||||
res = {
|
||||
'items': res
|
||||
}
|
||||
if display_items_in_stock:
|
||||
filters = {'actual_qty': [">", 0], 'item_code': ['in', items]}
|
||||
|
||||
if warehouse:
|
||||
filters['warehouse'] = warehouse
|
||||
|
||||
bin_data = frappe._dict(
|
||||
frappe.get_all("Bin", fields = ["item_code", "sum(actual_qty) as actual_qty"],
|
||||
filters = filters, group_by = "item_code")
|
||||
)
|
||||
|
||||
for item in items_data:
|
||||
row = {}
|
||||
|
||||
row.update(item)
|
||||
item_price = item_prices.get(item.item_code) or {}
|
||||
row.update({
|
||||
'price_list_rate': item_price.get('price_list_rate'),
|
||||
'currency': item_price.get('currency'),
|
||||
'actual_qty': bin_data.get('actual_qty')
|
||||
})
|
||||
|
||||
result.append(row)
|
||||
|
||||
res = {
|
||||
'items': result
|
||||
}
|
||||
|
||||
if serial_no:
|
||||
res.update({
|
||||
@@ -129,18 +131,16 @@ def search_serial_or_batch_or_barcode_number(search_value):
|
||||
|
||||
def get_conditions(item_code, serial_no, batch_no, barcode):
|
||||
if serial_no or batch_no or barcode:
|
||||
return frappe.db.escape(item_code), "i.name = %(item_code)s"
|
||||
return "name = '{0}'".format(frappe.db.escape(item_code))
|
||||
|
||||
condition = """(i.name like %(item_code)s
|
||||
or i.item_name like %(item_code)s)"""
|
||||
|
||||
return '%%%s%%'%(frappe.db.escape(item_code)), condition
|
||||
return """(name like '{item_code}'
|
||||
or item_name like '{item_code}')""".format(item_code = frappe.db.escape('%' + item_code + '%'))
|
||||
|
||||
def get_item_group_condition(pos_profile):
|
||||
cond = "and 1=1"
|
||||
item_groups = get_item_groups(pos_profile)
|
||||
if item_groups:
|
||||
cond = "and i.item_group in (%s)"%(', '.join(['%s']*len(item_groups)))
|
||||
cond = "and item_group in (%s)"%(', '.join(['%s']*len(item_groups)))
|
||||
|
||||
return cond % tuple(item_groups)
|
||||
|
||||
|
||||
@@ -111,7 +111,6 @@ class DeliveryNote(SellingController):
|
||||
self.so_required()
|
||||
self.validate_proj_cust()
|
||||
self.check_close_sales_order("against_sales_order")
|
||||
self.validate_for_items()
|
||||
self.validate_warehouse()
|
||||
self.validate_uom_is_integer("stock_uom", "stock_qty")
|
||||
self.validate_uom_is_integer("uom", "qty")
|
||||
@@ -165,25 +164,6 @@ class DeliveryNote(SellingController):
|
||||
if not res:
|
||||
frappe.throw(_("Customer {0} does not belong to project {1}").format(self.customer, self.project))
|
||||
|
||||
def validate_for_items(self):
|
||||
check_list, chk_dupl_itm = [], []
|
||||
if cint(frappe.db.get_single_value("Selling Settings", "allow_multiple_items")):
|
||||
return
|
||||
|
||||
for d in self.get('items'):
|
||||
e = [d.item_code, d.description, d.warehouse, d.against_sales_order or d.against_sales_invoice, d.batch_no or '']
|
||||
f = [d.item_code, d.description, d.against_sales_order or d.against_sales_invoice]
|
||||
|
||||
if frappe.db.get_value("Item", d.item_code, "is_stock_item") == 1:
|
||||
if e in check_list:
|
||||
frappe.msgprint(_("Note: Item {0} entered multiple times").format(d.item_code))
|
||||
else:
|
||||
check_list.append(e)
|
||||
else:
|
||||
if f in chk_dupl_itm:
|
||||
frappe.msgprint(_("Note: Item {0} entered multiple times").format(d.item_code))
|
||||
else:
|
||||
chk_dupl_itm.append(f)
|
||||
|
||||
def validate_warehouse(self):
|
||||
super(DeliveryNote, self).validate_warehouse()
|
||||
|
||||
@@ -124,6 +124,7 @@ class Item(WebsiteGenerator):
|
||||
self.validate_item_defaults()
|
||||
self.update_defaults_from_item_group()
|
||||
self.validate_stock_for_has_batch_and_has_serial()
|
||||
self.update_show_in_website()
|
||||
|
||||
if not self.get("__islocal"):
|
||||
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
|
||||
@@ -437,6 +438,10 @@ class Item(WebsiteGenerator):
|
||||
|
||||
[self.remove(d) for d in to_remove]
|
||||
|
||||
def update_show_in_website(self):
|
||||
if self.disabled:
|
||||
self.show_in_website = False
|
||||
|
||||
def update_template_tables(self):
|
||||
template = frappe.get_doc("Item", self.variant_of)
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ frappe.pages['stock-balance'].on_page_load = function(wrapper) {
|
||||
label: __('Item'),
|
||||
fieldtype:'Link',
|
||||
options:'Item',
|
||||
get_query: function() {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.item_query"
|
||||
}
|
||||
},
|
||||
change: function() {
|
||||
page.item_dashboard.start = 0;
|
||||
page.item_dashboard.refresh();
|
||||
|
||||
@@ -8,7 +8,12 @@ frappe.query_reports["Item Price Stock"] = {
|
||||
"fieldname":"item_code",
|
||||
"label": __("Item"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Item"
|
||||
"options": "Item",
|
||||
"get_query": function() {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.item_query"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,12 @@ frappe.query_reports["Stock Ageing"] = {
|
||||
"fieldname":"item_code",
|
||||
"label": __("Item"),
|
||||
"fieldtype": "Link",
|
||||
"options": "Item"
|
||||
"options": "Item",
|
||||
"get_query": function() {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.item_query"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldname":"brand",
|
||||
@@ -37,4 +42,4 @@ frappe.query_reports["Stock Ageing"] = {
|
||||
"options": "Brand"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ frappe.query_reports["Stock Analytics"] = {
|
||||
label: __("Item"),
|
||||
fieldtype: "Link",
|
||||
options:"Item",
|
||||
get_query: function() {
|
||||
return {
|
||||
query: "erpnext.controllers.queries.item_query"
|
||||
}
|
||||
},
|
||||
default: "",
|
||||
},
|
||||
{
|
||||
|
||||
@@ -224,9 +224,9 @@ class update_entries_after(object):
|
||||
elif actual_qty < 0:
|
||||
# In case of delivery/stock issue, get average purchase rate
|
||||
# of serial nos of current entry
|
||||
stock_value_change = -1 * flt(frappe.db.sql("""select sum(purchase_rate)
|
||||
from `tabSerial No` where name in (%s)""" % (", ".join(["%s"]*len(serial_no))),
|
||||
tuple(serial_no))[0][0])
|
||||
stock_value_change = -1 * flt(frappe.get_all("Serial No",
|
||||
fields=["sum(purchase_rate)"],
|
||||
filters = {'name': ('in', serial_no)}, as_list=1)[0][0])
|
||||
|
||||
new_stock_qty = self.qty_after_transaction + actual_qty
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ frappe.ready(function() {
|
||||
.html(r.message.product_info.price.formatted_price_sales_uom + "<div style='font-size: small'>\
|
||||
(" + r.message.product_info.price.formatted_price + " / " + r.message.product_info.uom + ")</div>");
|
||||
|
||||
if(r.message.product_info.in_stock==0) {
|
||||
if(r.message.product_info.in_stock==0 && r.message.cart_settings.show_stock_availability) {
|
||||
$(".item-stock").html("<div style='color: red'> <i class='fa fa-close'></i> {{ _("Not in stock") }}</div>");
|
||||
}
|
||||
else if(r.message.product_info.in_stock==1) {
|
||||
|
||||
Reference in New Issue
Block a user