Update Items in Submit state can add new row (#15644)

* Update Items in Sumbit state can add new row

In Sales Order and Purchase Order when docstatus is submitted user can
use Update Item btn to add new child Items

* Remove unused code line

* Remove blocking db save thread line

* Remove Company as not standard Field in Purchase Order Item

* Minor indentation fix

* Add Unit Test, add new row in update_child_qty_rate

* Codacy fix
This commit is contained in:
Stavros Anastasiadis
2018-12-10 13:00:55 +01:00
committed by Rushabh Mehta
parent 7c2a5bddb1
commit 3d82b74ea4
5 changed files with 82 additions and 11 deletions

View File

@@ -406,15 +406,19 @@ erpnext.utils.select_alternate_items = function(opts) {
erpnext.utils.update_child_items = function(opts) {
const frm = opts.frm;
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 dialog = new frappe.ui.Dialog({
title: __("Update Items"),
fields: [
{fieldtype:'Section Break', label: __('Items')},
{
fieldname: "trans_items", fieldtype: "Table", cannot_add_rows: true,
in_place_edit: true, data: this.data,
fieldname: "trans_items",
fieldtype: "Table",
cannot_add_rows: cannot_add_row,
in_place_edit: true,
data: this.data,
get_data: () => {
return this.data;
},
@@ -450,10 +454,12 @@ erpnext.utils.update_child_items = function(opts) {
const trans_items = this.get_values()["trans_items"];
frappe.call({
method: 'erpnext.controllers.accounts_controller.update_child_qty_rate',
freeze: true,
args: {
'parent_doctype': frm.doc.doctype,
'trans_items': trans_items,
'parent_doctype_name': frm.doc.name
'parent_doctype_name': frm.doc.name,
'child_docname': child_docname
},
callback: function() {
frm.reload_doc();