Merge branch 'develop' into lcv_multicurrency
This commit is contained in:
commit
cc22814df5
@ -152,7 +152,7 @@
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.CesVal, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(0, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.Discount, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(0, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.OthChrg, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.RndOffAmt, None, "INR") }}</td>
|
||||
<td class="text-right">{{ frappe.utils.fmt_money(value_details.TotInvVal, None, "INR") }}</td>
|
||||
</tr>
|
||||
|
@ -43,22 +43,24 @@ def get_data(filters):
|
||||
currency = erpnext.get_company_currency(filters.get('company'))
|
||||
|
||||
for key, qty in iteritems(pledge_values):
|
||||
row = {}
|
||||
current_value = flt(qty * loan_security_details.get(key[1], {}).get('latest_price', 0))
|
||||
valid_upto = loan_security_details.get(key[1], {}).get('valid_upto')
|
||||
if qty:
|
||||
row = {}
|
||||
current_value = flt(qty * loan_security_details.get(key[1], {}).get('latest_price', 0))
|
||||
valid_upto = loan_security_details.get(key[1], {}).get('valid_upto')
|
||||
|
||||
row.update(loan_security_details.get(key[1]))
|
||||
row.update({
|
||||
'applicant_type': applicant_type_map.get(key[0]),
|
||||
'applicant_name': key[0],
|
||||
'total_qty': qty,
|
||||
'current_value': current_value,
|
||||
'price_valid_upto': valid_upto,
|
||||
'portfolio_percent': flt(current_value * 100 / total_value_map.get(key[0]), 2),
|
||||
'currency': currency
|
||||
})
|
||||
row.update(loan_security_details.get(key[1]))
|
||||
row.update({
|
||||
'applicant_type': applicant_type_map.get(key[0]),
|
||||
'applicant_name': key[0],
|
||||
'total_qty': qty,
|
||||
'current_value': current_value,
|
||||
'price_valid_upto': valid_upto,
|
||||
'portfolio_percent': flt(current_value * 100 / total_value_map.get(key[0]), 2) if total_value_map.get(key[0]) \
|
||||
else 0.0,
|
||||
'currency': currency
|
||||
})
|
||||
|
||||
data.append(row)
|
||||
data.append(row)
|
||||
|
||||
return data
|
||||
|
||||
|
@ -40,21 +40,22 @@ def get_data(filters):
|
||||
currency = erpnext.get_company_currency(filters.get('company'))
|
||||
|
||||
for security, value in iteritems(current_pledges):
|
||||
row = {}
|
||||
current_value = flt(value.get('qty', 0) * loan_security_details.get(security, {}).get('latest_price', 0))
|
||||
valid_upto = loan_security_details.get(security, {}).get('valid_upto')
|
||||
if value.get('qty'):
|
||||
row = {}
|
||||
current_value = flt(value.get('qty', 0) * loan_security_details.get(security, {}).get('latest_price', 0))
|
||||
valid_upto = loan_security_details.get(security, {}).get('valid_upto')
|
||||
|
||||
row.update(loan_security_details.get(security))
|
||||
row.update({
|
||||
'total_qty': value.get('qty'),
|
||||
'current_value': current_value,
|
||||
'price_valid_upto': valid_upto,
|
||||
'portfolio_percent': flt(current_value * 100 / total_portfolio_value, 2),
|
||||
'pledged_applicant_count': value.get('applicant_count'),
|
||||
'currency': currency
|
||||
})
|
||||
row.update(loan_security_details.get(security))
|
||||
row.update({
|
||||
'total_qty': value.get('qty'),
|
||||
'current_value': current_value,
|
||||
'price_valid_upto': valid_upto,
|
||||
'portfolio_percent': flt(current_value * 100 / total_portfolio_value, 2),
|
||||
'pledged_applicant_count': value.get('applicant_count'),
|
||||
'currency': currency
|
||||
})
|
||||
|
||||
data.append(row)
|
||||
data.append(row)
|
||||
|
||||
return data
|
||||
|
||||
|
@ -53,8 +53,7 @@ frappe.ui.form.on('Additional Salary', {
|
||||
if (!frm.doc.company) return;
|
||||
frm.set_query("salary_component", function() {
|
||||
return {
|
||||
query: "erpnext.payroll.doctype.salary_structure.salary_structure.get_earning_deduction_components",
|
||||
filters: {type: "earning", company: frm.doc.company}
|
||||
filters: {type: ["in", ["earning", "deduction"]], company: frm.doc.company}
|
||||
};
|
||||
});
|
||||
},
|
||||
|
@ -10,15 +10,7 @@ frappe.ui.form.on('Employee Incentive', {
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
if (!frm.doc.company) return;
|
||||
frm.set_query("salary_component", function() {
|
||||
return {
|
||||
query: "erpnext.payroll.doctype.salary_structure.salary_structure.get_earning_deduction_components",
|
||||
filters: {type: "earning", company: frm.doc.company}
|
||||
};
|
||||
});
|
||||
|
||||
frm.trigger('set_earning_component');
|
||||
},
|
||||
|
||||
employee: function(frm) {
|
||||
@ -45,11 +37,21 @@ frappe.ui.form.on('Employee Incentive', {
|
||||
callback: function(data) {
|
||||
if (data.message) {
|
||||
frm.set_value("company", data.message.company);
|
||||
frm.trigger('set_earning_component');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
set_earning_component: function(frm) {
|
||||
if (!frm.doc.company) return;
|
||||
frm.set_query("salary_component", function() {
|
||||
return {
|
||||
filters: {type: "earning", company: frm.doc.company}
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
get_employee_currency: function(frm) {
|
||||
frappe.call({
|
||||
method: "erpnext.payroll.doctype.salary_structure_assignment.salary_structure_assignment.get_employee_currency",
|
||||
|
@ -58,13 +58,11 @@ frappe.ui.form.on('Salary Structure', {
|
||||
if(!frm.doc.company) return;
|
||||
frm.set_query("salary_component", "earnings", function() {
|
||||
return {
|
||||
query : "erpnext.payroll.doctype.salary_structure.salary_structure.get_earning_deduction_components",
|
||||
filters: {type: "earning", company: frm.doc.company}
|
||||
};
|
||||
});
|
||||
frm.set_query("salary_component", "deductions", function() {
|
||||
return {
|
||||
query : "erpnext.payroll.doctype.salary_structure.salary_structure.get_earning_deduction_components",
|
||||
filters: {type: "deduction", company: frm.doc.company}
|
||||
};
|
||||
});
|
||||
|
@ -207,22 +207,3 @@ def get_employees(salary_structure):
|
||||
|
||||
return list(set([d.employee for d in employees]))
|
||||
|
||||
@frappe.whitelist()
|
||||
@frappe.validate_and_sanitize_search_inputs
|
||||
def get_earning_deduction_components(doctype, txt, searchfield, start, page_len, filters):
|
||||
if len(filters) < 2:
|
||||
return {}
|
||||
|
||||
return frappe.db.sql("""
|
||||
select t1.salary_component
|
||||
from `tabSalary Component` t1, `tabSalary Component Account` t2
|
||||
where (t1.name = t2.parent
|
||||
and t1.type = %(type)s
|
||||
and t2.company = %(company)s)
|
||||
or (t1.type = %(type)s
|
||||
and t1.statistical_component = 1)
|
||||
order by salary_component
|
||||
""",{
|
||||
"type": filters['type'],
|
||||
"company": filters['company']
|
||||
})
|
||||
|
@ -195,6 +195,10 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
this._super(doc, cdt, cdn);
|
||||
},
|
||||
|
||||
batch_no: function(doc, cdt, cdn) {
|
||||
this._super(doc, cdt, cdn);
|
||||
},
|
||||
|
||||
received_qty: function(doc, cdt, cdn) {
|
||||
this.calculate_accepted_qty(doc, cdt, cdn)
|
||||
},
|
||||
|
@ -589,11 +589,21 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
return frappe.db.get_value("Item", item.item_code, ["has_batch_no", "has_serial_no"])
|
||||
.then((r) => {
|
||||
if (r.message &&
|
||||
(r.message.has_batch_no || r.message.has_serial_no)) {
|
||||
(r.message.has_batch_no || r.message.has_serial_no)) {
|
||||
frappe.flags.hide_serial_batch_dialog = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
() => {
|
||||
// check if batch serial selector is disabled or not
|
||||
if (show_batch_dialog && !frappe.flags.hide_serial_batch_dialog)
|
||||
return frappe.db.get_single_value('Stock Settings', 'disable_serial_no_and_batch_selector')
|
||||
.then((value) => {
|
||||
if (value) {
|
||||
frappe.flags.hide_serial_batch_dialog = true;
|
||||
}
|
||||
});
|
||||
},
|
||||
() => {
|
||||
if(show_batch_dialog && !frappe.flags.hide_serial_batch_dialog) {
|
||||
var d = locals[cdt][cdn];
|
||||
@ -1099,6 +1109,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
}
|
||||
},
|
||||
|
||||
batch_no: function(doc, cdt, cdn) {
|
||||
let item = frappe.get_doc(cdt, cdn);
|
||||
this.apply_price_list(item, true);
|
||||
},
|
||||
|
||||
toggle_conversion_factor: function(item) {
|
||||
// toggle read only property for conversion factor field if the uom and stock uom are same
|
||||
if(this.frm.get_field('items').grid.fields_map.conversion_factor) {
|
||||
@ -1403,6 +1418,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
||||
"pricing_rules": d.pricing_rules,
|
||||
"warehouse": d.warehouse,
|
||||
"serial_no": d.serial_no,
|
||||
"batch_no": d.batch_no,
|
||||
"price_list_rate": d.price_list_rate,
|
||||
"conversion_factor": d.conversion_factor || 1.0
|
||||
});
|
||||
|
@ -399,6 +399,10 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
|
||||
}
|
||||
},
|
||||
|
||||
batch_no: function(doc, cdt, cdn) {
|
||||
this._super(doc, cdt, cdn);
|
||||
},
|
||||
|
||||
qty: function(doc, cdt, cdn) {
|
||||
this._super(doc, cdt, cdn);
|
||||
|
||||
|
@ -8,6 +8,8 @@ import unittest
|
||||
|
||||
from erpnext.stock.doctype.batch.batch import get_batch_qty, UnableToSelectBatchError, get_batch_no
|
||||
from frappe.utils import cint, flt
|
||||
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
|
||||
from erpnext.stock.get_item_details import get_item_details
|
||||
|
||||
class TestBatch(unittest.TestCase):
|
||||
def test_item_has_batch_enabled(self):
|
||||
@ -182,7 +184,7 @@ class TestBatch(unittest.TestCase):
|
||||
stock_entry.cancel()
|
||||
current_batch_qty = flt(frappe.db.get_value("Batch", "B100", "batch_qty"))
|
||||
self.assertEqual(current_batch_qty, existing_batch_qty)
|
||||
|
||||
|
||||
@classmethod
|
||||
def make_new_batch_and_entry(cls, item_name, batch_name, warehouse):
|
||||
'''Make a new stock entry for given target warehouse and batch name of item'''
|
||||
@ -252,6 +254,72 @@ class TestBatch(unittest.TestCase):
|
||||
|
||||
return batch
|
||||
|
||||
def test_batch_wise_item_price(self):
|
||||
if not frappe.db.get_value('Item', '_Test Batch Price Item'):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Item',
|
||||
'is_stock_item': 1,
|
||||
'item_code': '_Test Batch Price Item',
|
||||
'item_group': 'Products',
|
||||
'has_batch_no': 1,
|
||||
'create_new_batch': 1
|
||||
}).insert(ignore_permissions=True)
|
||||
|
||||
batch1 = create_batch('_Test Batch Price Item', 200, 1)
|
||||
batch2 = create_batch('_Test Batch Price Item', 300, 1)
|
||||
batch3 = create_batch('_Test Batch Price Item', 400, 0)
|
||||
|
||||
args = frappe._dict({
|
||||
"item_code": "_Test Batch Price Item",
|
||||
"company": "_Test Company with perpetual inventory",
|
||||
"price_list": "_Test Price List",
|
||||
"currency": "_Test Currency",
|
||||
"doctype": "Sales Invoice",
|
||||
"conversion_rate": 1,
|
||||
"price_list_currency": "_Test Currency",
|
||||
"plc_conversion_rate": 1,
|
||||
"customer": "_Test Customer",
|
||||
"name": None
|
||||
})
|
||||
|
||||
#test price for batch1
|
||||
args.update({'batch_no': batch1})
|
||||
details = get_item_details(args)
|
||||
self.assertEqual(details.get('price_list_rate'), 200)
|
||||
|
||||
#test price for batch2
|
||||
args.update({'batch_no': batch2})
|
||||
details = get_item_details(args)
|
||||
self.assertEqual(details.get('price_list_rate'), 300)
|
||||
|
||||
#test price for batch3
|
||||
args.update({'batch_no': batch3})
|
||||
details = get_item_details(args)
|
||||
self.assertEqual(details.get('price_list_rate'), 400)
|
||||
|
||||
def create_batch(item_code, rate, create_item_price_for_batch):
|
||||
pi = make_purchase_invoice(company="_Test Company with perpetual inventory",
|
||||
warehouse= "Stores - TCP1", cost_center = "Main - TCP1", update_stock=1,
|
||||
expense_account ="_Test Account Cost for Goods Sold - TCP1", item_code=item_code)
|
||||
|
||||
batch = frappe.db.get_value('Batch', {'item': item_code, 'reference_name': pi.name})
|
||||
|
||||
if not create_item_price_for_batch:
|
||||
create_price_list_for_batch(item_code, None, rate)
|
||||
else:
|
||||
create_price_list_for_batch(item_code, batch, rate)
|
||||
|
||||
return batch
|
||||
|
||||
def create_price_list_for_batch(item_code, batch, rate):
|
||||
frappe.get_doc({
|
||||
'doctype': 'Item Price',
|
||||
'item_code': '_Test Batch Price Item',
|
||||
'price_list': '_Test Price List',
|
||||
'batch_no': batch,
|
||||
'price_list_rate': rate
|
||||
}).insert()
|
||||
|
||||
def make_new_batch(**args):
|
||||
args = frappe._dict(args)
|
||||
|
||||
|
@ -15,5 +15,13 @@ frappe.ui.form.on("Item Price", {
|
||||
|
||||
frm.set_df_property("bulk_import_help", "options",
|
||||
'<a href="#data-import-tool/Item Price">' + __("Import in Bulk") + '</a>');
|
||||
|
||||
frm.set_query('batch_no', function() {
|
||||
return {
|
||||
filters: {
|
||||
'item': frm.doc.item_code
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -18,6 +18,7 @@
|
||||
"price_list",
|
||||
"customer",
|
||||
"supplier",
|
||||
"batch_no",
|
||||
"column_break_3",
|
||||
"buying",
|
||||
"selling",
|
||||
@ -47,31 +48,41 @@
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Item",
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
"search_index": 1,
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"label": "UOM",
|
||||
"options": "UOM"
|
||||
"options": "UOM",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"description": "Quantity that must be bought or sold per UOM",
|
||||
"fieldname": "packing_unit",
|
||||
"fieldtype": "Int",
|
||||
"label": "Packing Unit"
|
||||
"label": "Packing Unit",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_17",
|
||||
"fieldtype": "Column Break"
|
||||
"fieldtype": "Column Break",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Name",
|
||||
"read_only": 1
|
||||
"read_only": 1,
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fetch_from": "item_code.brand",
|
||||
@ -79,19 +90,25 @@
|
||||
"fieldtype": "Read Only",
|
||||
"in_list_view": 1,
|
||||
"label": "Brand",
|
||||
"read_only": 1
|
||||
"read_only": 1,
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "item_description",
|
||||
"fieldtype": "Text",
|
||||
"label": "Item Description",
|
||||
"read_only": 1
|
||||
"read_only": 1,
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "price_list_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Price List",
|
||||
"options": "fa fa-tags"
|
||||
"options": "fa fa-tags",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "price_list",
|
||||
@ -100,7 +117,9 @@
|
||||
"in_standard_filter": 1,
|
||||
"label": "Price List",
|
||||
"options": "Price List",
|
||||
"reqd": 1
|
||||
"reqd": 1,
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
@ -108,37 +127,49 @@
|
||||
"fieldname": "customer",
|
||||
"fieldtype": "Link",
|
||||
"label": "Customer",
|
||||
"options": "Customer"
|
||||
"options": "Customer",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:doc.buying == 1",
|
||||
"fieldname": "supplier",
|
||||
"fieldtype": "Link",
|
||||
"label": "Supplier",
|
||||
"options": "Supplier"
|
||||
"options": "Supplier",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break"
|
||||
"fieldtype": "Column Break",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "buying",
|
||||
"fieldtype": "Check",
|
||||
"label": "Buying",
|
||||
"read_only": 1
|
||||
"read_only": 1,
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "selling",
|
||||
"fieldtype": "Check",
|
||||
"label": "Selling",
|
||||
"read_only": 1
|
||||
"read_only": 1,
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "item_details",
|
||||
"fieldtype": "Section Break",
|
||||
"options": "fa fa-tag"
|
||||
"options": "fa fa-tag",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"bold": 1,
|
||||
@ -146,11 +177,15 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Currency",
|
||||
"options": "Currency",
|
||||
"read_only": 1
|
||||
"read_only": 1,
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "col_br_1",
|
||||
"fieldtype": "Column Break"
|
||||
"fieldtype": "Column Break",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "price_list_rate",
|
||||
@ -162,53 +197,80 @@
|
||||
"oldfieldname": "ref_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "currency",
|
||||
"reqd": 1
|
||||
"reqd": 1,
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_15",
|
||||
"fieldtype": "Section Break"
|
||||
"fieldtype": "Section Break",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"default": "Today",
|
||||
"fieldname": "valid_from",
|
||||
"fieldtype": "Date",
|
||||
"label": "Valid From"
|
||||
"label": "Valid From",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "lead_time_days",
|
||||
"fieldtype": "Int",
|
||||
"label": "Lead Time in days"
|
||||
"label": "Lead Time in days",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_18",
|
||||
"fieldtype": "Column Break"
|
||||
"fieldtype": "Column Break",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "valid_upto",
|
||||
"fieldtype": "Date",
|
||||
"label": "Valid Upto"
|
||||
"label": "Valid Upto",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_24",
|
||||
"fieldtype": "Section Break"
|
||||
"fieldtype": "Section Break",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "note",
|
||||
"fieldtype": "Text",
|
||||
"label": "Note"
|
||||
"label": "Note",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "reference",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Reference"
|
||||
"label": "Reference",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "batch_no",
|
||||
"fieldtype": "Link",
|
||||
"label": "Batch No",
|
||||
"options": "Batch",
|
||||
"show_days": 1,
|
||||
"show_seconds": 1
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-flag",
|
||||
"idx": 1,
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2020-07-06 22:31:32.943475",
|
||||
"modified": "2020-12-08 18:12:15.395772",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Item Price",
|
||||
|
@ -54,7 +54,8 @@ class ItemPrice(Document):
|
||||
"valid_upto",
|
||||
"packing_unit",
|
||||
"customer",
|
||||
"supplier",]:
|
||||
"supplier",
|
||||
"batch_no"]:
|
||||
if self.get(field):
|
||||
conditions += " and {0} = %({0})s ".format(field)
|
||||
else:
|
||||
@ -68,7 +69,7 @@ class ItemPrice(Document):
|
||||
self.as_dict(),)
|
||||
|
||||
if price_list_rate:
|
||||
frappe.throw(_("Item Price appears multiple times based on Price List, Supplier/Customer, Currency, Item, UOM, Qty, and Dates."), ItemPriceDuplicateItem,)
|
||||
frappe.throw(_("Item Price appears multiple times based on Price List, Supplier/Customer, Currency, Item, Batch, UOM, Qty, and Dates."), ItemPriceDuplicateItem,)
|
||||
|
||||
def before_save(self):
|
||||
if self.selling:
|
||||
|
@ -16,6 +16,7 @@
|
||||
"action_if_quality_inspection_is_not_submitted",
|
||||
"show_barcode_field",
|
||||
"clean_description_html",
|
||||
"disable_serial_no_and_batch_selector",
|
||||
"section_break_7",
|
||||
"auto_insert_price_list_rate_if_missing",
|
||||
"allow_negative_stock",
|
||||
@ -227,6 +228,12 @@
|
||||
"fieldname": "control_historical_stock_transactions_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Control Historical Stock Transactions"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "disable_serial_no_and_batch_selector",
|
||||
"fieldtype": "Check",
|
||||
"label": "Disable Serial No And Batch Selector"
|
||||
}
|
||||
],
|
||||
"icon": "icon-cog",
|
||||
@ -234,7 +241,7 @@
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2020-12-29 12:53:31.162247",
|
||||
"modified": "2021-01-18 13:15:38.352796",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Stock Settings",
|
||||
|
@ -674,6 +674,8 @@ def get_item_price(args, item_code, ignore_party=False):
|
||||
and price_list=%(price_list)s
|
||||
and ifnull(uom, '') in ('', %(uom)s)"""
|
||||
|
||||
conditions += "and ifnull(batch_no, '') in ('', %(batch_no)s)"
|
||||
|
||||
if not ignore_party:
|
||||
if args.get("customer"):
|
||||
conditions += " and customer=%(customer)s"
|
||||
@ -692,7 +694,7 @@ def get_item_price(args, item_code, ignore_party=False):
|
||||
|
||||
return frappe.db.sql(""" select name, price_list_rate, uom
|
||||
from `tabItem Price` {conditions}
|
||||
order by valid_from desc, uom desc """.format(conditions=conditions), args)
|
||||
order by valid_from desc, batch_no desc, uom desc """.format(conditions=conditions), args)
|
||||
|
||||
def get_price_list_rate_for(args, item_code):
|
||||
"""
|
||||
@ -711,6 +713,7 @@ def get_price_list_rate_for(args, item_code):
|
||||
"uom": args.get('uom'),
|
||||
"transaction_date": args.get('transaction_date'),
|
||||
"posting_date": args.get('posting_date'),
|
||||
"batch_no": args.get('batch_no')
|
||||
}
|
||||
|
||||
item_price_data = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user