Merge branch 'v12-pre-release' into b12-7-pre-release-1

This commit is contained in:
Nabin Hait
2020-04-16 19:07:45 +05:30
committed by GitHub
16 changed files with 239 additions and 61 deletions

View File

@@ -753,8 +753,7 @@
{
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
"label": "Manufacturer Part Number",
"read_only": 1
"label": "Manufacturer Part Number"
},
{
"depends_on": "is_fixed_asset",
@@ -770,7 +769,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2020-04-01 14:20:17.297284",
"modified": "2020-04-07 18:34:35.104178",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",

View File

@@ -432,11 +432,12 @@ class SalesInvoice(SellingController):
if pos.get("company_address"):
self.company_address = pos.get("company_address")
customer_price_list, customer_group = frappe.get_value("Customer", self.customer, ['default_price_list', 'customer_group'])
customer_group_price_list = frappe.get_value("Customer Group", customer_group, 'default_price_list')
selling_price_list = customer_price_list or customer_group_price_list or pos.get('selling_price_list')
if self.customer:
customer_price_list, customer_group = frappe.get_value("Customer", self.customer, ['default_price_list', 'customer_group'])
customer_group_price_list = frappe.get_value("Customer Group", customer_group, 'default_price_list')
selling_price_list = customer_price_list or customer_group_price_list or pos.get('selling_price_list')
else:
selling_price_list = pos.get('selling_price_list')
if selling_price_list:
self.set('selling_price_list', selling_price_list)

View File

@@ -698,8 +698,7 @@
{
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
"label": "Manufacturer Part Number",
"read_only": 1
"label": "Manufacturer Part Number"
},
{
"default": "0",
@@ -712,7 +711,7 @@
],
"idx": 1,
"istable": 1,
"modified": "2019-11-07 17:19:12.090355",
"modified": "2020-04-07 18:35:17.558928",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",

View File

@@ -1,4 +1,5 @@
{
"actions": [],
"autoname": "hash",
"creation": "2013-05-22 12:43:10",
"doctype": "DocType",
@@ -522,8 +523,7 @@
{
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
"label": "Manufacturer Part Number",
"read_only": 1
"label": "Manufacturer Part Number"
},
{
"fieldname": "column_break_15",
@@ -532,7 +532,8 @@
],
"idx": 1,
"istable": 1,
"modified": "2019-06-02 05:32:46.019237",
"links": [],
"modified": "2020-04-07 18:35:51.175947",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier Quotation Item",

View File

@@ -0,0 +1,63 @@
## ERPNext v12.7.0 Release Note
### Enhancements
- Allow Purchase/Sales Invoice without Purchase/Sales Order against a specific Supplier/Customer [#20865](https://github.com/frappe/erpnext/pull/20865)
- The address is now mandatory to place an order from Shopping Cart [#20922](https://github.com/frappe/erpnext/pull/20922)
- Target Warehouse for finished goods in Manufacture type Stock Entry now can be different from Work Order [#21002](https://github.com/frappe/erpnext/pull/21002)
- Qty in Stock Entry must always be positive [#21004](https://github.com/frappe/erpnext/pull/21004)
- Enhanced UX for Manufacturing module [#19802](https://github.com/frappe/erpnext/pull/19802)
- Default calendar for Job Card
- Changed Timer Position, Added Pause, Resume Button
- Progress Bar for Work Order Operations
- Create Multiple Job Cards from Work Order
- Removed Projected Quantity Formula Section from Production Plan and Added Doc Link Next to Field
- Grouped relevant fields
- Allowed customized Order Type in Sales Order [#18096](https://github.com/frappe/erpnext/pull/18096)
- Added Serial No Status field for the filter in List and Report view [#21201](https://github.com/frappe/erpnext/pull/21201)
- Enabled new regions (UAE, BR, MX) to amazon MWS connector [#21195](https://github.com/frappe/erpnext/pull/21195)
- Added Scan Barcode field in Purchase Receipt [#21181](https://github.com/frappe/erpnext/pull/21181)
- Added Cost Center, Warehouse and Item Group filters in Purchase Register report [#21177](https://github.com/frappe/erpnext/pull/21177)
- Show filtered items in Material Request based on Request Type [#21173](https://github.com/frappe/erpnext/pull/21173)
- Set Qty To Manufacture field as non-mandatory in job card [#21080](https://github.com/frappe/erpnext/pull/21080)
- Fetch batch no automatically from serial no, if the item has both serial and batch no [#20757](https://github.com/frappe/erpnext/pull/20757)
### Fixes:
- The payment status of Expense Claim considering Employee Advance amount
- Fixes in BOM Comparison Tool [#20992](https://github.com/frappe/erpnext/pull/20992)
- UOM fixes in Sales Order, Material Request and Production Plan [#21015](https://github.com/frappe/erpnext/pull/21015)
- Passive Italian e-Invoicing [#19334](https://github.com/frappe/erpnext/issues/19334)
- Batch selection popup not coming for stock entry [#21036](https://github.com/frappe/erpnext/pull/21036)
- Place of supply validation in GSTR-1 report (for India) [#21057](https://github.com/frappe/erpnext/pull/21057)
- On changing qty, the free item was not removing [#21250](https://github.com/frappe/erpnext/pull/21250)
- If Lead name has leading white space, Contact's first name was set to blank [#21247](https://github.com/frappe/erpnext/pull/21247)
- Make Message field mandatory in Project, if Collect Progress is checked [#21208](https://github.com/frappe/erpnext/pull/21208)
- Show base received amount only when base paid amount defers from base received amount [#21193](https://github.com/frappe/erpnext/pull/21193)
- Consider reverted entries to cancel out expired leave entries which were reverted [#21256](https://github.com/frappe/erpnext/pull/21256)
- The tax amount after discount amount should be considered for tax calculation in GSTR-3B report [#21241](https://github.com/frappe/erpnext/pull/21241)
- Replace newlines with spaces before evaluation of condition and formula [#21166](https://github.com/frappe/erpnext/pull/21166)
- Get serial nos qty in Stock Reconciliation based on posting date and time [#21169](https://github.com/frappe/erpnext/pull/21169)
- Validate Serial/Batch No naming series in Item itself [#21167](https://github.com/frappe/erpnext/pull/21167)
- When shipping tax is set it does not clear cart and gives error [#21035](https://github.com/frappe/erpnext/pull/21035)
- While creating Sales Invoice from the shopping cart, enable auto allocation of advances [#20878](https://github.com/frappe/erpnext/pull/20878)
- Payment Request status fixes [#21100](https://github.com/frappe/erpnext/pull/21100)
- Add permissions on GSTR-3B report only for India [#21163](https://github.com/frappe/erpnext/pull/21163)
- Since a Customer Provided Item does not have a valuation rate, expenses should not be booked in Stock Entry [#21156](https://github.com/frappe/erpnext/pull/21156)
- Update Received Qty in Material Request as per Stock UOM [#21055](https://github.com/frappe/erpnext/pull/21054)
- Cannot set warehouse while deleting all items from submitted sales order and then adding new items [#21078](https://github.com/frappe/erpnext/pull/21078)
- Serial no scan was not adding the serial nos in stock entry [#21082](https://github.com/frappe/erpnext/pull/21082)
- Healthcare Domain Issues [#21112](https://github.com/frappe/erpnext/pull/21112)
- Appointment Reminders not working
- Disabled Patient, Practitioner Schedule, Clinical Procedure Template showed as enabled in ListView.
- Batch not getting fetched in Clinical Procedure Item.
- Lab Test Template Item creation error
- Lab Test Template error while creating a Patient Medical Record
- Party details not set in Payment Request in case of payment failed from shopping cart [#21085](https://github.com/frappe/erpnext/pull/21085)
- Allowed Expense accounts with only base currency in Landed Cost voucher [#21074](https://github.com/frappe/erpnext/pull/21074)
- Price list mentioned in Customer Group should get priority over POS Profile [#21117](https://github.com/frappe/erpnext/pull/21117)
- Show proper currency symbol in Total row in Accounts Receivable/Payable report [#21090](https://github.com/frappe/erpnext/pull/21090)
- Add item defaults based on global settings only if default company and warehouse is mentioned [#21088](https://github.com/frappe/erpnext/pull/21088)
- If "Display Items In Stock" enabled, show only available items in POS [#21071](https://github.com/frappe/erpnext/pull/21071)
- Update Requested Qty in Bin based on Material Request Type [#21065](https://github.com/frappe/erpnext/pull/21065)
- Ignored user permission for parent_company and existing_company field in Company [#21010](https://github.com/frappe/erpnext/pull/21010)
- Wrong calculation of depreciation eliminated in Asset Depreciation and Balances report [#21032](https://github.com/frappe/erpnext/pull/21032)

View File

@@ -1123,36 +1123,39 @@ def get_supplier_block_status(party_name):
}
return info
def set_sales_order_defaults(parent_doctype, parent_doctype_name, child_docname, item_code):
def set_sales_order_defaults(parent_doctype, parent_doctype_name, child_docname, trans_item):
"""
Returns a Sales Order Item child item containing the default values
"""
p_doc = frappe.get_doc(parent_doctype, parent_doctype_name)
child_item = frappe.new_doc('Sales Order Item', p_doc, child_docname)
item = frappe.get_doc("Item", item_code)
item = frappe.get_doc("Item", trans_item.get('item_code'))
child_item.item_code = item.item_code
child_item.item_name = item.item_name
child_item.description = item.description
child_item.reqd_by_date = p_doc.delivery_date
child_item.delivery_date = trans_item.get('delivery_date') or p_doc.delivery_date
child_item.uom = item.stock_uom
child_item.conversion_factor = get_conversion_factor(item_code, item.stock_uom).get("conversion_factor") or 1.0
child_item.conversion_factor = get_conversion_factor(item.item_code, item.stock_uom).get("conversion_factor") or 1.0
child_item.warehouse = get_item_warehouse(item, p_doc, overwrite_warehouse=True)
if not child_item.warehouse:
frappe.throw(_("Cannot find {} for item {}. Please set the same in Item Master or Stock Settings.")
.format(frappe.bold("default warehouse"), frappe.bold(item.item_code)))
return child_item
def set_purchase_order_defaults(parent_doctype, parent_doctype_name, child_docname, item_code):
def set_purchase_order_defaults(parent_doctype, parent_doctype_name, child_docname, trans_item):
"""
Returns a Purchase Order Item child item containing the default values
"""
p_doc = frappe.get_doc(parent_doctype, parent_doctype_name)
child_item = frappe.new_doc('Purchase Order Item', p_doc, child_docname)
item = frappe.get_doc("Item", item_code)
item = frappe.get_doc("Item", trans_item.get('item_code'))
child_item.item_code = item.item_code
child_item.item_name = item.item_name
child_item.description = item.description
child_item.schedule_date = p_doc.schedule_date
child_item.schedule_date = trans_item.get('schedule_date') or p_doc.schedule_date
child_item.uom = item.stock_uom
child_item.conversion_factor = get_conversion_factor(item_code, item.stock_uom).get("conversion_factor") or 1.0
child_item.conversion_factor = get_conversion_factor(item.item_code, item.stock_uom).get("conversion_factor") or 1.0
child_item.base_rate = 1 # Initiallize value will update in parent validation
child_item.base_amount = 1 # Initiallize value will update in parent validation
return child_item
@@ -1196,9 +1199,9 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
if not d.get("docname"):
new_child_flag = True
if parent_doctype == "Sales Order":
child_item = set_sales_order_defaults(parent_doctype, parent_doctype_name, child_docname, d.get("item_code"))
child_item = set_sales_order_defaults(parent_doctype, parent_doctype_name, child_docname, d)
if parent_doctype == "Purchase Order":
child_item = set_purchase_order_defaults(parent_doctype, parent_doctype_name, child_docname, d.get("item_code"))
child_item = set_purchase_order_defaults(parent_doctype, parent_doctype_name, child_docname, d)
else:
child_item = frappe.get_doc(parent_doctype + ' Item', d.get("docname"))
if flt(child_item.get("rate")) == flt(d.get("rate")) and flt(child_item.get("qty")) == flt(d.get("qty")):
@@ -1243,6 +1246,7 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
child_item.flags.ignore_validate_update_after_submit = True
if new_child_flag:
parent.load_from_db()
child_item.idx = len(parent.items) + 1
child_item.insert()
else:

View File

@@ -379,7 +379,31 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
}
});
}
}
},
manufacturer_part_no: function(doc, cdt, cdn) {
const row = locals[cdt][cdn];
if (row.manufacturer_part_no) {
frappe.model.get_value('Item Manufacturer',
{
'item_code': row.item_code,
'manufacturer': row.manufacturer,
'manufacturer_part_no': row.manufacturer_part_no
},
'name',
function(data) {
if (!data) {
let msg = {
message: __("Manufacturer Part Number <b>{0}</b> is invalid", [row.manufacturer_part_no]),
title: __("Invalid Part Number")
}
frappe.throw(msg);
}
});
}
}
});
cur_frm.add_fetch('project', 'cost_center', 'cost_center');

View File

@@ -538,6 +538,10 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
if(!d[k]) d[k] = v;
});
if (d.has_batch_no && d.has_serial_no) {
d.batch_no = undefined;
}
erpnext.show_serial_batch_selector(me.frm, d, (item) => {
me.frm.script_manager.trigger('qty', item.doctype, item.name);
if (!me.frm.doc.set_warehouse)

View File

@@ -436,6 +436,44 @@ erpnext.utils.update_child_items = function(opts) {
const cannot_add_row = (typeof opts.cannot_add_row === 'undefined') ? true : opts.cannot_add_row;
const child_docname = (typeof opts.cannot_add_row === 'undefined') ? "items" : opts.child_docname;
this.data = [];
const fields = [{
fieldtype:'Data',
fieldname:"docname",
read_only: 1,
hidden: 1,
}, {
fieldtype:'Link',
fieldname:"item_code",
options: 'Item',
in_list_view: 1,
read_only: 0,
disabled: 0,
label: __('Item Code')
}, {
fieldtype:'Float',
fieldname:"qty",
default: 0,
read_only: 0,
in_list_view: 1,
label: __('Qty')
}, {
fieldtype:'Currency',
fieldname:"rate",
default: 0,
read_only: 0,
in_list_view: 1,
label: __('Rate')
}];
if (frm.doc.doctype == 'Sales Order' || frm.doc.doctype == 'Purchase Order' ) {
fields.splice(2, 0, {
fieldtype: 'Date',
fieldname: frm.doc.doctype == 'Sales Order' ? "delivery_date" : "schedule_date",
in_list_view: 1,
label: frm.doc.doctype == 'Sales Order' ? __("Delivery Date") : __("Reqd by date")
})
}
const dialog = new frappe.ui.Dialog({
title: __("Update Items"),
fields: [
@@ -450,34 +488,7 @@ erpnext.utils.update_child_items = function(opts) {
get_data: () => {
return this.data;
},
fields: [{
fieldtype:'Data',
fieldname:"docname",
read_only: 1,
hidden: 1,
}, {
fieldtype:'Link',
fieldname:"item_code",
options: 'Item',
in_list_view: 1,
read_only: 0,
disabled: 0,
label: __('Item Code')
}, {
fieldtype:'Float',
fieldname:"qty",
default: 0,
read_only: 0,
in_list_view: 1,
label: __('Qty')
}, {
fieldtype:'Currency',
fieldname:"rate",
default: 0,
read_only: 0,
in_list_view: 1,
label: __('Rate')
}]
fields: fields
},
],
primary_action: function() {
@@ -506,6 +517,8 @@ erpnext.utils.update_child_items = function(opts) {
"docname": d.name,
"name": d.name,
"item_code": d.item_code,
"delivery_date": d.delivery_date,
"schedule_date": d.schedule_date,
"qty": d.qty,
"rate": d.rate,
});

View File

@@ -228,9 +228,15 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
warehouse: function(doc, cdt, cdn) {
var me = this;
var item = frappe.get_doc(cdt, cdn);
if (item.serial_no && item.qty === item.serial_no.split(`\n`).length) {
return;
}
if (item.serial_no && !item.batch_no) {
item.serial_no = null;
}
var has_batch_no;
frappe.db.get_value('Item', {'item_code': item.item_code}, 'has_batch_no', (r) => {
has_batch_no = r && r.has_batch_no;

View File

@@ -114,6 +114,8 @@
"is_sub_contracted_item",
"column_break_74",
"customer_code",
"default_item_manufacturer",
"default_manufacturer_part_no",
"website_section",
"show_in_website",
"show_variant_in_website",
@@ -1038,6 +1040,18 @@
"fieldname": "auto_create_assets",
"fieldtype": "Check",
"label": "Auto Create Assets on Purchase"
},
{
"fieldname": "default_item_manufacturer",
"fieldtype": "Data",
"label": "Default Item Manufacturer",
"read_only": 1
},
{
"fieldname": "default_manufacturer_part_no",
"fieldtype": "Data",
"label": "Default Manufacturer Part No",
"read_only": 1
}
],
"has_web_view": 1,
@@ -1046,7 +1060,7 @@
"image_field": "image",
"links": [],
"max_attachments": 1,
"modified": "2020-03-24 16:14:36.950677",
"modified": "2020-04-07 15:56:06.195722",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

View File

@@ -1,4 +1,5 @@
{
"actions": [],
"allow_import": 1,
"creation": "2019-06-02 04:41:37.332911",
"doctype": "DocType",
@@ -10,7 +11,8 @@
"manufacturer_part_no",
"column_break_3",
"item_name",
"description"
"description",
"is_default"
],
"fields": [
{
@@ -52,9 +54,17 @@
"fieldtype": "Small Text",
"label": "Description",
"read_only": 1
},
{
"default": "0",
"fieldname": "is_default",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Is Default"
}
],
"modified": "2019-06-06 19:07:31.175919",
"links": [],
"modified": "2020-04-07 20:25:55.507905",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item Manufacturer",

View File

@@ -11,6 +11,10 @@ from frappe.model.document import Document
class ItemManufacturer(Document):
def validate(self):
self.validate_duplicate_entry()
self.manage_default_item_manufacturer()
def on_trash(self):
self.manage_default_item_manufacturer(delete=True)
def validate_duplicate_entry(self):
if self.is_new():
@@ -24,6 +28,40 @@ class ItemManufacturer(Document):
frappe.throw(_("Duplicate entry against the item code {0} and manufacturer {1}")
.format(self.item_code, self.manufacturer))
def manage_default_item_manufacturer(self, delete=False):
from frappe.model.utils import set_default
item = frappe.get_doc("Item", self.item_code)
default_manufacturer = item.default_item_manufacturer
default_part_no = item.default_manufacturer_part_no
if not self.is_default:
# if unchecked and default in Item master, clear it.
if default_manufacturer == self.manufacturer and default_part_no == self.manufacturer_part_no:
frappe.db.set_value("Item", item.name,
{
"default_item_manufacturer": None,
"default_manufacturer_part_no": None
})
elif self.is_default:
set_default(self, "item_code")
manufacturer, manufacturer_part_no = default_manufacturer, default_part_no
if delete:
manufacturer, manufacturer_part_no = None, None
elif (default_manufacturer != self.manufacturer) or \
(default_manufacturer == self.manufacturer and default_part_no != self.manufacturer_part_no):
manufacturer = self.manufacturer
manufacturer_part_no = self.manufacturer_part_no
frappe.db.set_value("Item", item.name,
{
"default_item_manufacturer": manufacturer,
"default_manufacturer_part_no": manufacturer_part_no
})
@frappe.whitelist()
def get_item_manufacturer_part_no(item_code, manufacturer):
return frappe.db.get_value("Item Manufacturer",

View File

@@ -406,12 +406,12 @@
{
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
"label": "Manufacturer Part Number",
"read_only": 1
"label": "Manufacturer Part Number"
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2020-04-16 09:00:00.992835",
"modified_by": "Administrator",
"module": "Stock",

View File

@@ -799,8 +799,7 @@
{
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
"label": "Manufacturer Part Number",
"read_only": 1
"label": "Manufacturer Part Number"
},
{
"depends_on": "is_fixed_asset",
@@ -823,7 +822,7 @@
"idx": 1,
"istable": 1,
"links": [],
"modified": "2020-03-05 14:19:48.799370",
"modified": "2020-04-07 18:38:21.141558",
"modified_by": "Administrator",
"module": "Stock",
"name": "Purchase Receipt Item",

View File

@@ -339,6 +339,9 @@ def get_basic_details(args, item, overwrite_warehouse=True):
else:
out["manufacturer_part_no"] = None
out["manufacturer"] = None
else:
out["manufacturer"], out["manufacturer_part_no"] = frappe.get_value("Item", item.name,
["default_item_manufacturer", "default_manufacturer_part_no"] )
child_doctype = args.doctype + ' Item'
meta = frappe.get_meta(child_doctype)