Merge branch 'hotfix'

This commit is contained in:
Nabin Hait 2017-12-28 18:46:51 +05:30
commit da82674b47
8 changed files with 46 additions and 19 deletions

View File

@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '10.0.3'
__version__ = '10.0.4'
def get_default_company(user=None):
'''Get default company for user'''

View File

@ -277,6 +277,8 @@ class PurchaseInvoice(BuyingController):
.format(item.purchase_receipt))
def on_submit(self):
super(PurchaseInvoice, self).on_submit()
self.check_prev_docstatus()
self.update_status_updater_args()
@ -606,6 +608,8 @@ class PurchaseInvoice(BuyingController):
))
def on_cancel(self):
super(PurchaseInvoice, self).on_cancel()
self.check_for_closed_status()
self.update_status_updater_args()

View File

@ -11,8 +11,7 @@ from erpnext.controllers.buying_controller import BuyingController
from erpnext.stock.doctype.item.item import get_last_purchase_details
from erpnext.stock.stock_balance import update_bin_qty, get_ordered_qty
from frappe.desk.notifications import clear_doctype_notifications
from erpnext.buying.utils import (validate_for_items, check_for_closed_status,
update_last_purchase_rate)
from erpnext.buying.utils import validate_for_items, check_for_closed_status
form_grid_templates = {
@ -189,6 +188,8 @@ class PurchaseOrder(BuyingController):
clear_doctype_notifications(self)
def on_submit(self):
super(PurchaseOrder, self).on_submit()
if self.is_against_so():
self.update_status_updater()
@ -199,9 +200,9 @@ class PurchaseOrder(BuyingController):
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
self.company, self.base_grand_total)
update_last_purchase_rate(self, is_submit = 1)
def on_cancel(self):
super(PurchaseOrder, self).on_cancel()
if self.is_against_so():
self.update_status_updater()
@ -218,8 +219,6 @@ class PurchaseOrder(BuyingController):
self.update_requested_qty()
self.update_ordered_qty()
update_last_purchase_rate(self, is_submit = 0)
def on_update(self):
pass

View File

@ -8,7 +8,7 @@ from frappe.utils import flt,cint, cstr, getdate
from erpnext.accounts.party import get_party_details
from erpnext.stock.get_item_details import get_conversion_factor
from erpnext.buying.utils import validate_for_items
from erpnext.buying.utils import validate_for_items, update_last_purchase_rate
from erpnext.stock.stock_ledger import get_valuation_rate
from erpnext.controllers.stock_controller import StockController
@ -409,6 +409,18 @@ class BuyingController(StockController):
"actual_qty": -1*flt(d.consumed_qty),
}))
def on_submit(self):
if self.get('is_return'):
return
update_last_purchase_rate(self, is_submit = 1)
def on_cancel(self):
if self.get('is_return'):
return
update_last_purchase_rate(self, is_submit = 0)
def validate_schedule_date(self):
if not self.schedule_date:
self.schedule_date = min([d.schedule_date for d in self.get("items")])

View File

@ -226,6 +226,7 @@ frappe.ui.form.on("Production Order", {
args: { production_item: frm.doc.production_item },
callback: function(r) {
frm.set_query("sales_order", function() {
erpnext.in_production_item_onchange = true;
return {
filters: [
["Sales Order","name", "in", r.message]

View File

@ -478,7 +478,7 @@ erpnext.patches.v9_2.rename_net_weight_in_item_master
erpnext.patches.v9_2.delete_process_payroll
erpnext.patches.v10_0.add_agriculture_domain
erpnext.patches.v10_0.add_non_profit_domain
erpnext.patches.v10_0.setup_vat_for_uae_and_saudi_arabia #2017-12-27
erpnext.patches.v10_0.setup_vat_for_uae_and_saudi_arabia #2017-12-28
erpnext.patches.v10_0.set_primary_contact_for_customer
erpnext.patches.v10_0.copy_projects_renamed_fields
erpnext.patches.v10_0.enabled_regional_print_format_based_on_country

View File

@ -56,8 +56,11 @@ def make_custom_fields():
dict(fieldname='total_amount', label='Total Amount',
fieldtype='Currency', insert_after='tax_amount',
print_hide=1, hidden=1, read_only=1, options="currency"),
]
delivery_date_field = [
dict(fieldname='delivery_date', label='Delivery Date',
fieldtype='Date', insert_after='item_name', print_hide=1),
fieldtype='Date', insert_after='item_name', print_hide=1)
]
custom_fields = {
@ -74,9 +77,19 @@ def make_custom_fields():
fieldtype='Data', insert_after='supplier_name'),
],
'Purchase Invoice': purchase_invoice_fields + invoice_fields,
'Purchase Order': purchase_invoice_fields + invoice_fields,
'Purchase Receipt': purchase_invoice_fields + invoice_fields,
'Sales Invoice': sales_invoice_fields + invoice_fields,
'Sales Invoice Item': invoice_item_fields,
'Purchase Invoice Item': invoice_item_fields
'Sales Order': sales_invoice_fields + invoice_fields,
'Delivery Note': sales_invoice_fields + invoice_fields,
'Sales Invoice Item': invoice_item_fields + delivery_date_field,
'Purchase Invoice Item': invoice_item_fields,
'Sales Order Item': invoice_item_fields,
'Delivery Note Item': invoice_item_fields,
'Quotation Item': invoice_item_fields,
'Purchase Order Item': invoice_item_fields,
'Purchase Receipt Item': invoice_item_fields,
'Supplier Quotation Item': invoice_item_fields,
}
create_custom_fields(custom_fields)

View File

@ -12,7 +12,7 @@ from frappe.utils import getdate
from erpnext.controllers.buying_controller import BuyingController
from erpnext.accounts.utils import get_account_currency
from frappe.desk.notifications import clear_doctype_notifications
from erpnext.buying.utils import check_for_closed_status, update_last_purchase_rate
from erpnext.buying.utils import check_for_closed_status
form_grid_templates = {
"items": "templates/form_grid/item_grid.html"
@ -111,6 +111,8 @@ class PurchaseReceipt(BuyingController):
# on submit
def on_submit(self):
super(PurchaseReceipt, self).on_submit()
# Check for Approving Authority
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype,
self.company, self.base_grand_total)
@ -119,9 +121,6 @@ class PurchaseReceipt(BuyingController):
if self.per_billed < 100:
self.update_billing_status()
if not self.is_return:
update_last_purchase_rate(self, 1)
# Updating stock ledger should always be called after updating prevdoc status,
# because updating ordered qty in bin depends upon updated ordered qty in PO
self.update_stock_ledger()
@ -140,6 +139,8 @@ class PurchaseReceipt(BuyingController):
frappe.throw(_("Purchase Invoice {0} is already submitted").format(self.submit_rv[0][0]))
def on_cancel(self):
super(PurchaseReceipt, self).on_cancel()
self.check_for_closed_status()
# Check if Purchase Invoice has been submitted against current Purchase Order
submitted = frappe.db.sql("""select t1.name
@ -152,9 +153,6 @@ class PurchaseReceipt(BuyingController):
self.update_prevdoc_status()
self.update_billing_status()
if not self.is_return:
update_last_purchase_rate(self, 0)
# Updating stock ledger should always be called after updating prevdoc status,
# because updating ordered qty in bin depends upon updated ordered qty in PO
self.update_stock_ledger()