Merge branch 'develop' into cancel_frappe_1
This commit is contained in:
commit
71ed1d42e2
@ -167,8 +167,15 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
make_comment_dialog_and_block_invoice: function(){
|
||||
const me = this;
|
||||
|
||||
const title = __('Add Comment');
|
||||
const title = __('Block Invoice');
|
||||
const fields = [
|
||||
{
|
||||
fieldname: 'release_date',
|
||||
read_only: 0,
|
||||
fieldtype:'Date',
|
||||
label: __('Release Date'),
|
||||
default: me.frm.doc.release_date
|
||||
},
|
||||
{
|
||||
fieldname: 'hold_comment',
|
||||
read_only: 0,
|
||||
@ -187,7 +194,11 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
|
||||
const dialog_data = me.dialog.get_values();
|
||||
frappe.call({
|
||||
'method': 'erpnext.accounts.doctype.purchase_invoice.purchase_invoice.block_invoice',
|
||||
'args': {'name': me.frm.doc.name, 'hold_comment': dialog_data.hold_comment},
|
||||
'args': {
|
||||
'name': me.frm.doc.name,
|
||||
'hold_comment': dialog_data.hold_comment,
|
||||
'release_date': dialog_data.release_date
|
||||
},
|
||||
'callback': (r) => me.frm.reload_doc()
|
||||
});
|
||||
me.dialog.hide();
|
||||
|
@ -927,9 +927,10 @@ class PurchaseInvoice(BuyingController):
|
||||
def on_recurring(self, reference_doc, auto_repeat_doc):
|
||||
self.due_date = None
|
||||
|
||||
def block_invoice(self, hold_comment=None):
|
||||
def block_invoice(self, hold_comment=None, release_date=None):
|
||||
self.db_set('on_hold', 1)
|
||||
self.db_set('hold_comment', cstr(hold_comment))
|
||||
self.db_set('release_date', release_date)
|
||||
|
||||
def unblock_invoice(self):
|
||||
self.db_set('on_hold', 0)
|
||||
@ -1013,10 +1014,10 @@ def unblock_invoice(name):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def block_invoice(name, hold_comment):
|
||||
def block_invoice(name, hold_comment, release_date):
|
||||
if frappe.db.exists('Purchase Invoice', name):
|
||||
pi = frappe.get_doc('Purchase Invoice', name)
|
||||
pi.block_invoice(hold_comment)
|
||||
pi.block_invoice(hold_comment, release_date)
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_inter_company_sales_invoice(source_name, target_doc=None):
|
||||
|
@ -338,25 +338,12 @@ frappe.ui.form.on('Asset', {
|
||||
})
|
||||
},
|
||||
|
||||
purchase_receipt: function(frm) {
|
||||
purchase_receipt: (frm) => {
|
||||
frm.trigger('toggle_reference_doc');
|
||||
|
||||
if (frm.doc.purchase_receipt) {
|
||||
if (frm.doc.item_code) {
|
||||
frappe.db.get_doc('Purchase Receipt', frm.doc.purchase_receipt).then(pr_doc => {
|
||||
frm.set_value('company', pr_doc.company);
|
||||
frm.set_value('purchase_date', pr_doc.posting_date);
|
||||
const item = pr_doc.items.find(item => item.item_code === frm.doc.item_code);
|
||||
if (!item) {
|
||||
frm.set_value('purchase_receipt', '');
|
||||
frappe.msgprint({
|
||||
title: __('Invalid Purchase Receipt'),
|
||||
message: __("The selected Purchase Receipt doesn't contains selected Asset Item."),
|
||||
indicator: 'red'
|
||||
});
|
||||
}
|
||||
frm.set_value('gross_purchase_amount', item.base_net_rate);
|
||||
frm.set_value('location', item.asset_location);
|
||||
frm.events.set_values_from_purchase_doc(frm, 'Purchase Receipt', pr_doc)
|
||||
});
|
||||
} else {
|
||||
frm.set_value('purchase_receipt', '');
|
||||
@ -368,24 +355,12 @@ frappe.ui.form.on('Asset', {
|
||||
}
|
||||
},
|
||||
|
||||
purchase_invoice: function(frm) {
|
||||
purchase_invoice: (frm) => {
|
||||
frm.trigger('toggle_reference_doc');
|
||||
if (frm.doc.purchase_invoice) {
|
||||
if (frm.doc.item_code) {
|
||||
frappe.db.get_doc('Purchase Invoice', frm.doc.purchase_invoice).then(pi_doc => {
|
||||
frm.set_value('company', pi_doc.company);
|
||||
frm.set_value('purchase_date', pi_doc.posting_date);
|
||||
const item = pi_doc.items.find(item => item.item_code === frm.doc.item_code);
|
||||
if (!item) {
|
||||
frm.set_value('purchase_invoice', '');
|
||||
frappe.msgprint({
|
||||
title: __('Invalid Purchase Invoice'),
|
||||
message: __("The selected Purchase Invoice doesn't contains selected Asset Item."),
|
||||
indicator: 'red'
|
||||
});
|
||||
}
|
||||
frm.set_value('gross_purchase_amount', item.base_net_rate);
|
||||
frm.set_value('location', item.asset_location);
|
||||
frm.events.set_values_from_purchase_doc(frm, 'Purchase Invoice', pi_doc)
|
||||
});
|
||||
} else {
|
||||
frm.set_value('purchase_invoice', '');
|
||||
@ -397,6 +372,24 @@ frappe.ui.form.on('Asset', {
|
||||
}
|
||||
},
|
||||
|
||||
set_values_from_purchase_doc: function(frm, doctype, purchase_doc) {
|
||||
frm.set_value('company', purchase_doc.company);
|
||||
frm.set_value('purchase_date', purchase_doc.posting_date);
|
||||
const item = purchase_doc.items.find(item => item.item_code === frm.doc.item_code);
|
||||
if (!item) {
|
||||
doctype_field = frappe.scrub(doctype)
|
||||
frm.set_value(doctype_field, '');
|
||||
frappe.msgprint({
|
||||
title: __(`Invalid ${doctype}`),
|
||||
message: __(`The selected ${doctype} doesn't contains selected Asset Item.`),
|
||||
indicator: 'red'
|
||||
});
|
||||
}
|
||||
frm.set_value('gross_purchase_amount', item.base_net_rate + item.item_tax_amount);
|
||||
frm.set_value('purchase_receipt_amount', item.base_net_rate + item.item_tax_amount);
|
||||
frm.set_value('location', item.asset_location);
|
||||
},
|
||||
|
||||
set_depreciation_rate: function(frm, row) {
|
||||
if (row.total_number_of_depreciations && row.frequency_of_depreciation
|
||||
&& row.expected_value_after_useful_life) {
|
||||
|
@ -645,7 +645,6 @@ erpnext.patches.v12_0.set_expense_account_in_landed_cost_voucher_taxes
|
||||
erpnext.patches.v12_0.replace_accounting_with_accounts_in_home_settings
|
||||
erpnext.patches.v12_0.set_payment_entry_status
|
||||
erpnext.patches.v12_0.update_owner_fields_in_acc_dimension_custom_fields
|
||||
erpnext.patches.v12_0.set_default_for_add_taxes_from_item_tax_template
|
||||
erpnext.patches.v12_0.add_export_type_field_in_party_master
|
||||
erpnext.patches.v12_0.remove_denied_leaves_from_leave_ledger
|
||||
erpnext.patches.v12_0.update_price_or_product_discount
|
||||
|
@ -1,5 +0,0 @@
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.db.set_value("Accounts Settings", None, "add_taxes_from_item_tax_template", 1)
|
||||
frappe.db.set_default("add_taxes_from_item_tax_template", 1)
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"actions": [],
|
||||
"autoname": "hash",
|
||||
"creation": "2013-03-07 11:42:58",
|
||||
"doctype": "DocType",
|
||||
@ -151,6 +152,7 @@
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"columns": 2,
|
||||
"depends_on": "eval: !parent.skip_delivery_note",
|
||||
"fieldname": "delivery_date",
|
||||
@ -767,7 +769,8 @@
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"modified": "2019-12-12 18:06:26.238169",
|
||||
"links": [],
|
||||
"modified": "2020-01-13 12:29:03.103797",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Order Item",
|
||||
|
@ -76,7 +76,7 @@ class AuthorizationControl(TransactionBase):
|
||||
add_cond = ''
|
||||
auth_value = av_dis
|
||||
|
||||
if val == 1: add_cond += " and system_user = '"+ frappe.db.escape(session['user'])+"'"
|
||||
if val == 1: add_cond += " and system_user = {}".format(frappe.db.escape(session['user']))
|
||||
elif val == 2: add_cond += " and system_role IN %s" % ("('"+"','".join(frappe.get_roles())+"')")
|
||||
else: add_cond += " and ifnull(system_user,'') = '' and ifnull(system_role,'') = ''"
|
||||
|
||||
@ -85,7 +85,7 @@ class AuthorizationControl(TransactionBase):
|
||||
if doc_obj:
|
||||
if doc_obj.doctype == 'Sales Invoice': customer = doc_obj.customer
|
||||
else: customer = doc_obj.customer_name
|
||||
add_cond = " and master_name = '"+ frappe.db.escape(customer) +"'"
|
||||
add_cond = " and master_name = {}".format(frappe.db.escape(customer))
|
||||
if based_on == 'Itemwise Discount':
|
||||
if doc_obj:
|
||||
for t in doc_obj.get("items"):
|
||||
|
@ -43,7 +43,7 @@ def get_data(report_filters):
|
||||
def get_stock_ledger_data(report_filters, filters):
|
||||
if report_filters.account:
|
||||
warehouses = get_warehouses_based_on_account(report_filters.account,
|
||||
report_filters.warehouse)
|
||||
report_filters.company)
|
||||
|
||||
filters["warehouse"] = ("in", warehouses)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user