Merge branch 'develop' into payment-terms
This commit is contained in:
@@ -4,7 +4,7 @@ import inspect
|
|||||||
import frappe
|
import frappe
|
||||||
from erpnext.hooks import regional_overrides
|
from erpnext.hooks import regional_overrides
|
||||||
|
|
||||||
__version__ = '9.0.4'
|
__version__ = '9.0.6'
|
||||||
|
|
||||||
def get_default_company(user=None):
|
def get_default_company(user=None):
|
||||||
'''Get default company for user'''
|
'''Get default company for user'''
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amo
|
|||||||
from erpnext.hr.doctype.employee_loan.employee_loan import update_disbursement_status
|
from erpnext.hr.doctype.employee_loan.employee_loan import update_disbursement_status
|
||||||
|
|
||||||
class JournalEntry(AccountsController):
|
class JournalEntry(AccountsController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(JournalEntry, self).__init__(arg1, arg2)
|
super(JournalEntry, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def get_feed(self):
|
def get_feed(self):
|
||||||
return self.voucher_type
|
return self.voucher_type
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ form_grid_templates = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PurchaseInvoice(BuyingController):
|
class PurchaseInvoice(BuyingController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(PurchaseInvoice, self).__init__(arg1, arg2)
|
super(PurchaseInvoice, self).__init__(*args, **kwargs)
|
||||||
self.status_updater = [{
|
self.status_updater = [{
|
||||||
'source_dt': 'Purchase Invoice Item',
|
'source_dt': 'Purchase Invoice Item',
|
||||||
'target_dt': 'Purchase Order Item',
|
'target_dt': 'Purchase Order Item',
|
||||||
|
|||||||
@@ -417,6 +417,7 @@ def make_contact(args,customer):
|
|||||||
'link_doctype': 'Customer',
|
'link_doctype': 'Customer',
|
||||||
'link_name': customer
|
'link_name': customer
|
||||||
})
|
})
|
||||||
|
doc.flags.ignore_mandatory = True
|
||||||
doc.save(ignore_permissions=True)
|
doc.save(ignore_permissions=True)
|
||||||
|
|
||||||
def make_address(args, customer):
|
def make_address(args, customer):
|
||||||
@@ -441,6 +442,7 @@ def make_address(args, customer):
|
|||||||
address.is_primary_address = 1
|
address.is_primary_address = 1
|
||||||
address.is_shipping_address = 1
|
address.is_shipping_address = 1
|
||||||
address.update(args)
|
address.update(args)
|
||||||
|
address.flags.ignore_mandatory = True
|
||||||
address.save(ignore_permissions = True)
|
address.save(ignore_permissions = True)
|
||||||
|
|
||||||
def make_email_queue(email_queue):
|
def make_email_queue(email_queue):
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ form_grid_templates = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class SalesInvoice(SellingController):
|
class SalesInvoice(SellingController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(SalesInvoice, self).__init__(arg1, arg2)
|
super(SalesInvoice, self).__init__(*args, **kwargs)
|
||||||
self.status_updater = [{
|
self.status_updater = [{
|
||||||
'source_dt': 'Sales Invoice Item',
|
'source_dt': 'Sales Invoice Item',
|
||||||
'target_field': 'billed_amt',
|
'target_field': 'billed_amt',
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.page.add_menu_item(__("Sync Offline Invoices"), function () {
|
this.page.add_menu_item(__("Sync Offline Invoices"), function () {
|
||||||
|
me.freeze_screen = true;
|
||||||
me.sync_sales_invoice()
|
me.sync_sales_invoice()
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1684,6 +1685,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
set_interval_for_si_sync: function () {
|
set_interval_for_si_sync: function () {
|
||||||
var me = this;
|
var me = this;
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
|
me.freeze_screen = false;
|
||||||
me.sync_sales_invoice()
|
me.sync_sales_invoice()
|
||||||
}, 60000)
|
}, 60000)
|
||||||
},
|
},
|
||||||
@@ -1697,9 +1699,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
|||||||
this.freeze = this.customer_doc.display
|
this.freeze = this.customer_doc.display
|
||||||
}
|
}
|
||||||
|
|
||||||
|
freeze_screen = this.freeze_screen || false;
|
||||||
|
|
||||||
if ((this.si_docs.length || this.email_queue_list || this.customers_list) && !this.freeze) {
|
if ((this.si_docs.length || this.email_queue_list || this.customers_list) && !this.freeze) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
|
method: "erpnext.accounts.doctype.sales_invoice.pos.make_invoice",
|
||||||
|
freeze: freeze_screen,
|
||||||
args: {
|
args: {
|
||||||
doc_list: me.si_docs,
|
doc_list: me.si_docs,
|
||||||
email_queue_list: me.email_queue_list,
|
email_queue_list: me.email_queue_list,
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ def set_address_details(out, party, party_type, doctype=None, company=None):
|
|||||||
billing_address_field = "customer_address" if party_type == "Lead" \
|
billing_address_field = "customer_address" if party_type == "Lead" \
|
||||||
else party_type.lower() + "_address"
|
else party_type.lower() + "_address"
|
||||||
out[billing_address_field] = get_default_address(party_type, party.name)
|
out[billing_address_field] = get_default_address(party_type, party.name)
|
||||||
|
if doctype:
|
||||||
out.update(get_fetch_values(doctype, billing_address_field, out[billing_address_field]))
|
out.update(get_fetch_values(doctype, billing_address_field, out[billing_address_field]))
|
||||||
|
|
||||||
# address display
|
# address display
|
||||||
@@ -78,6 +79,7 @@ def set_address_details(out, party, party_type, doctype=None, company=None):
|
|||||||
if party_type in ["Customer", "Lead"]:
|
if party_type in ["Customer", "Lead"]:
|
||||||
out.shipping_address_name = get_default_address(party_type, party.name, 'is_shipping_address')
|
out.shipping_address_name = get_default_address(party_type, party.name, 'is_shipping_address')
|
||||||
out.shipping_address = get_address_display(out["shipping_address_name"])
|
out.shipping_address = get_address_display(out["shipping_address_name"])
|
||||||
|
if doctype:
|
||||||
out.update(get_fetch_values(doctype, 'shipping_address_name', out.shipping_address_name))
|
out.update(get_fetch_values(doctype, 'shipping_address_name', out.shipping_address_name))
|
||||||
|
|
||||||
if doctype and doctype in ['Delivery Note', 'Sales Invoice']:
|
if doctype and doctype in ['Delivery Note', 'Sales Invoice']:
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ form_grid_templates = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PurchaseOrder(BuyingController):
|
class PurchaseOrder(BuyingController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(PurchaseOrder, self).__init__(arg1, arg2)
|
super(PurchaseOrder, self).__init__(*args, **kwargs)
|
||||||
self.status_updater = [{
|
self.status_updater = [{
|
||||||
'source_dt': 'Purchase Order Item',
|
'source_dt': 'Purchase Order Item',
|
||||||
'target_dt': 'Material Request Item',
|
'target_dt': 'Material Request Item',
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ from erpnext.exceptions import InvalidCurrency
|
|||||||
force_item_fields = ("item_group", "barcode", "brand", "stock_uom")
|
force_item_fields = ("item_group", "barcode", "brand", "stock_uom")
|
||||||
|
|
||||||
class AccountsController(TransactionBase):
|
class AccountsController(TransactionBase):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(AccountsController, self).__init__(arg1, arg2)
|
super(AccountsController, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def company_currency(self):
|
def company_currency(self):
|
||||||
@@ -213,9 +213,6 @@ class AccountsController(TransactionBase):
|
|||||||
if stock_qty != len(get_serial_nos(item.get('serial_no'))):
|
if stock_qty != len(get_serial_nos(item.get('serial_no'))):
|
||||||
item.set(fieldname, value)
|
item.set(fieldname, value)
|
||||||
|
|
||||||
elif fieldname == "conversion_factor" and not item.get("conversion_factor"):
|
|
||||||
item.set(fieldname, value)
|
|
||||||
|
|
||||||
if ret.get("pricing_rule"):
|
if ret.get("pricing_rule"):
|
||||||
# if user changed the discount percentage then set user's discount percentage ?
|
# if user changed the discount percentage then set user's discount percentage ?
|
||||||
item.set("discount_percentage", ret.get("discount_percentage"))
|
item.set("discount_percentage", ret.get("discount_percentage"))
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class BuyingController(StockController):
|
|||||||
|
|
||||||
# set contact and address details for supplier, if they are not mentioned
|
# set contact and address details for supplier, if they are not mentioned
|
||||||
if getattr(self, "supplier", None):
|
if getattr(self, "supplier", None):
|
||||||
self.update_if_missing(get_party_details(self.supplier, party_type="Supplier", ignore_permissions=self.flags.ignore_permissions))
|
self.update_if_missing(get_party_details(self.supplier, party_type="Supplier", ignore_permissions=self.flags.ignore_permissions, doctype=self.doctype, company=self.company))
|
||||||
|
|
||||||
self.set_missing_item_details(for_validate)
|
self.set_missing_item_details(for_validate)
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ class SellingController(StockController):
|
|||||||
if getattr(self, "customer", None):
|
if getattr(self, "customer", None):
|
||||||
from erpnext.accounts.party import _get_party_details
|
from erpnext.accounts.party import _get_party_details
|
||||||
party_details = _get_party_details(self.customer,
|
party_details = _get_party_details(self.customer,
|
||||||
ignore_permissions=self.flags.ignore_permissions)
|
ignore_permissions=self.flags.ignore_permissions,
|
||||||
|
doctype=self.doctype, company=self.company)
|
||||||
if not self.meta.get_field("sales_team"):
|
if not self.meta.get_field("sales_team"):
|
||||||
party_details.pop("sales_team")
|
party_details.pop("sales_team")
|
||||||
|
|
||||||
|
|||||||
@@ -42,10 +42,28 @@ class Opportunity(TransactionBase):
|
|||||||
if not self.with_items:
|
if not self.with_items:
|
||||||
self.items = []
|
self.items = []
|
||||||
|
|
||||||
|
|
||||||
def make_new_lead_if_required(self):
|
def make_new_lead_if_required(self):
|
||||||
"""Set lead against new opportunity"""
|
"""Set lead against new opportunity"""
|
||||||
if not (self.lead or self.customer) and self.contact_email:
|
if not (self.lead or self.customer) and self.contact_email:
|
||||||
|
# check if customer is already created agains the self.contact_email
|
||||||
|
customer = frappe.db.sql("""select
|
||||||
|
distinct `tabDynamic Link`.link_name as customer
|
||||||
|
from
|
||||||
|
`tabContact`,
|
||||||
|
`tabDynamic Link`
|
||||||
|
where `tabContact`.email_id='{0}'
|
||||||
|
and
|
||||||
|
`tabContact`.name=`tabDynamic Link`.parent
|
||||||
|
and
|
||||||
|
ifnull(`tabDynamic Link`.link_name, '')<>''
|
||||||
|
and
|
||||||
|
`tabDynamic Link`.link_doctype='Customer'
|
||||||
|
""".format(self.contact_email), as_dict=True)
|
||||||
|
if customer and customer[0].customer:
|
||||||
|
self.customer = customer[0].customer
|
||||||
|
self.enquiry_from = "Customer"
|
||||||
|
return
|
||||||
|
|
||||||
lead_name = frappe.db.get_value("Lead", {"email_id": self.contact_email})
|
lead_name = frappe.db.get_value("Lead", {"email_id": self.contact_email})
|
||||||
if not lead_name:
|
if not lead_name:
|
||||||
sender_name = get_fullname(self.contact_email)
|
sender_name = get_fullname(self.contact_email)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import today
|
from frappe.utils import today
|
||||||
|
from erpnext.crm.doctype.lead.lead import make_customer
|
||||||
from erpnext.crm.doctype.opportunity.opportunity import make_quotation
|
from erpnext.crm.doctype.opportunity.opportunity import make_quotation
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@@ -25,12 +26,45 @@ class TestOpportunity(unittest.TestCase):
|
|||||||
doc = frappe.get_doc('Opportunity', doc.name)
|
doc = frappe.get_doc('Opportunity', doc.name)
|
||||||
self.assertEquals(doc.status, "Quotation")
|
self.assertEquals(doc.status, "Quotation")
|
||||||
|
|
||||||
|
def test_make_new_lead_if_required(self):
|
||||||
|
args = {
|
||||||
|
"doctype": "Opportunity",
|
||||||
|
"contact_email":"new.opportunity@example.com",
|
||||||
|
"enquiry_type": "Sales",
|
||||||
|
"with_items": 0,
|
||||||
|
"transaction_date": today()
|
||||||
|
}
|
||||||
|
# new lead should be created against the new.opportunity@example.com
|
||||||
|
opp_doc = frappe.get_doc(args).insert(ignore_permissions=True)
|
||||||
|
|
||||||
|
self.assertTrue(opp_doc.lead)
|
||||||
|
self.assertEquals(opp_doc.enquiry_from, "Lead")
|
||||||
|
self.assertEquals(frappe.db.get_value("Lead", opp_doc.lead, "email_id"),
|
||||||
|
'new.opportunity@example.com')
|
||||||
|
|
||||||
|
# create new customer and create new contact against 'new.opportunity@example.com'
|
||||||
|
customer = make_customer(opp_doc.lead).insert(ignore_permissions=True)
|
||||||
|
frappe.get_doc({
|
||||||
|
"doctype": "Contact",
|
||||||
|
"email_id": "new.opportunity@example.com",
|
||||||
|
"first_name": "_Test Opportunity Customer",
|
||||||
|
"links": [{
|
||||||
|
"link_doctype": "Customer",
|
||||||
|
"link_name": customer.name
|
||||||
|
}]
|
||||||
|
}).insert(ignore_permissions=True)
|
||||||
|
|
||||||
|
opp_doc = frappe.get_doc(args).insert(ignore_permissions=True)
|
||||||
|
self.assertTrue(opp_doc.customer)
|
||||||
|
self.assertEquals(opp_doc.enquiry_from, "Customer")
|
||||||
|
self.assertEquals(opp_doc.customer, customer.name)
|
||||||
|
|
||||||
def make_opportunity(**args):
|
def make_opportunity(**args):
|
||||||
args = frappe._dict(args)
|
args = frappe._dict(args)
|
||||||
|
|
||||||
opp_doc = frappe.get_doc({
|
opp_doc = frappe.get_doc({
|
||||||
"doctype": "Opportunity",
|
"doctype": "Opportunity",
|
||||||
"enquiry_from": "Customer" or args.enquiry_from,
|
"enquiry_from": args.enquiry_from or "Customer",
|
||||||
"enquiry_type": "Sales",
|
"enquiry_type": "Sales",
|
||||||
"with_items": args.with_items or 0,
|
"with_items": args.with_items or 0,
|
||||||
"transaction_date": today()
|
"transaction_date": today()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ app_email = "info@erpnext.com"
|
|||||||
app_license = "GNU General Public License (v3)"
|
app_license = "GNU General Public License (v3)"
|
||||||
source_link = "https://github.com/frappe/erpnext"
|
source_link = "https://github.com/frappe/erpnext"
|
||||||
|
|
||||||
develop_version = '8.x.x-beta'
|
develop_version = '9.x.x-develop'
|
||||||
|
|
||||||
error_report_email = "support@erpnext.com"
|
error_report_email = "support@erpnext.com"
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
|
|||||||
from erpnext.manufacturing.doctype.production_order.production_order import get_item_details
|
from erpnext.manufacturing.doctype.production_order.production_order import get_item_details
|
||||||
|
|
||||||
class ProductionPlanningTool(Document):
|
class ProductionPlanningTool(Document):
|
||||||
def __init__(self, arg1, arg2=None):
|
|
||||||
super(ProductionPlanningTool, self).__init__(arg1, arg2)
|
|
||||||
self.item_dict = {}
|
|
||||||
|
|
||||||
def clear_table(self, table_name):
|
def clear_table(self, table_name):
|
||||||
self.set(table_name, [])
|
self.set(table_name, [])
|
||||||
|
|
||||||
@@ -398,6 +394,9 @@ class ProductionPlanningTool(Document):
|
|||||||
return bom_wise_item_details
|
return bom_wise_item_details
|
||||||
|
|
||||||
def make_items_dict(self, item_list):
|
def make_items_dict(self, item_list):
|
||||||
|
if not getattr(self, "item_dict", None):
|
||||||
|
self.item_dict = {}
|
||||||
|
|
||||||
for i in item_list:
|
for i in item_list:
|
||||||
self.item_dict.setdefault(i[0], []).append([flt(i[1]), i[2], i[3], i[4], i[5]])
|
self.item_dict.setdefault(i[0], []).append([flt(i[1]), i[2], i[3], i[4], i[5]])
|
||||||
|
|
||||||
|
|||||||
@@ -101,27 +101,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
return me.set_query_for_batch(doc, cdt, cdn)
|
return me.set_query_for_batch(doc, cdt, cdn)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
|
||||||
onload: function() {
|
|
||||||
var me = this;
|
|
||||||
if(this.frm.doc.__islocal) {
|
|
||||||
var today = frappe.datetime.get_today(),
|
|
||||||
currency = frappe.defaults.get_user_default("currency");
|
|
||||||
|
|
||||||
$.each({
|
|
||||||
currency: currency,
|
|
||||||
price_list_currency: currency,
|
|
||||||
status: "Draft",
|
|
||||||
is_subcontracted: "No",
|
|
||||||
}, function(fieldname, value) {
|
|
||||||
if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname])
|
|
||||||
me.frm.set_value(fieldname, value);
|
|
||||||
});
|
|
||||||
|
|
||||||
if(this.frm.doc.company && !this.frm.doc.amended_from) {
|
|
||||||
this.frm.trigger("company");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(this.frm.fields_dict["payment_terms_template"]){
|
if(this.frm.fields_dict["payment_terms_template"]){
|
||||||
this.frm.trigger("payment_terms_template");
|
this.frm.trigger("payment_terms_template");
|
||||||
@@ -157,11 +136,36 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
filters: filters
|
filters: filters
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onload: function() {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
this.setup_quality_inspection();
|
this.setup_quality_inspection();
|
||||||
|
|
||||||
|
if(this.frm.doc.__islocal) {
|
||||||
|
var currency = frappe.defaults.get_user_default("currency");
|
||||||
|
|
||||||
|
let set_value = (fieldname, value) => {
|
||||||
|
if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname]) {
|
||||||
|
return me.frm.set_value(fieldname, value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return frappe.run_serially([
|
||||||
|
() => set_value('currency', currency),
|
||||||
|
() => set_value('price_list_currency', currency),
|
||||||
|
() => set_value('status', 'Draft'),
|
||||||
|
() => set_value('is_subcontracted', 'No'),
|
||||||
|
() => {
|
||||||
|
if(this.frm.doc.company && !this.frm.doc.amended_from) {
|
||||||
|
this.frm.trigger("company");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setup_quality_inspection: function() {
|
setup_quality_inspection: function() {
|
||||||
@@ -199,13 +203,12 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onload_post_render: function() {
|
onload_post_render: function() {
|
||||||
var me = this;
|
|
||||||
if(this.frm.doc.__islocal && !(this.frm.doc.taxes || []).length
|
if(this.frm.doc.__islocal && !(this.frm.doc.taxes || []).length
|
||||||
&& !(this.frm.doc.__onload ? this.frm.doc.__onload.load_after_mapping : false)) {
|
&& !(this.frm.doc.__onload ? this.frm.doc.__onload.load_after_mapping : false)) {
|
||||||
this.apply_default_taxes();
|
frappe.after_ajax(() => this.apply_default_taxes());
|
||||||
} else if(this.frm.doc.__islocal && this.frm.doc.company && this.frm.doc["items"]
|
} else if(this.frm.doc.__islocal && this.frm.doc.company && this.frm.doc["items"]
|
||||||
&& !this.frm.doc.is_pos) {
|
&& !this.frm.doc.is_pos) {
|
||||||
me.calculate_taxes_and_totals();
|
frappe.after_ajax(() => this.calculate_taxes_and_totals());
|
||||||
}
|
}
|
||||||
if(frappe.meta.get_docfield(this.frm.doc.doctype + " Item", "item_code")) {
|
if(frappe.meta.get_docfield(this.frm.doc.doctype + " Item", "item_code")) {
|
||||||
this.setup_item_selector();
|
this.setup_item_selector();
|
||||||
@@ -383,7 +386,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
var company_currency = me.get_company_currency();
|
var company_currency = me.get_company_currency();
|
||||||
var company_doc = frappe.get_doc(":Company", me.frm.doc.company);
|
var company_doc = frappe.get_doc(":Company", me.frm.doc.company);
|
||||||
|
|
||||||
if (!me.frm.doc.currency || me.frm.doc.currency != company_currency) {
|
if (!me.frm.doc.currency) {
|
||||||
me.frm.set_value("currency", company_currency);
|
me.frm.set_value("currency", company_currency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,10 @@ erpnext.setup.slides_settings = [
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
validate: function() {
|
validate: function() {
|
||||||
|
if ((this.values.company_name || "").toLowerCase() == "company") {
|
||||||
|
frappe.msgprint(__("Company Name cannot be Company"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!this.values.company_abbr) {
|
if (!this.values.company_abbr) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -135,10 +139,6 @@ erpnext.setup.slides_settings = [
|
|||||||
frappe.msgprint(__("Please enter valid Financial Year Start and End Dates"));
|
frappe.msgprint(__("Please enter valid Financial Year Start and End Dates"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((this.values.company_name || "").toLowerCase() == "company") {
|
|
||||||
frappe.msgprint(__("Company Name cannot be Company"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,17 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
|||||||
|
|
||||||
if(this.show_dialog) {
|
if(this.show_dialog) {
|
||||||
let d = this.item;
|
let d = this.item;
|
||||||
|
if (d.has_serial_no && d.serial_no) {
|
||||||
this.dialog.set_value('serial_no', d.serial_no);
|
this.dialog.set_value('serial_no', d.serial_no);
|
||||||
|
} else if (d.batch_no) {
|
||||||
|
this.dialog.fields_dict.batches.df.data.push({
|
||||||
|
'batch_no': d.batch_no,
|
||||||
|
'actual_qty': d.actual_qty,
|
||||||
|
'selected_qty': d.qty
|
||||||
|
});
|
||||||
|
|
||||||
|
this.dialog.fields_dict.batches.grid.refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dialog.show();
|
this.dialog.show();
|
||||||
@@ -116,19 +126,23 @@ erpnext.SerialNoBatchSelector = Class.extend({
|
|||||||
}
|
}
|
||||||
values.batches.map((batch, i) => {
|
values.batches.map((batch, i) => {
|
||||||
if(!batch.selected_qty || batch.selected_qty === 0 ) {
|
if(!batch.selected_qty || batch.selected_qty === 0 ) {
|
||||||
|
if (!this.show_dialog) {
|
||||||
frappe.throw(__("Please select quantity on row " + (i+1)));
|
frappe.throw(__("Please select quantity on row " + (i+1)));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
let serial_nos = values.serial_no || '';
|
let serial_nos = values.serial_no || '';
|
||||||
if (!serial_nos || !serial_nos.replace(/\s/g, '').length) {
|
if (!serial_nos || !serial_nos.replace(/\s/g, '').length) {
|
||||||
|
if (!this.show_dialog) {
|
||||||
frappe.throw(__("Please enter serial numbers for serialized item "
|
frappe.throw(__("Please enter serial numbers for serialized item "
|
||||||
+ values.item_code));
|
+ values.item_code));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ class StudentApplicant(Document):
|
|||||||
if self.student_admission:
|
if self.student_admission:
|
||||||
naming_series = frappe.db.get_value('Student Admission', self.student_admission,
|
naming_series = frappe.db.get_value('Student Admission', self.student_admission,
|
||||||
'naming_series_for_student_applicant')
|
'naming_series_for_student_applicant')
|
||||||
print(naming_series)
|
|
||||||
|
|
||||||
if naming_series:
|
if naming_series:
|
||||||
self.naming_series = naming_series
|
self.naming_series = naming_series
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ from erpnext.stock.utils import get_valid_serial_nos
|
|||||||
from erpnext.utilities.transaction_base import TransactionBase
|
from erpnext.utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
class InstallationNote(TransactionBase):
|
class InstallationNote(TransactionBase):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(InstallationNote, self).__init__(arg1, arg2)
|
super(InstallationNote, self).__init__(*args, **kwargs)
|
||||||
self.status_updater = [{
|
self.status_updater = [{
|
||||||
'source_dt': 'Installation Note Item',
|
'source_dt': 'Installation Note Item',
|
||||||
'target_dt': 'Delivery Note Item',
|
'target_dt': 'Delivery Note Item',
|
||||||
|
|||||||
@@ -79,15 +79,10 @@ class Quotation(SellingController):
|
|||||||
else:
|
else:
|
||||||
frappe.throw(_("Cannot set as Lost as Sales Order is made."))
|
frappe.throw(_("Cannot set as Lost as Sales Order is made."))
|
||||||
|
|
||||||
def check_item_table(self):
|
|
||||||
if not self.get('items'):
|
|
||||||
frappe.throw(_("Please enter item details"))
|
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.check_item_table()
|
|
||||||
|
|
||||||
# Check for Approving Authority
|
# Check for Approving Authority
|
||||||
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)
|
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
|
||||||
|
self.company, self.base_grand_total, self)
|
||||||
|
|
||||||
#update enquiry status
|
#update enquiry status
|
||||||
self.update_opportunity()
|
self.update_opportunity()
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ form_grid_templates = {
|
|||||||
class WarehouseRequired(frappe.ValidationError): pass
|
class WarehouseRequired(frappe.ValidationError): pass
|
||||||
|
|
||||||
class SalesOrder(SellingController):
|
class SalesOrder(SellingController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(SalesOrder, self).__init__(arg1, arg2)
|
super(SalesOrder, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
super(SalesOrder, self).validate()
|
super(SalesOrder, self).validate()
|
||||||
@@ -696,7 +696,8 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc=
|
|||||||
"contact_display",
|
"contact_display",
|
||||||
"contact_mobile",
|
"contact_mobile",
|
||||||
"contact_email",
|
"contact_email",
|
||||||
"contact_person"
|
"contact_person",
|
||||||
|
"taxes_and_charges"
|
||||||
],
|
],
|
||||||
"validation": {
|
"validation": {
|
||||||
"docstatus": ["=", 1]
|
"docstatus": ["=", 1]
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
this.cart = new POSCart({
|
this.cart = new POSCart({
|
||||||
frm: this.frm,
|
frm: this.frm,
|
||||||
wrapper: this.wrapper.find('.cart-container'),
|
wrapper: this.wrapper.find('.cart-container'),
|
||||||
|
pos_profile: this.pos_profile,
|
||||||
events: {
|
events: {
|
||||||
on_customer_change: (customer) => this.frm.set_value('customer', customer),
|
on_customer_change: (customer) => this.frm.set_value('customer', customer),
|
||||||
on_field_change: (item_code, field, value) => {
|
on_field_change: (item_code, field, value) => {
|
||||||
@@ -196,6 +197,7 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
this.update_item_in_frm(item)
|
this.update_item_in_frm(item)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// update cart
|
// update cart
|
||||||
|
this.remove_item_from_cart(item);
|
||||||
this.update_cart_data(item);
|
this.update_cart_data(item);
|
||||||
});
|
});
|
||||||
}, true);
|
}, true);
|
||||||
@@ -215,12 +217,18 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
return this.frm.script_manager
|
return this.frm.script_manager
|
||||||
.trigger('qty', item.doctype, item.name)
|
.trigger('qty', item.doctype, item.name)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (field === 'qty' && value === 0) {
|
if (field === 'qty') {
|
||||||
frappe.model.clear_doc(item.doctype, item.name);
|
this.remove_item_from_cart(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
remove_item_from_cart(item) {
|
||||||
|
if (item.qty === 0) {
|
||||||
|
frappe.model.clear_doc(item.doctype, item.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
make_payment_modal() {
|
make_payment_modal() {
|
||||||
this.payment = new Payment({
|
this.payment = new Payment({
|
||||||
frm: this.frm,
|
frm: this.frm,
|
||||||
@@ -363,10 +371,11 @@ erpnext.pos.PointOfSale = class PointOfSale {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class POSCart {
|
class POSCart {
|
||||||
constructor({frm, wrapper, events}) {
|
constructor({frm, wrapper, pos_profile, events}) {
|
||||||
this.frm = frm;
|
this.frm = frm;
|
||||||
this.wrapper = wrapper;
|
this.wrapper = wrapper;
|
||||||
this.events = events;
|
this.events = events;
|
||||||
|
this.pos_profile = pos_profile;
|
||||||
this.make();
|
this.make();
|
||||||
this.bind_events();
|
this.bind_events();
|
||||||
}
|
}
|
||||||
@@ -514,6 +523,7 @@ class POSCart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
make_customer_field() {
|
make_customer_field() {
|
||||||
|
let customer = this.frm.doc.customer || this.pos_profile['customer'];
|
||||||
this.customer_field = frappe.ui.form.make_control({
|
this.customer_field = frappe.ui.form.make_control({
|
||||||
df: {
|
df: {
|
||||||
fieldtype: 'Link',
|
fieldtype: 'Link',
|
||||||
@@ -521,7 +531,6 @@ class POSCart {
|
|||||||
fieldname: 'customer',
|
fieldname: 'customer',
|
||||||
options: 'Customer',
|
options: 'Customer',
|
||||||
reqd: 1,
|
reqd: 1,
|
||||||
default: this.frm.doc.customer,
|
|
||||||
onchange: () => {
|
onchange: () => {
|
||||||
this.events.on_customer_change(this.customer_field.get_value());
|
this.events.on_customer_change(this.customer_field.get_value());
|
||||||
}
|
}
|
||||||
@@ -529,6 +538,10 @@ class POSCart {
|
|||||||
parent: this.wrapper.find('.customer-field'),
|
parent: this.wrapper.find('.customer-field'),
|
||||||
render_input: true
|
render_input: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (customer) {
|
||||||
|
this.customer_field.set_value(customer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
make_numpad() {
|
make_numpad() {
|
||||||
@@ -919,7 +932,7 @@ class POSItems {
|
|||||||
}
|
}
|
||||||
if(batch_no) {
|
if(batch_no) {
|
||||||
this.events.update_cart(items[0].item_code,
|
this.events.update_cart(items[0].item_code,
|
||||||
'batch_no', serial_no);
|
'batch_no', batch_no);
|
||||||
this.search_field.set_value('');
|
this.search_field.set_value('');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,14 +16,13 @@ user_specific_content = ["calendar_events", "todo_list"]
|
|||||||
|
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
class EmailDigest(Document):
|
class EmailDigest(Document):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(EmailDigest, self).__init__(arg1, arg2)
|
super(EmailDigest, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.from_date, self.to_date = self.get_from_to_date()
|
self.from_date, self.to_date = self.get_from_to_date()
|
||||||
self.set_dates()
|
self.set_dates()
|
||||||
self._accounts = {}
|
self._accounts = {}
|
||||||
self.currency = frappe.db.get_value("Company", self.company,
|
self.currency = frappe.db.get_value("Company", self.company, "default_currency")
|
||||||
"default_currency")
|
|
||||||
|
|
||||||
def get_users(self):
|
def get_users(self):
|
||||||
"""get list of users"""
|
"""get list of users"""
|
||||||
|
|||||||
@@ -191,21 +191,21 @@ def create_healthcare_item_groups():
|
|||||||
def create_lab_test_items():
|
def create_lab_test_items():
|
||||||
records = [
|
records = [
|
||||||
{"doctype": "Item", "item_code": "MCH", "item_name": "MCH", "item_group": "Laboratory",
|
{"doctype": "Item", "item_code": "MCH", "item_name": "MCH", "item_group": "Laboratory",
|
||||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||||
{"doctype": "Item", "item_code": "LDL", "item_name": "LDL", "item_group": "Laboratory",
|
{"doctype": "Item", "item_code": "LDL", "item_name": "LDL", "item_group": "Laboratory",
|
||||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||||
{"doctype": "Item", "item_code": "GTT", "item_name": "GTT", "item_group": "Laboratory",
|
{"doctype": "Item", "item_code": "GTT", "item_name": "GTT", "item_group": "Laboratory",
|
||||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||||
{"doctype": "Item", "item_code": "HDL", "item_name": "HDL", "item_group": "Laboratory",
|
{"doctype": "Item", "item_code": "HDL", "item_name": "HDL", "item_group": "Laboratory",
|
||||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||||
{"doctype": "Item", "item_code": "BILT", "item_name": "BILT", "item_group": "Laboratory",
|
{"doctype": "Item", "item_code": "BILT", "item_name": "BILT", "item_group": "Laboratory",
|
||||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||||
{"doctype": "Item", "item_code": "BILD", "item_name": "BILD", "item_group": "Laboratory",
|
{"doctype": "Item", "item_code": "BILD", "item_name": "BILD", "item_group": "Laboratory",
|
||||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||||
{"doctype": "Item", "item_code": "BP", "item_name": "BP", "item_group": "Laboratory",
|
{"doctype": "Item", "item_code": "BP", "item_name": "BP", "item_group": "Laboratory",
|
||||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1},
|
||||||
{"doctype": "Item", "item_code": "BS", "item_name": "BS", "item_group": "Laboratory",
|
{"doctype": "Item", "item_code": "BS", "item_name": "BS", "item_group": "Laboratory",
|
||||||
"stock_uom": "Unit", "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}
|
"stock_uom": _("Unit"), "is_stock_item": 0, "is_purchase_item": 0, "is_sales_item": 1}
|
||||||
]
|
]
|
||||||
insert_record(records)
|
insert_record(records)
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ form_grid_templates = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DeliveryNote(SellingController):
|
class DeliveryNote(SellingController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(DeliveryNote, self).__init__(arg1, arg2)
|
super(DeliveryNote, self).__init__(*args, **kwargs)
|
||||||
self.status_updater = [{
|
self.status_updater = [{
|
||||||
'source_dt': 'Delivery Note Item',
|
'source_dt': 'Delivery Note Item',
|
||||||
'target_dt': 'Sales Order Item',
|
'target_dt': 'Sales Order Item',
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ form_grid_templates = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class PurchaseReceipt(BuyingController):
|
class PurchaseReceipt(BuyingController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(PurchaseReceipt, self).__init__(arg1, arg2)
|
super(PurchaseReceipt, self).__init__(*args, **kwargs)
|
||||||
self.status_updater = [{
|
self.status_updater = [{
|
||||||
'source_dt': 'Purchase Receipt Item',
|
'source_dt': 'Purchase Receipt Item',
|
||||||
'target_dt': 'Purchase Order Item',
|
'target_dt': 'Purchase Order Item',
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ class SerialNoNotExistsError(ValidationError): pass
|
|||||||
class SerialNoDuplicateError(ValidationError): pass
|
class SerialNoDuplicateError(ValidationError): pass
|
||||||
|
|
||||||
class SerialNo(StockController):
|
class SerialNo(StockController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(SerialNo, self).__init__(arg1, arg2)
|
super(SerialNo, self).__init__(*args, **kwargs)
|
||||||
self.via_stock_ledger = False
|
self.via_stock_ledger = False
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ class OpeningEntryAccountError(frappe.ValidationError): pass
|
|||||||
class EmptyStockReconciliationItemsError(frappe.ValidationError): pass
|
class EmptyStockReconciliationItemsError(frappe.ValidationError): pass
|
||||||
|
|
||||||
class StockReconciliation(StockController):
|
class StockReconciliation(StockController):
|
||||||
def __init__(self, arg1, arg2=None):
|
def __init__(self, *args, **kwargs):
|
||||||
super(StockReconciliation, self).__init__(arg1, arg2)
|
super(StockReconciliation, self).__init__(*args, **kwargs)
|
||||||
self.head_row = ["Item Code", "Warehouse", "Quantity", "Valuation Rate"]
|
self.head_row = ["Item Code", "Warehouse", "Quantity", "Valuation Rate"]
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
|||||||
@@ -165,14 +165,13 @@ def get_basic_details(args, item):
|
|||||||
warehouse = user_default_warehouse or item.default_warehouse or args.warehouse
|
warehouse = user_default_warehouse or item.default_warehouse or args.warehouse
|
||||||
|
|
||||||
#Set the UOM to the Default Sales UOM or Default Purchase UOM if configured in the Item Master
|
#Set the UOM to the Default Sales UOM or Default Purchase UOM if configured in the Item Master
|
||||||
|
if not args.uom:
|
||||||
if args.get('doctype') in ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice']:
|
if args.get('doctype') in ['Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice']:
|
||||||
uom = item.sales_uom if item.sales_uom else item.stock_uom
|
args.uom = item.sales_uom if item.sales_uom else item.stock_uom
|
||||||
elif args.get('doctype') in ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']:
|
elif args.get('doctype') in ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']:
|
||||||
uom = item.purchase_uom if item.purchase_uom else item.stock_uom
|
args.uom = item.purchase_uom if item.purchase_uom else item.stock_uom
|
||||||
else:
|
else:
|
||||||
uom = item.stock_uom
|
args.uom = item.stock_uom
|
||||||
|
|
||||||
args.uom = uom
|
|
||||||
|
|
||||||
out = frappe._dict({
|
out = frappe._dict({
|
||||||
"item_code": item.name,
|
"item_code": item.name,
|
||||||
@@ -188,7 +187,7 @@ def get_basic_details(args, item):
|
|||||||
"batch_no": None,
|
"batch_no": None,
|
||||||
"item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in
|
"item_tax_rate": json.dumps(dict(([d.tax_type, d.tax_rate] for d in
|
||||||
item.get("taxes")))),
|
item.get("taxes")))),
|
||||||
"uom": uom,
|
"uom": args.uom,
|
||||||
"min_order_qty": flt(item.min_order_qty) if args.doctype == "Material Request" else "",
|
"min_order_qty": flt(item.min_order_qty) if args.doctype == "Material Request" else "",
|
||||||
"qty": args.qty or 1.0,
|
"qty": args.qty or 1.0,
|
||||||
"stock_qty": args.qty or 1.0,
|
"stock_qty": args.qty or 1.0,
|
||||||
|
|||||||
Reference in New Issue
Block a user