chore: Sider and Semgrep

This commit is contained in:
marination
2021-04-21 12:31:15 +05:30
parent ed0aabbb19
commit b2e607bb55
5 changed files with 17 additions and 12 deletions

View File

@@ -5,6 +5,7 @@
from __future__ import unicode_literals
from datetime import datetime
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.contacts.doctype.contact.contact import get_contact_name
from frappe.utils import flt, cint

View File

@@ -2,6 +2,11 @@
// For license information, please see license.txt
frappe.ui.form.on('Website Item', {
onload: function(frm) {
// should never check Private
frm.fields_dict["website_image"].df.is_private = 0;
},
image: function() {
refresh_field("image_view");
},

View File

@@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _dict
from frappe.utils import floor, ceil, flt
from frappe.utils import floor
class ProductFiltersBuilder:
def __init__(self, item_group=None):
@@ -97,8 +97,8 @@ class ProductFiltersBuilder:
min_discount, max_discount = discounts[0], discounts[1]
# [25, 60]
min_range_absolute, max_range_absolute = floor(min_discount), floor(max_discount)
min_range = int(min_discount - (min_range_absolute%10)) # 20
max_range = int(max_discount - (max_range_absolute%10)) # 60
min_range = int(min_discount - (min_range_absolute % 10)) # 20
max_range = int(max_discount - (max_range_absolute % 10)) # 60
for discount in range(min_range, (max_range + 1), 10):
label = f"{discount}% and above"

View File

@@ -17,8 +17,6 @@ frappe.ui.form.on("Item", {
frm.fields_dict["attributes"].grid.set_column_disp("attribute_value", true);
}
// should never check Private
frm.fields_dict["website_image"].df.is_private = 0;
if (frm.doc.is_fixed_asset) {
frm.trigger("set_asset_naming_series");
}
@@ -405,10 +403,12 @@ $.extend(erpnext.item, {
}, __("Actions"));
},
weight_to_validate: function(frm){
if((frm.doc.nett_weight || frm.doc.gross_weight) && !frm.doc.weight_uom) {
frappe.msgprint(__('Weight is mentioned,\nPlease mention "Weight UOM" too'));
frappe.validated = 0;
weight_to_validate: function(frm) {
if (frm.doc.weight_per_unit && !frm.doc.weight_uom) {
frappe.msgprint({
message: __("Please mention 'Weight UOM' along with Weight."),
title: __("Note")
});
}
},
@@ -482,7 +482,7 @@ $.extend(erpnext.item, {
let no_of_combinations = lengths.reduce((a, b) => a * b, 1);
me.multiple_variant_dialog.get_primary_btn()
.html(__(
`Make ${no_of_combinations} Variant${no_of_combinations === 1 ? '' : 's'}`
'Make {0} Variant{1}', [no_of_combinations, no_of_combinations === 1 ? '' : 's']
));
me.multiple_variant_dialog.enable_primary_action();
}

View File

@@ -337,8 +337,7 @@
class="product-filter field-filter"
id="{{value}}"
data-filter-name="{{ item_field.fieldname }}"
data-filter-value="{{ value }}"
>
data-filter-value="{{ value }}">
<span class="label-area">{{ value }}</span>
</label>
</div>