Merge branch 'hotfix' into validate_stock_transaction_v11

This commit is contained in:
Nabin Hait 2019-04-05 15:41:26 +05:30 committed by GitHub
commit 843e440191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 170 additions and 17 deletions

View File

@ -589,3 +589,4 @@ erpnext.patches.v11_0.remove_barcodes_field_from_copy_fields_to_variants
erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019
erpnext.patches.v11_0.make_italian_localization_fields # 26-03-2019
erpnext.patches.v11_1.make_job_card_time_logs
erpnext.patches.v11_1.set_variant_based_on

View File

@ -0,0 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.db.sql("""update tabItem set variant_based_on = 'Item Attribute'
where ifnull(variant_based_on, '') = ''
and (has_variants=1 or ifnull(variant_of, '') != '')
""")

View File

@ -446,16 +446,15 @@ erpnext.pos.PointOfSale = class PointOfSale {
}
setup_company() {
this.company = frappe.sys_defaults.company;
return new Promise(resolve => {
if(!this.company) {
if(!frappe.sys_defaults.company) {
frappe.prompt({fieldname:"company", options: "Company", fieldtype:"Link",
label: __("Select Company"), reqd: 1}, (data) => {
this.company = data.company;
resolve(this.company);
}, __("Select Company"));
} else {
resolve(this.company);
resolve();
}
})
}
@ -509,7 +508,9 @@ erpnext.pos.PointOfSale = class PointOfSale {
}
set_pos_profile_data() {
this.frm.doc.company = this.company;
if (this.company) {
this.frm.doc.company = this.company;
}
return new Promise(resolve => {
return this.frm.call({

View File

@ -12,7 +12,6 @@ from frappe.website.render import clear_cache
from frappe.website.doctype.website_slideshow.website_slideshow import get_slideshow
from erpnext.shopping_cart.product_info import set_product_info_for_website
from erpnext.utilities.product import get_qty_in_stock
from frappe.utils.html_utils import clean_html
class ItemGroup(NestedSet, WebsiteGenerator):
nsm_parent_field = 'parent_item_group'
@ -27,7 +26,6 @@ class ItemGroup(NestedSet, WebsiteGenerator):
def validate(self):
super(ItemGroup, self).validate()
self.description = clean_html(self.description)
self.make_route()
def on_update(self):

View File

@ -23,6 +23,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "name_and_description_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -57,6 +58,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "naming_series",
"fieldtype": "Select",
"hidden": 0,
@ -91,6 +93,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
"fetch_if_empty": 0,
"fieldname": "item_code",
"fieldtype": "Data",
"hidden": 0,
@ -127,6 +130,7 @@
"columns": 0,
"depends_on": "variant_of",
"description": "If item is a variant of another item then description, image, pricing, taxes etc will be set from the template unless explicitly specified",
"fetch_if_empty": 0,
"fieldname": "variant_of",
"fieldtype": "Link",
"hidden": 0,
@ -160,6 +164,7 @@
"bold": 1,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -195,6 +200,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
"fetch_if_empty": 0,
"fieldname": "item_group",
"fieldtype": "Link",
"hidden": 0,
@ -230,6 +236,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "is_item_from_hub",
"fieldtype": "Check",
"hidden": 0,
@ -263,6 +270,7 @@
"collapsible": 0,
"columns": 0,
"description": "",
"fetch_if_empty": 0,
"fieldname": "stock_uom",
"fieldtype": "Link",
"hidden": 0,
@ -298,6 +306,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
@ -329,6 +338,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "disabled",
"fieldtype": "Check",
"hidden": 0,
@ -361,6 +371,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "allow_alternative_item",
"fieldtype": "Check",
"hidden": 0,
@ -395,6 +406,7 @@
"columns": 0,
"default": "1",
"description": "",
"fetch_if_empty": 0,
"fieldname": "is_stock_item",
"fieldtype": "Check",
"hidden": 0,
@ -431,6 +443,7 @@
"collapsible": 0,
"columns": 0,
"default": "1",
"fetch_if_empty": 0,
"fieldname": "include_item_in_manufacturing",
"fieldtype": "Check",
"hidden": 0,
@ -464,6 +477,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(doc.__islocal&&doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)",
"fetch_if_empty": 0,
"fieldname": "opening_stock",
"fieldtype": "Float",
"hidden": 0,
@ -497,6 +511,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "is_stock_item",
"fetch_if_empty": 0,
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -530,6 +545,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.__islocal",
"fetch_if_empty": 0,
"fieldname": "standard_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -562,6 +578,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "is_fixed_asset",
"fieldtype": "Check",
"hidden": 0,
@ -595,6 +612,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "is_fixed_asset",
"fetch_if_empty": 0,
"fieldname": "asset_category",
"fieldtype": "Link",
"hidden": 0,
@ -629,6 +647,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "is_fixed_asset",
"fetch_if_empty": 0,
"fieldname": "asset_naming_series",
"fieldtype": "Select",
"hidden": 0,
@ -663,6 +682,7 @@
"columns": 0,
"depends_on": "eval:!doc.__islocal",
"description": "",
"fetch_if_empty": 0,
"fieldname": "tolerance",
"fieldtype": "Float",
"hidden": 0,
@ -697,6 +717,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "image",
"fieldtype": "Attach Image",
"hidden": 1,
@ -730,6 +751,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "section_break_11",
"fieldtype": "Section Break",
"hidden": 0,
@ -762,6 +784,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "brand",
"fieldtype": "Link",
"hidden": 0,
@ -797,6 +820,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -831,6 +855,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "sb_barcodes",
"fieldtype": "Section Break",
"hidden": 0,
@ -863,6 +888,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "barcodes",
"fieldtype": "Table",
"hidden": 0,
@ -898,6 +924,7 @@
"collapsible_depends_on": "is_stock_item",
"columns": 0,
"depends_on": "is_stock_item",
"fetch_if_empty": 0,
"fieldname": "inventory_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -932,6 +959,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "shelf_life_in_days",
"fieldtype": "Int",
"hidden": 0,
@ -966,6 +994,7 @@
"columns": 0,
"default": "2099-12-31",
"depends_on": "is_stock_item",
"fetch_if_empty": 0,
"fieldname": "end_of_life",
"fieldtype": "Date",
"hidden": 0,
@ -1001,6 +1030,7 @@
"collapsible": 0,
"columns": 0,
"default": "Purchase",
"fetch_if_empty": 0,
"fieldname": "default_material_request_type",
"fieldtype": "Select",
"hidden": 0,
@ -1035,6 +1065,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "is_stock_item",
"fetch_if_empty": 0,
"fieldname": "valuation_method",
"fieldtype": "Select",
"hidden": 0,
@ -1069,6 +1100,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "is_stock_item",
"fetch_if_empty": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"hidden": 0,
@ -1103,6 +1135,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_stock_item",
"fetch_if_empty": 0,
"fieldname": "warranty_period",
"fieldtype": "Data",
"hidden": 0,
@ -1139,6 +1172,7 @@
"columns": 0,
"depends_on": "is_stock_item",
"description": "",
"fetch_if_empty": 0,
"fieldname": "weight_per_unit",
"fieldtype": "Float",
"hidden": 0,
@ -1172,6 +1206,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_stock_item",
"fetch_if_empty": 0,
"fieldname": "weight_uom",
"fieldtype": "Link",
"hidden": 0,
@ -1207,6 +1242,7 @@
"columns": 0,
"depends_on": "is_stock_item",
"description": "",
"fetch_if_empty": 0,
"fieldname": "reorder_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -1242,6 +1278,7 @@
"columns": 0,
"depends_on": "",
"description": "Will also apply for variants unless overrridden",
"fetch_if_empty": 0,
"fieldname": "reorder_levels",
"fieldtype": "Table",
"hidden": 0,
@ -1276,6 +1313,7 @@
"collapsible": 1,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "unit_of_measure_conversion",
"fieldtype": "Section Break",
"hidden": 0,
@ -1310,6 +1348,7 @@
"columns": 0,
"depends_on": "",
"description": "Will also apply for variants",
"fetch_if_empty": 0,
"fieldname": "uoms",
"fieldtype": "Table",
"hidden": 0,
@ -1347,6 +1386,7 @@
"collapsible_depends_on": "eval:doc.has_batch_no || doc.has_serial_no || doc.is_fixed_asset",
"columns": 0,
"depends_on": "eval:doc.is_stock_item || doc.is_fixed_asset",
"fetch_if_empty": 0,
"fieldname": "serial_nos_and_batches",
"fieldtype": "Section Break",
"hidden": 0,
@ -1381,6 +1421,7 @@
"columns": 0,
"default": "",
"depends_on": "eval:doc.is_stock_item",
"fetch_if_empty": 0,
"fieldname": "has_batch_no",
"fieldtype": "Check",
"hidden": 0,
@ -1418,6 +1459,7 @@
"columns": 0,
"depends_on": "has_batch_no",
"description": "",
"fetch_if_empty": 0,
"fieldname": "create_new_batch",
"fieldtype": "Check",
"hidden": 0,
@ -1452,6 +1494,7 @@
"columns": 0,
"depends_on": "eval:doc.has_batch_no==1 && doc.create_new_batch==1",
"description": "Example: ABCD.#####. If series is set and Batch No is not mentioned in transactions,then automatic batch number will be created based on this series. If you always want to explicitly mention Batch No for this item,leave this blank. Note: this setting will take priority over the Naming Series Prefix in Stock Settings.",
"fetch_if_empty": 0,
"fieldname": "batch_number_series",
"fieldtype": "Data",
"hidden": 0,
@ -1485,6 +1528,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "has_batch_no",
"fetch_if_empty": 0,
"fieldname": "has_expiry_date",
"fieldtype": "Check",
"hidden": 0,
@ -1518,6 +1562,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "has_batch_no",
"fetch_if_empty": 0,
"fieldname": "retain_sample",
"fieldtype": "Check",
"hidden": 0,
@ -1552,6 +1597,7 @@
"columns": 0,
"depends_on": "eval: (doc.retain_sample && doc.has_batch_no)",
"description": "Maximum sample quantity that can be retained",
"fetch_if_empty": 0,
"fieldname": "sample_quantity",
"fieldtype": "Int",
"hidden": 0,
@ -1584,6 +1630,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break_37",
"fieldtype": "Column Break",
"hidden": 0,
@ -1618,6 +1665,7 @@
"default": "",
"depends_on": "eval:doc.is_stock_item || doc.is_fixed_asset",
"description": "",
"fetch_if_empty": 0,
"fieldname": "has_serial_no",
"fieldtype": "Check",
"hidden": 0,
@ -1655,6 +1703,7 @@
"columns": 0,
"depends_on": "eval:doc.is_stock_item || doc.is_fixed_asset",
"description": "Example: ABCD.#####\nIf series is set and Serial No is not mentioned in transactions,then automatic serial number will be created based on this series. If you always want to explicitly mention Serial Nos for this item. leave this blank.",
"fetch_if_empty": 0,
"fieldname": "serial_no_series",
"fieldtype": "Data",
"hidden": 0,
@ -1689,6 +1738,7 @@
"collapsible_depends_on": "attributes",
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "variants_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -1724,6 +1774,7 @@
"default": "0",
"depends_on": "eval:!doc.variant_of",
"description": "If this item has variants,then it cannot be selected in sales orders etc.",
"fetch_if_empty": 0,
"fieldname": "has_variants",
"fieldtype": "Check",
"hidden": 0,
@ -1759,6 +1810,7 @@
"columns": 0,
"default": "Item Attribute",
"depends_on": "has_variants",
"fetch_if_empty": 0,
"fieldname": "variant_based_on",
"fieldtype": "Select",
"hidden": 0,
@ -1781,7 +1833,7 @@
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 1,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
@ -1793,6 +1845,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(doc.has_variants || doc.variant_of) && doc.variant_based_on==='Item Attribute'",
"fetch_if_empty": 0,
"fieldname": "attributes",
"fieldtype": "Table",
"hidden": 1,
@ -1826,6 +1879,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "defaults",
"fieldtype": "Section Break",
"hidden": 0,
@ -1858,6 +1912,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "item_defaults",
"fieldtype": "Table",
"hidden": 0,
@ -1891,6 +1946,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "purchase_details",
"fieldtype": "Section Break",
"hidden": 0,
@ -1926,6 +1982,7 @@
"collapsible": 0,
"columns": 0,
"default": "1",
"fetch_if_empty": 0,
"fieldname": "is_purchase_item",
"fieldtype": "Check",
"hidden": 0,
@ -1958,6 +2015,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "purchase_uom",
"fieldtype": "Link",
"hidden": 0,
@ -1994,6 +2052,7 @@
"default": "0.00",
"depends_on": "is_stock_item",
"description": "",
"fetch_if_empty": 0,
"fieldname": "min_order_qty",
"fieldtype": "Float",
"hidden": 0,
@ -2028,6 +2087,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "safety_stock",
"fieldtype": "Float",
"hidden": 0,
@ -2060,6 +2120,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "purchase_details_cb",
"fieldtype": "Column Break",
"hidden": 0,
@ -2094,6 +2155,7 @@
"columns": 0,
"depends_on": "",
"description": "Average time taken by the supplier to deliver",
"fetch_if_empty": 0,
"fieldname": "lead_time_days",
"fieldtype": "Int",
"hidden": 0,
@ -2129,6 +2191,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "last_purchase_rate",
"fieldtype": "Float",
"hidden": 0,
@ -2164,6 +2227,7 @@
"collapsible": 1,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "supplier_details",
"fieldtype": "Section Break",
"hidden": 0,
@ -2196,6 +2260,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "delivered_by_supplier",
"fieldtype": "Check",
"hidden": 0,
@ -2229,6 +2294,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "manufacturer",
"fieldtype": "Link",
"hidden": 0,
@ -2263,6 +2329,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
"hidden": 0,
@ -2296,6 +2363,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "column_break2",
"fieldtype": "Column Break",
"hidden": 0,
@ -2331,6 +2399,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "supplier_items",
"fieldtype": "Table",
"hidden": 0,
@ -2364,6 +2433,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "foreign_trade_details",
"fieldtype": "Section Break",
"hidden": 0,
@ -2396,6 +2466,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "country_of_origin",
"fieldtype": "Link",
"hidden": 0,
@ -2429,6 +2500,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break_59",
"fieldtype": "Column Break",
"hidden": 0,
@ -2460,6 +2532,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "customs_tariff_number",
"fieldtype": "Link",
"hidden": 0,
@ -2493,6 +2566,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "sales_details",
"fieldtype": "Section Break",
"hidden": 0,
@ -2527,6 +2601,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "sales_uom",
"fieldtype": "Link",
"hidden": 0,
@ -2561,6 +2636,7 @@
"collapsible": 0,
"columns": 0,
"default": "1",
"fetch_if_empty": 0,
"fieldname": "is_sales_item",
"fieldtype": "Check",
"hidden": 0,
@ -2594,6 +2670,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "column_break3",
"fieldtype": "Column Break",
"hidden": 0,
@ -2629,6 +2706,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "max_discount",
"fieldtype": "Float",
"hidden": 0,
@ -2663,6 +2741,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "deferred_revenue",
"fieldtype": "Section Break",
"hidden": 0,
@ -2696,6 +2775,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_revenue",
"fetch_if_empty": 0,
"fieldname": "deferred_revenue_account",
"fieldtype": "Link",
"hidden": 0,
@ -2729,6 +2809,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "enable_deferred_revenue",
"fieldtype": "Check",
"hidden": 0,
@ -2761,6 +2842,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break_85",
"fieldtype": "Column Break",
"hidden": 0,
@ -2793,6 +2875,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_revenue",
"fetch_if_empty": 0,
"fieldname": "no_of_months",
"fieldtype": "Int",
"hidden": 0,
@ -2825,6 +2908,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "deferred_expense_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -2858,6 +2942,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_expense",
"fetch_if_empty": 0,
"fieldname": "deferred_expense_account",
"fieldtype": "Link",
"hidden": 0,
@ -2891,6 +2976,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "enable_deferred_expense",
"fieldtype": "Check",
"hidden": 0,
@ -2923,6 +3009,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break_88",
"fieldtype": "Column Break",
"hidden": 0,
@ -2955,6 +3042,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "enable_deferred_expense",
"fetch_if_empty": 0,
"fieldname": "no_of_months_exp",
"fieldtype": "Int",
"hidden": 0,
@ -2987,6 +3075,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "customer_details",
"fieldtype": "Section Break",
"hidden": 0,
@ -3021,6 +3110,7 @@
"columns": 0,
"depends_on": "",
"description": "",
"fetch_if_empty": 0,
"fieldname": "customer_items",
"fieldtype": "Table",
"hidden": 0,
@ -3054,6 +3144,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "item_tax_section_break",
"fieldtype": "Section Break",
"hidden": 0,
@ -3089,6 +3180,7 @@
"collapsible": 0,
"columns": 0,
"description": "Will also apply for variants",
"fetch_if_empty": 0,
"fieldname": "taxes",
"fieldtype": "Table",
"hidden": 0,
@ -3124,6 +3216,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "inspection_criteria",
"fieldtype": "Section Break",
"hidden": 0,
@ -3159,6 +3252,7 @@
"collapsible": 0,
"columns": 0,
"default": "",
"fetch_if_empty": 0,
"fieldname": "inspection_required_before_purchase",
"fieldtype": "Check",
"hidden": 0,
@ -3194,6 +3288,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "inspection_required_before_delivery",
"fieldtype": "Check",
"hidden": 0,
@ -3227,6 +3322,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(doc.inspection_required_before_purchase || doc.inspection_required_before_delivery)",
"fetch_if_empty": 0,
"fieldname": "quality_inspection_template",
"fieldtype": "Link",
"hidden": 0,
@ -3261,6 +3357,7 @@
"collapsible": 1,
"columns": 0,
"depends_on": "is_stock_item",
"fetch_if_empty": 0,
"fieldname": "manufacturing",
"fieldtype": "Section Break",
"hidden": 0,
@ -3296,6 +3393,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "",
"fetch_if_empty": 0,
"fieldname": "default_bom",
"fieldtype": "Link",
"hidden": 0,
@ -3333,6 +3431,7 @@
"columns": 0,
"default": "",
"description": "If subcontracted to a vendor",
"fetch_if_empty": 0,
"fieldname": "is_sub_contracted_item",
"fieldtype": "Check",
"hidden": 0,
@ -3368,6 +3467,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "column_break_74",
"fieldtype": "Column Break",
"hidden": 0,
@ -3399,6 +3499,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "customer_code",
"fieldtype": "Data",
"hidden": 1,
@ -3431,6 +3532,7 @@
"bold": 0,
"collapsible": 1,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "website_section",
"fieldtype": "Section Break",
"hidden": 0,
@ -3465,6 +3567,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.variant_of",
"fetch_if_empty": 0,
"fieldname": "show_in_website",
"fieldtype": "Check",
"hidden": 0,
@ -3498,6 +3601,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "variant_of",
"fetch_if_empty": 0,
"fieldname": "show_variant_in_website",
"fieldtype": "Check",
"hidden": 0,
@ -3531,6 +3635,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fetch_if_empty": 0,
"fieldname": "route",
"fieldtype": "Small Text",
"hidden": 0,
@ -3565,6 +3670,7 @@
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "Items with higher weightage will be shown higher",
"fetch_if_empty": 0,
"fieldname": "weightage",
"fieldtype": "Int",
"hidden": 0,
@ -3599,6 +3705,7 @@
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "Show a slideshow at the top of the page",
"fetch_if_empty": 0,
"fieldname": "slideshow",
"fieldtype": "Link",
"hidden": 0,
@ -3634,6 +3741,7 @@
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "Item Image (if not slideshow)",
"fetch_if_empty": 0,
"fieldname": "website_image",
"fieldtype": "Attach",
"hidden": 0,
@ -3667,6 +3775,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "thumbnail",
"fieldtype": "Data",
"hidden": 0,
@ -3699,6 +3808,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "cb72",
"fieldtype": "Column Break",
"hidden": 0,
@ -3732,6 +3842,7 @@
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "Show \"In Stock\" or \"Not in Stock\" based on stock available in this warehouse.",
"fetch_if_empty": 0,
"fieldname": "website_warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -3767,6 +3878,7 @@
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"description": "List this Item in multiple groups on the website.",
"fetch_if_empty": 0,
"fieldname": "website_item_groups",
"fieldtype": "Table",
"hidden": 0,
@ -3802,6 +3914,7 @@
"collapsible_depends_on": "website_specifications",
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fetch_if_empty": 0,
"fieldname": "sb72",
"fieldtype": "Section Break",
"hidden": 0,
@ -3835,6 +3948,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fetch_if_empty": 0,
"fieldname": "copy_from_item_group",
"fieldtype": "Button",
"hidden": 0,
@ -3868,6 +3982,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fetch_if_empty": 0,
"fieldname": "website_specifications",
"fieldtype": "Table",
"hidden": 0,
@ -3902,6 +4017,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval: doc.show_in_website || doc.show_variant_in_website",
"fetch_if_empty": 0,
"fieldname": "web_long_description",
"fieldtype": "Text Editor",
"hidden": 0,
@ -3934,6 +4050,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "total_projected_qty",
"fieldtype": "Float",
"hidden": 1,
@ -3967,6 +4084,7 @@
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(!doc.is_item_from_hub)",
"fetch_if_empty": 0,
"fieldname": "hub_publishing_sb",
"fieldtype": "Section Break",
"hidden": 0,
@ -4001,6 +4119,7 @@
"columns": 0,
"default": "0",
"description": "Publish Item to hub.erpnext.com",
"fetch_if_empty": 0,
"fieldname": "publish_in_hub",
"fieldtype": "Check",
"hidden": 0,
@ -4033,6 +4152,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"fetch_if_empty": 0,
"fieldname": "hub_category_to_publish",
"fieldtype": "Data",
"hidden": 0,
@ -4067,6 +4187,7 @@
"collapsible": 0,
"columns": 0,
"description": "Publish \"In Stock\" or \"Not in Stock\" on Hub based on stock available in this warehouse.",
"fetch_if_empty": 0,
"fieldname": "hub_warehouse",
"fieldtype": "Link",
"hidden": 0,
@ -4101,6 +4222,7 @@
"collapsible": 0,
"columns": 0,
"default": "0",
"fetch_if_empty": 0,
"fieldname": "synced_with_hub",
"fieldtype": "Check",
"hidden": 0,
@ -4139,7 +4261,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
"modified": "2019-02-16 17:43:56.039611",
"modified": "2019-04-05 12:03:24.530849",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

View File

@ -117,6 +117,7 @@ class Item(WebsiteGenerator):
self.validate_stock_exists_for_template_item()
self.validate_attributes()
self.validate_variant_attributes()
self.validate_variant_based_on_change()
self.validate_website_image()
self.make_thumbnail()
self.validate_fixed_asset()
@ -723,6 +724,11 @@ class Item(WebsiteGenerator):
frappe.throw(
_('Cannot change Attributes after stock transaction. Make a new Item and transfer stock to the new Item'))
def validate_variant_based_on_change(self):
if self.variant_of or (self.has_variants and frappe.get_all("Item", {"variant_of": self.name})):
if self.variant_based_on != frappe.db.get_value("Item", self.name, "variant_based_on"):
frappe.throw(_("Variant Based On cannot be changed"))
def validate_uom(self):
if not self.get("__islocal"):
check_stock_uom_with_bin(self.name, self.stock_uom)
@ -743,10 +749,13 @@ class Item(WebsiteGenerator):
d.conversion_factor = value
def validate_attributes(self):
if not (self.has_variants or self.variant_of):
return
if not self.variant_based_on:
self.variant_based_on = 'Item Attribute'
if (self.has_variants or self.variant_of) and self.variant_based_on == 'Item Attribute':
if self.variant_based_on == 'Item Attribute':
attributes = []
if not self.attributes:
frappe.throw(_("Attribute table is mandatory"))

View File

@ -606,28 +606,39 @@ def get_pos_profile_item_details(company, args, pos_profile=None, update_data=Fa
@frappe.whitelist()
def get_pos_profile(company, pos_profile=None, user=None):
if pos_profile:
return frappe.get_cached_doc('POS Profile', pos_profile)
if pos_profile: return frappe.get_cached_doc('POS Profile', pos_profile)
if not user:
user = frappe.session['user']
condition = "pfu.user = %(user)s AND pfu.default=1"
if user and company:
condition = "pfu.user = %(user)s AND pf.company = %(company)s AND pfu.default=1"
pos_profile = frappe.db.sql("""SELECT pf.*
FROM
`tabPOS Profile` pf LEFT JOIN `tabPOS Profile User` pfu
ON
pf.name = pfu.parent
WHERE
(
(pfu.user = %(user)s AND pf.company = %(company)s AND pfu.default=1)
OR (pfu.user = %(user)s AND pfu.default=1)
OR (ifnull(pfu.user, '') = '' AND pf.company = %(company)s)
) AND pf.disabled = 0
""", {
{cond} AND pf.disabled = 0
""".format(cond = condition), {
'user': user,
'company': company
}, as_dict=1)
if not pos_profile and company:
pos_profile = frappe.db.sql("""SELECT pf.*
FROM
`tabPOS Profile` pf LEFT JOIN `tabPOS Profile User` pfu
ON
pf.name = pfu.parent
WHERE
pf.company = %(company)s AND pf.disabled = 0
""", {
'company': company
}, as_dict=1)
return pos_profile and pos_profile[0] or None
def get_serial_nos_by_fifo(args, sales_order=None):