Merge branch 'develop' into rfq-contact-email-set

This commit is contained in:
Marica 2021-02-11 13:23:56 +05:30 committed by GitHub
commit a5039e8f85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 98 additions and 85 deletions

View File

@ -20,11 +20,16 @@ class POSClosingEntry(StatusUpdater):
self.validate_pos_invoices()
def validate_pos_closing(self):
user = frappe.get_all("POS Closing Entry",
filters = { "user": self.user, "docstatus": 1, "pos_profile": self.pos_profile },
or_filters = {
"period_start_date": ("between", [self.period_start_date, self.period_end_date]),
"period_end_date": ("between", [self.period_start_date, self.period_end_date])
user = frappe.db.sql("""
SELECT name FROM `tabPOS Closing Entry`
WHERE
user = %(user)s AND docstatus = 1 AND pos_profile = %(profile)s AND
(period_start_date between %(start)s and %(end)s OR period_end_date between %(start)s and %(end)s)
""", {
'user': self.user,
'profile': self.pos_profile,
'start': self.period_start_date,
'end': self.period_end_date
})
if user:

View File

@ -317,13 +317,14 @@ class POSInvoice(SalesInvoice):
)
customer_group_price_list = frappe.db.get_value("Customer Group", customer_group, 'default_price_list')
selling_price_list = customer_price_list or customer_group_price_list or profile.get('selling_price_list')
if customer_currency != profile.get('currency'):
self.set('currency', customer_currency)
else:
selling_price_list = profile.get('selling_price_list')
if selling_price_list:
self.set('selling_price_list', selling_price_list)
if customer_currency != profile.get('currency'):
self.set('currency', customer_currency)
# set pos values in items
for item in self.get("items"):

View File

@ -212,8 +212,8 @@ def consolidate_pos_invoices(pos_invoices=[], closing_entry={}):
invoice_by_customer = get_invoice_customer_map(invoices)
if len(invoices) >= 5 and closing_entry:
enqueue_job(create_merge_logs, invoice_by_customer, closing_entry)
closing_entry.set_status(update=True, status='Queued')
enqueue_job(create_merge_logs, invoice_by_customer, closing_entry)
else:
create_merge_logs(invoice_by_customer, closing_entry)
@ -225,8 +225,8 @@ def unconsolidate_pos_invoices(closing_entry):
)
if len(merge_logs) >= 5:
enqueue_job(cancel_merge_logs, merge_logs, closing_entry)
closing_entry.set_status(update=True, status='Queued')
enqueue_job(cancel_merge_logs, merge_logs, closing_entry)
else:
cancel_merge_logs(merge_logs, closing_entry)

View File

@ -1521,6 +1521,7 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
parent.flags.ignore_validate_update_after_submit = True
parent.set_qty_as_per_stock_uom()
parent.calculate_taxes_and_totals()
parent.set_total_in_words()
if parent_doctype == "Sales Order":
make_packing_list(parent)
parent.set_gross_profit()

View File

@ -313,7 +313,7 @@ class StockController(AccountsController):
return serialized_items
def validate_warehouse(self):
from erpnext.stock.utils import validate_warehouse_company
from erpnext.stock.utils import validate_warehouse_company, validate_disabled_warehouse
warehouses = list(set([d.warehouse for d in
self.get("items") if getattr(d, "warehouse", None)]))
@ -329,6 +329,7 @@ class StockController(AccountsController):
warehouses.extend(from_warehouse)
for w in warehouses:
validate_disabled_warehouse(w)
validate_warehouse_company(w, self.company)
def update_billing_percentage(self, update_modified=True):

View File

@ -78,7 +78,9 @@ def get_scheduled_employees_for_popup(communication_medium):
def strip_number(number):
if not number: return
# strip 0 from the start of the number for proper number comparisions
# strip + and 0 from the start of the number for proper number comparisions
# eg. +7888383332 should match with 7888383332
# eg. 07888383332 should match with 7888383332
number = number.lstrip('+')
number = number.lstrip('0')
return number

View File

@ -145,7 +145,7 @@ def create_inpatient(patient):
def get_healthcare_service_unit(unit_name=None):
if not unit_name:
service_unit = get_random("Healthcare Service Unit", filters={"inpatient_occupancy": 1})
service_unit = get_random("Healthcare Service Unit", filters={"inpatient_occupancy": 1, "company": "_Test Company"})
else:
service_unit = frappe.db.exists("Healthcare Service Unit", {"healthcare_service_unit_name": unit_name})

View File

@ -119,7 +119,7 @@ def create_records(patient):
ip_record.expected_length_of_stay = 0
ip_record.save()
ip_record.reload()
service_unit = get_healthcare_service_unit()
service_unit = get_healthcare_service_unit('Test Service Unit Ip Occupancy')
admit_patient(ip_record, service_unit, now_datetime())
ipmo = create_ipmo(patient)

View File

@ -78,7 +78,7 @@ website_generators = ["Item Group", "Item", "BOM", "Sales Partner",
"Job Opening", "Student Admission"]
website_context = {
"favicon": "/assets/erpnext/images/favicon.png",
"favicon": "/assets/erpnext/images/erpnext-favicon.svg",
"splash_image": "/assets/erpnext/images/erpnext-logo.svg"
}

View File

@ -16,7 +16,7 @@ class JobOffer(Document):
def validate(self):
self.validate_vacancies()
job_offer = frappe.db.exists("Job Offer",{"job_applicant": self.job_applicant})
job_offer = frappe.db.exists("Job Offer",{"job_applicant": self.job_applicant, "docstatus": ["!=", 2]})
if job_offer and job_offer != self.name:
frappe.throw(_("Job Offer: {0} is already for Job Applicant: {1}").format(frappe.bold(job_offer), frappe.bold(self.job_applicant)))

View File

@ -1,5 +1,6 @@
frappe.listview_settings['Leave Application'] = {
add_fields: ["leave_type", "employee", "employee_name", "total_leave_days", "from_date", "to_date"],
has_indicator_for_draft: 1,
get_indicator: function (doc) {
if (doc.status === "Approved") {
return [__("Approved"), "green", "status,=,Approved"];

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="88px" height="88px" viewBox="0 0 88 88" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 44.1 (41455) - http://www.bohemiancoding.com/sketch -->
<title>erpnext-logo</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="erpnext-logo" transform="translate(-2.000000, -2.000000)" fill-rule="nonzero">
<g id="g1422-7-2" transform="translate(0.025630, 0.428785)" fill="#5E64FF">
<g id="g1418-4-6" transform="translate(0.268998, 0.867736)">
<g id="g1416-4-9" transform="translate(0.749997, 0.000000)">
<path d="M14.1845844,0.703479866 L75.0387175,0.703479866 C82.3677094,0.703479866 88.2679029,6.60367875 88.2679029,13.9326374 L88.2679029,74.7868158 C88.2679029,82.1157744 82.3677094,88.0159833 75.0387175,88.0159833 L14.1845844,88.0159833 C6.85569246,88.0159833 0.955398949,82.1157744 0.955398949,74.7868158 L0.955398949,13.9326374 C0.955398949,6.60367875 6.85569246,0.703479866 14.1845844,0.703479866 L14.1845844,0.703479866 Z" id="path1414-3-4"></path>
</g>
</g>
</g>
<g id="g1444-6-7" transform="translate(27.708247, 23.320960)" fill="#FFFFFF">
<path d="M4.06942472,0.507006595 C3.79457554,0.507006595 3.52673783,0.534925429 3.26792241,0.587619847 C3.00908052,0.640314265 2.75926093,0.717948309 2.52171801,0.818098395 C2.40292009,0.868173438 2.28745592,0.924056085 2.17495509,0.985013441 C1.94997987,1.10692286 1.73828674,1.24983755 1.54244215,1.41134187 C0.661062132,2.13811791 0.100674618,3.23899362 0.100674618,4.4757567 L0.100674618,4.71760174 L0.100674618,39.9531653 L0.100674618,40.1945182 C0.100674618,42.3932057 1.87073716,44.1632683 4.06942472,44.1632683 L31.8263867,44.1632683 C34.0250742,44.1632683 35.7951368,42.3932057 35.7951368,40.1945182 L35.7951368,39.9531653 C35.7951368,37.7544777 34.0250742,35.9844152 31.8263867,35.9844152 L8.28000399,35.9844152 L8.28000399,26.0992376 L25.7874571,26.0992376 C27.9861447,26.0992376 29.7562072,24.3291751 29.7562072,22.1304875 L29.7562072,21.8891611 C29.7562072,19.6904735 27.9861447,17.920411 25.7874571,17.920411 L8.28000399,17.920411 L8.28000399,8.68635184 L31.8263867,8.68635184 C34.0250742,8.68635184 35.7951368,6.9162893 35.7951368,4.71760174 L35.7951368,4.4757567 C35.7951368,2.27706914 34.0250742,0.507006595 31.8263867,0.507006595 L4.06942472,0.507006595 Z" id="rect1436-8-4"></path>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="165px" height="88px" viewBox="0 0 165 88" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 44.1 (41455) - http://www.bohemiancoding.com/sketch -->
<title>version-12</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="version-12" transform="translate(-2.000000, -2.000000)">
<g id="erp-icon" fill-rule="nonzero">
<g id="g1422-7-2" transform="translate(0.025630, 0.428785)" fill="#5E64FF">
<g id="g1418-4-6" transform="translate(0.268998, 0.867736)">
<g id="g1416-4-9" transform="translate(0.749997, 0.000000)">
<path d="M14.1845844,0.703479866 L75.0387175,0.703479866 C82.3677094,0.703479866 88.2679029,6.60367875 88.2679029,13.9326374 L88.2679029,74.7868158 C88.2679029,82.1157744 82.3677094,88.0159833 75.0387175,88.0159833 L14.1845844,88.0159833 C6.85569246,88.0159833 0.955398949,82.1157744 0.955398949,74.7868158 L0.955398949,13.9326374 C0.955398949,6.60367875 6.85569246,0.703479866 14.1845844,0.703479866 L14.1845844,0.703479866 Z" id="path1414-3-4"></path>
</g>
</g>
</g>
<g id="g1444-6-7" transform="translate(27.708247, 23.320960)" fill="#FFFFFF">
<path d="M4.06942472,0.507006595 C3.79457554,0.507006595 3.52673783,0.534925429 3.26792241,0.587619847 C3.00908052,0.640314265 2.75926093,0.717948309 2.52171801,0.818098395 C2.40292009,0.868173438 2.28745592,0.924056085 2.17495509,0.985013441 C1.94997987,1.10692286 1.73828674,1.24983755 1.54244215,1.41134187 C0.661062132,2.13811791 0.100674618,3.23899362 0.100674618,4.4757567 L0.100674618,4.71760174 L0.100674618,39.9531653 L0.100674618,40.1945182 C0.100674618,42.3932057 1.87073716,44.1632683 4.06942472,44.1632683 L31.8263867,44.1632683 C34.0250742,44.1632683 35.7951368,42.3932057 35.7951368,40.1945182 L35.7951368,39.9531653 C35.7951368,37.7544777 34.0250742,35.9844152 31.8263867,35.9844152 L8.28000399,35.9844152 L8.28000399,26.0992376 L25.7874571,26.0992376 C27.9861447,26.0992376 29.7562072,24.3291751 29.7562072,22.1304875 L29.7562072,21.8891611 C29.7562072,19.6904735 27.9861447,17.920411 25.7874571,17.920411 L8.28000399,17.920411 L8.28000399,8.68635184 L31.8263867,8.68635184 C34.0250742,8.68635184 35.7951368,6.9162893 35.7951368,4.71760174 L35.7951368,4.4757567 C35.7951368,2.27706914 34.0250742,0.507006595 31.8263867,0.507006595 L4.06942472,0.507006595 Z" id="rect1436-8-4"></path>
</g>
</g>
<text id="12" font-family="SourceSansPro-Regular, Source Sans Pro" font-size="72" font-weight="normal" letter-spacing="-0.386831313" fill="#D1D8DD">
<tspan x="99" y="71">12</tspan>
</text>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,5 @@
<svg width="100" height="100" viewBox="0 0 100 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 12C0 5.37258 5.37258 0 12 0H88C94.6274 0 100 5.37258 100 12V88C100 94.6274 94.6274 100 88 100H12C5.37258 100 0 94.6274 0 88V12Z" fill="#0089FF"/>
<path d="M65.7097 32.9462H67.3871V24H33V32.9462H43.9032H65.7097Z" fill="white"/>
<path d="M43.9032 66.2151V53.914H65.7097V44.9677H43.9032H33V75.1613H67.6667V66.2151H43.9032Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,4 +0,0 @@
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M5.45455 0H30.5454C33.5673 0 36 2.43272 36 5.45454V30.5455C36 33.5673 33.5673 36 30.5454 36H5.45455C2.43276 36 0 33.5673 0 30.5455V5.45454C0 2.43272 2.43276 0 5.45455 0Z" fill="#2996F1"/>
<path d="M12.277 8.99994C12.1637 8.99994 12.0532 9.01145 11.9465 9.03318C11.8398 9.0549 11.7368 9.08691 11.6389 9.12821C11.5899 9.14885 11.5423 9.17189 11.4959 9.19703C11.4031 9.24729 11.3158 9.30622 11.2351 9.37281C10.8717 9.67247 10.6406 10.1264 10.6406 10.6363V10.736V25.2641V25.3636C10.6406 26.2701 11.3704 26.9999 12.277 26.9999H23.7215C24.6281 26.9999 25.3579 26.2701 25.3579 25.3636V25.2641C25.3579 24.3575 24.6281 23.6277 23.7215 23.6277H14.0131V19.5519H21.2316C22.1381 19.5519 22.868 18.8221 22.868 17.9156V17.8161C22.868 16.9095 22.1381 16.1797 21.2316 16.1797H14.0131V12.3724H23.7215C24.6281 12.3724 25.3579 11.6426 25.3579 10.736V10.6363C25.3579 9.72976 24.6281 8.99994 23.7215 8.99994H12.277Z" fill="white"/>
</svg>

Before

Width:  |  Height:  |  Size: 1023 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

View File

@ -23,7 +23,7 @@ def validate_einvoice_fields(doc):
invalid_doctype = doc.doctype != 'Sales Invoice'
invalid_supply_type = doc.get('gst_category') not in ['Registered Regular', 'SEZ', 'Overseas', 'Deemed Export']
company_transaction = doc.get('billing_address_gstin') == doc.get('company_gstin')
no_taxes_applied = len(doc.get('taxes')) == 0
no_taxes_applied = len(doc.get('taxes', [])) == 0
if not einvoicing_enabled or invalid_doctype or invalid_supply_type or company_transaction or no_taxes_applied:
return

View File

@ -32,6 +32,10 @@ def execute(filters=None):
data = []
columns = get_columns()
conditions = ""
if filters.supplier_group:
conditions += "AND s.supplier_group = %s" %frappe.db.escape(filters.get("supplier_group"))
data = frappe.db.sql("""
SELECT
s.supplier_group as "supplier_group",
@ -46,15 +50,17 @@ def execute(filters=None):
AND s.irs_1099 = 1
AND gl.fiscal_year = %(fiscal_year)s
AND gl.party_type = "Supplier"
AND gl.company = %(company)s
{conditions}
GROUP BY
gl.party
ORDER BY
gl.party DESC
""", {
"fiscal_year": filters.fiscal_year,
"supplier_group": filters.supplier_group,
"company": filters.company
}, as_dict=True)
gl.party DESC""".format(conditions=conditions), {
"fiscal_year": filters.fiscal_year,
"company": filters.company
}, as_dict=True)
return columns, data
@ -79,13 +85,13 @@ def get_columns():
"fieldname": "tax_id",
"label": _("Tax ID"),
"fieldtype": "Data",
"width": 120
"width": 200
},
{
"fieldname": "payments",
"label": _("Total Payments"),
"fieldtype": "Currency",
"width": 120
"width": 200
}
]

View File

@ -325,6 +325,9 @@ class TestSalesOrder(unittest.TestCase):
create_dn_against_so(so.name, 4)
make_sales_invoice(so.name)
prev_total = so.get("base_total")
prev_total_in_words = so.get("base_in_words")
first_item_of_so = so.get("items")[0]
trans_item = json.dumps([
{'item_code' : first_item_of_so.item_code, 'rate' : first_item_of_so.rate, \
@ -340,6 +343,12 @@ class TestSalesOrder(unittest.TestCase):
self.assertEqual(so.get("items")[-1].amount, 1400)
self.assertEqual(so.status, 'To Deliver and Bill')
updated_total = so.get("base_total")
updated_total_in_words = so.get("base_in_words")
self.assertEqual(updated_total, prev_total+1400)
self.assertNotEqual(updated_total_in_words, prev_total_in_words)
def test_update_child_removing_item(self):
so = make_sales_order(**{
"item_list": [{

View File

@ -139,7 +139,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2020-03-18 18:10:13.048492",
"modified": "2021-02-08 17:01:52.162202",
"modified_by": "Administrator",
"module": "Setup",
"name": "Customer Group",
@ -189,6 +189,15 @@
"permlevel": 1,
"read": 1,
"role": "Sales Manager"
},
{
"email": 1,
"export": 1,
"print": 1,
"report": 1,
"role": "Customer",
"select": 1,
"share": 1
}
],
"search_fields": "parent_customer_group",

View File

@ -214,7 +214,7 @@
"is_tree": 1,
"links": [],
"max_attachments": 3,
"modified": "2020-12-30 12:57:38.876956",
"modified": "2021-02-08 17:02:44.951572",
"modified_by": "Administrator",
"module": "Setup",
"name": "Item Group",
@ -271,6 +271,15 @@
"read": 1,
"report": 1,
"role": "Accounts User"
},
{
"email": 1,
"export": 1,
"print": 1,
"report": 1,
"role": "Customer",
"select": 1,
"share": 1
}
],
"search_fields": "parent_item_group",

View File

@ -123,7 +123,7 @@
"idx": 1,
"is_tree": 1,
"links": [],
"modified": "2020-03-18 18:11:36.623555",
"modified": "2021-02-08 17:10:03.767426",
"modified_by": "Administrator",
"module": "Setup",
"name": "Territory",
@ -166,6 +166,15 @@
{
"read": 1,
"role": "Maintenance User"
},
{
"email": 1,
"export": 1,
"print": 1,
"report": 1,
"role": "Customer",
"select": 1,
"share": 1
}
],
"search_fields": "parent_territory,territory_manager",

View File

@ -23,8 +23,10 @@ class ProductQuery:
self.cart_settings = frappe.get_doc("Shopping Cart Settings")
self.page_length = self.settings.products_per_page or 20
self.fields = ['name', 'item_name', 'item_code', 'website_image', 'variant_of', 'has_variants', 'item_group', 'image', 'web_long_description', 'description', 'route']
self.filters = [['show_in_website', '=', 1]]
self.or_filters = []
self.filters = []
self.or_filters = [['show_in_website', '=', 1]]
if not self.settings.get('hide_variants'):
self.or_filters.append(['show_variant_in_website', '=', 1])
def query(self, attributes=None, fields=None, search_term=None, start=0):
"""Summary

View File

@ -27,10 +27,11 @@ class StockLedgerEntry(Document):
def validate(self):
self.flags.ignore_submit_comment = True
from erpnext.stock.utils import validate_warehouse_company
from erpnext.stock.utils import validate_warehouse_company, validate_disabled_warehouse
self.validate_mandatory()
self.validate_item()
self.validate_batch()
validate_disabled_warehouse(self.warehouse)
validate_warehouse_company(self.warehouse, self.company)
self.scrub_posting_time()
self.validate_and_set_fiscal_year()

View File

@ -202,8 +202,7 @@ class update_entries_after(object):
where
item_code = %(item_code)s
and warehouse = %(warehouse)s
and voucher_type = %(voucher_type)s
and voucher_no = %(voucher_no)s
and timestamp(posting_date, time_format(posting_time, '%H:%i:%s')) = timestamp(%(posting_date)s, time_format(%(posting_time)s, '%H:%i:%s'))
order by
creation ASC
for update
@ -794,4 +793,4 @@ def get_future_sle_with_negative_qty(args):
and qty_after_transaction + {0} < 0
order by timestamp(posting_date, posting_time) asc
limit 1
""".format(args.actual_qty), args, as_dict=1)
""".format(args.actual_qty), args, as_dict=1)

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import frappe, erpnext
from frappe import _
import json
from frappe.utils import flt, cstr, nowdate, nowtime
from frappe.utils import flt, cstr, nowdate, nowtime, get_link_to_form
from six import string_types
@ -284,6 +284,10 @@ def is_group_warehouse(warehouse):
if frappe.db.get_value("Warehouse", warehouse, "is_group"):
frappe.throw(_("Group node warehouse is not allowed to select for transactions"))
def validate_disabled_warehouse(warehouse):
if frappe.db.get_value("Warehouse", warehouse, "disabled"):
frappe.throw(_("Disabled Warehouse {0} cannot be used for this transaction.").format(get_link_to_form('Warehouse', warehouse)))
def update_included_uom_in_report(columns, result, include_uom, conversion_factors):
if not include_uom or not conversion_factors:
return