Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
176577b549 | ||
|
|
27c1f85836 | ||
|
|
84ecaac27d | ||
|
|
0f2e3a4e95 | ||
|
|
549de70fa2 | ||
|
|
9e83b70ea8 | ||
|
|
2285f90b64 | ||
|
|
2f1db57fe1 | ||
|
|
31f6436f75 | ||
|
|
cefcf165c4 | ||
|
|
436d82e60b | ||
|
|
ed05a9928b | ||
|
|
be06cde5f5 | ||
|
|
cdc895734f | ||
|
|
d2cf4eb1d2 | ||
|
|
619c40b04a | ||
|
|
d8bdaeffe3 | ||
|
|
dd01bcc485 | ||
|
|
27d45a244e | ||
|
|
0ecad33642 |
@@ -2,7 +2,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
__version__ = '7.1.7'
|
||||
__version__ = '7.1.10'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
|
||||
@@ -46,19 +46,22 @@ class GLEntry(Document):
|
||||
account_type = frappe.db.get_value("Account", self.account, "account_type")
|
||||
if not (self.party_type and self.party):
|
||||
if account_type == "Receivable":
|
||||
frappe.throw(_("Customer is required against Receivable account {0}").format(self.account))
|
||||
frappe.throw(_("{0} {1}: Customer is required against Receivable account {2}")
|
||||
.format(self.voucher_type, self.voucher_no, self.account))
|
||||
elif account_type == "Payable":
|
||||
frappe.throw(_("Supplier is required against Payable account {0}").format(self.account))
|
||||
frappe.throw(_("{0} {1}: Supplier is required against Payable account {2}")
|
||||
.format(self.voucher_type, self.voucher_no, self.account))
|
||||
|
||||
# Zero value transaction is not allowed
|
||||
if not (flt(self.debit) or flt(self.credit)):
|
||||
frappe.throw(_("Either debit or credit amount is required for {0}").format(self.account))
|
||||
frappe.throw(_("{0} {1}: Either debit or credit amount is required for {2}")
|
||||
.format(self.voucher_type, self.voucher_no, self.account))
|
||||
|
||||
def pl_must_have_cost_center(self):
|
||||
if frappe.db.get_value("Account", self.account, "report_type") == "Profit and Loss":
|
||||
if not self.cost_center and self.voucher_type != 'Period Closing Voucher':
|
||||
frappe.throw(_("Cost Center is required for 'Profit and Loss' account {0}. Please set up a default Cost Center for the Company.")
|
||||
.format(self.account))
|
||||
frappe.throw(_("{0} {1}: Cost Center is required for 'Profit and Loss' account {2}. Please set up a default Cost Center for the Company.")
|
||||
.format(self.voucher_type, self.voucher_no, self.account))
|
||||
else:
|
||||
if self.cost_center:
|
||||
self.cost_center = None
|
||||
@@ -68,7 +71,8 @@ class GLEntry(Document):
|
||||
def check_pl_account(self):
|
||||
if self.is_opening=='Yes' and \
|
||||
frappe.db.get_value("Account", self.account, "report_type")=="Profit and Loss":
|
||||
frappe.throw(_("'Profit and Loss' type account {0} not allowed in Opening Entry").format(self.account))
|
||||
frappe.throw(_("{0} {1}: 'Profit and Loss' type account {2} not allowed in Opening Entry")
|
||||
.format(self.voucher_type, self.voucher_no, self.account))
|
||||
|
||||
def validate_account_details(self, adv_adj):
|
||||
"""Account must be ledger, active and not freezed"""
|
||||
@@ -77,13 +81,16 @@ class GLEntry(Document):
|
||||
from tabAccount where name=%s""", self.account, as_dict=1)[0]
|
||||
|
||||
if ret.is_group==1:
|
||||
frappe.throw(_("Account {0} cannot be a Group").format(self.account))
|
||||
frappe.throw(_("{0} {1}: Account {2} cannot be a Group")
|
||||
.format(self.voucher_type, self.voucher_no, self.account))
|
||||
|
||||
if ret.docstatus==2:
|
||||
frappe.throw(_("Account {0} is inactive").format(self.account))
|
||||
frappe.throw(_("{0} {1}: Account {2} is inactive")
|
||||
.format(self.voucher_type, self.voucher_no, self.account))
|
||||
|
||||
if ret.company != self.company:
|
||||
frappe.throw(_("Account {0} does not belong to Company {1}").format(self.account, self.company))
|
||||
frappe.throw(_("{0} {1}: Account {2} does not belong to Company {3}")
|
||||
.format(self.voucher_type, self.voucher_no, self.account, self.company))
|
||||
|
||||
def validate_cost_center(self):
|
||||
if not hasattr(self, "cost_center_company"):
|
||||
@@ -97,7 +104,8 @@ class GLEntry(Document):
|
||||
return self.cost_center_company[self.cost_center]
|
||||
|
||||
if self.cost_center and _get_cost_center_company() != self.company:
|
||||
frappe.throw(_("Cost Center {0} does not belong to Company {1}").format(self.cost_center, self.company))
|
||||
frappe.throw(_("{0} {1}: Cost Center {2} does not belong to Company {3}")
|
||||
.format(self.voucher_type, self.voucher_no, self.cost_center, self.company))
|
||||
|
||||
def validate_party(self):
|
||||
validate_party_frozen_disabled(self.party_type, self.party)
|
||||
@@ -110,8 +118,9 @@ class GLEntry(Document):
|
||||
self.account_currency = company_currency
|
||||
|
||||
if account_currency != self.account_currency:
|
||||
frappe.throw(_("Accounting Entry for {0} can only be made in currency: {1}")
|
||||
.format(self.account, (account_currency or company_currency)), InvalidAccountCurrency)
|
||||
frappe.throw(_("{0} {1}: Accounting Entry for {2} can only be made in currency: {3}")
|
||||
.format(self.voucher_type, self.voucher_no, self.account,
|
||||
(account_currency or company_currency)), InvalidAccountCurrency)
|
||||
|
||||
if self.party_type and self.party:
|
||||
validate_party_gle_currency(self.party_type, self.party, self.company, self.account_currency)
|
||||
@@ -186,6 +195,7 @@ def update_outstanding_amt(account, party_type, party, against_voucher_type, aga
|
||||
if against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
|
||||
ref_doc = frappe.get_doc(against_voucher_type, against_voucher)
|
||||
ref_doc.db_set('outstanding_amount', bal)
|
||||
ref_doc.set_status(update=True)
|
||||
|
||||
def validate_frozen_account(account, adv_adj=None):
|
||||
frozen_account = frappe.db.get_value("Account", account, "freeze_account")
|
||||
|
||||
@@ -2771,6 +2771,35 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "Draft",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Status",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nDraft\nReturn\nDebit Note Issued\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@@ -3264,7 +3293,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2016-11-03 15:54:34.750548",
|
||||
"modified": "2016-11-09 14:18:47.094777",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Invoice",
|
||||
|
||||
@@ -65,6 +65,7 @@ class PurchaseInvoice(BuyingController):
|
||||
self.validate_fixed_asset()
|
||||
self.validate_fixed_asset_account()
|
||||
self.create_remarks()
|
||||
self.set_status()
|
||||
|
||||
def validate_cash(self):
|
||||
if not self.cash_bank_account and flt(self.paid_amount):
|
||||
@@ -596,6 +597,7 @@ class PurchaseInvoice(BuyingController):
|
||||
self.make_gl_entries_on_cancel()
|
||||
self.update_project()
|
||||
self.update_fixed_asset()
|
||||
frappe.db.set(self, 'status', 'Cancelled')
|
||||
|
||||
def update_project(self):
|
||||
project_list = []
|
||||
|
||||
@@ -14,7 +14,9 @@ frappe.listview_settings['Purchase Invoice'] = {
|
||||
} else {
|
||||
return [__("Unpaid"), "orange", "outstanding_amount,>,0|due,>=,Today"];
|
||||
}
|
||||
} else if(flt(doc.outstanding_amount)==0 && doc.docstatus==1) {
|
||||
} else if(flt(doc.outstanding_amount) < 0 && doc.docstatus == 1) {
|
||||
return [__("Debit Note Issued"), "darkgrey", "outstanding_amount,<,0"]
|
||||
}else if(flt(doc.outstanding_amount)==0 && doc.docstatus==1) {
|
||||
return [__("Paid"), "green", "outstanding_amount,=,0"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,20 +483,22 @@ frappe.ui.form.on('Sales Invoice', {
|
||||
frappe.ui.form.on('Sales Invoice Timesheet', {
|
||||
time_sheet: function(frm, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
frappe.call({
|
||||
method: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet_data",
|
||||
args: {
|
||||
'name': d.time_sheet,
|
||||
'project': frm.doc.project || null
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if(r.message){
|
||||
data = r.message;
|
||||
frappe.model.set_value(cdt, cdn, "billing_hours", data.billing_hours);
|
||||
frappe.model.set_value(cdt, cdn, "billing_amount", data.billing_amount);
|
||||
frappe.model.set_value(cdt, cdn, "timesheet_detail", data.timesheet_detail);
|
||||
if(d.time_sheet) {
|
||||
frappe.call({
|
||||
method: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet_data",
|
||||
args: {
|
||||
'name': d.time_sheet,
|
||||
'project': frm.doc.project || null
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if(r.message){
|
||||
data = r.message;
|
||||
frappe.model.set_value(cdt, cdn, "billing_hours", data.billing_hours);
|
||||
frappe.model.set_value(cdt, cdn, "billing_amount", data.billing_amount);
|
||||
frappe.model.set_value(cdt, cdn, "timesheet_detail", data.timesheet_detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -3065,6 +3065,35 @@
|
||||
"unique": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"default": "Draft",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Status",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "\nDraft\nReturn\nCredit Note Issued\nSubmitted\nPaid\nUnpaid\nOverdue\nCancelled",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@@ -4010,7 +4039,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2016-11-03 15:55:41.249414",
|
||||
"modified": "2016-11-09 14:18:24.760263",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
||||
@@ -86,6 +86,7 @@ class SalesInvoice(SellingController):
|
||||
self.update_packing_list()
|
||||
self.set_billing_hours_and_amount()
|
||||
self.update_timesheet_billing_for_project()
|
||||
self.set_status()
|
||||
|
||||
def before_save(self):
|
||||
set_account_for_mode_of_payment(self)
|
||||
@@ -158,6 +159,7 @@ class SalesInvoice(SellingController):
|
||||
self.update_stock_ledger()
|
||||
|
||||
self.make_gl_entries_on_cancel()
|
||||
frappe.db.set(self, 'status', 'Cancelled')
|
||||
|
||||
def update_status_updater_args(self):
|
||||
if cint(self.update_stock):
|
||||
|
||||
@@ -10,9 +10,11 @@ frappe.listview_settings['Sales Invoice'] = {
|
||||
return [__("Return"), "darkgrey", "is_return,=,Yes"];
|
||||
} else if(flt(doc.outstanding_amount)==0) {
|
||||
return [__("Paid"), "green", "outstanding_amount,=,0"]
|
||||
} else if (flt(doc.outstanding_amount) > 0 && doc.due_date > frappe.datetime.get_today()) {
|
||||
} else if(flt(doc.outstanding_amount) < 0) {
|
||||
return [__("Credit Note Issued"), "darkgrey", "outstanding_amount,<,0"]
|
||||
}else if (flt(doc.outstanding_amount) > 0 && doc.due_date >= frappe.datetime.get_today()) {
|
||||
return [__("Unpaid"), "orange", "outstanding_amount,>,0|due_date,>,Today"]
|
||||
} else if (flt(doc.outstanding_amount) > 0 && doc.due_date <= frappe.datetime.get_today()) {
|
||||
} else if (flt(doc.outstanding_amount) > 0 && doc.due_date < frappe.datetime.get_today()) {
|
||||
return [__("Overdue"), "red", "outstanding_amount,>,0|due_date,<=,Today"]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -988,6 +988,10 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
|
||||
item.margin_rate_or_amount = pricing_rule[0].margin_rate_or_amount;
|
||||
item.discount_percentage = pricing_rule[0].discount_percentage || 0.0;
|
||||
me.apply_pricing_rule_on_item(item)
|
||||
} else if(item.discount_percentage > 0 || item.margin_rate_or_amount > 0) {
|
||||
item.margin_rate_or_amount = 0.0;
|
||||
item.discount_percentage = 0.0;
|
||||
me.apply_pricing_rule_on_item(item)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -720,4 +720,13 @@ def get_advance_payment_entries(party_type, party, party_account,
|
||||
and docstatus = 1 and unallocated_amount > 0
|
||||
""".format(party_account_field), (party_account, party_type, party, payment_type), as_dict=1)
|
||||
|
||||
return list(payment_entries_against_order) + list(unallocated_payment_entries)
|
||||
return list(payment_entries_against_order) + list(unallocated_payment_entries)
|
||||
|
||||
def update_invoice_status():
|
||||
# Daily update the status of the invoices
|
||||
|
||||
frappe.db.sql(""" update `tabSales Invoice` set status = 'Overdue'
|
||||
where due_date < CURDATE() and docstatus = 1 and outstanding_amount > 0""")
|
||||
|
||||
frappe.db.sql(""" update `tabPurchase Invoice` set status = 'Overdue'
|
||||
where due_date < CURDATE() and docstatus = 1 and outstanding_amount > 0""")
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import flt, comma_or
|
||||
from frappe.utils import flt, comma_or, nowdate, getdate
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from erpnext.accounts.party_status import notify_status
|
||||
@@ -41,6 +41,26 @@ status_map = {
|
||||
["Cancelled", "eval:self.docstatus==2"],
|
||||
["Closed", "eval:self.status=='Closed'"],
|
||||
],
|
||||
"Sales Invoice": [
|
||||
["Draft", None],
|
||||
["Submitted", "eval:self.docstatus==1"],
|
||||
["Return", "eval:self.is_return==1 and self.docstatus==1"],
|
||||
["Credit Note Issued", "eval:self.outstanding_amount < 0 and self.docstatus==1"],
|
||||
["Paid", "eval:self.outstanding_amount==0 and self.docstatus==1 and self.is_return==0"],
|
||||
["Unpaid", "eval:self.outstanding_amount > 0 and getdate(self.due_date) >= getdate(nowdate()) and self.docstatus==1"],
|
||||
["Overdue", "eval:self.outstanding_amount > 0 and getdate(self.due_date) < getdate(nowdate()) and self.docstatus==1"],
|
||||
["Cancelled", "eval:self.docstatus==2"],
|
||||
],
|
||||
"Purchase Invoice": [
|
||||
["Draft", None],
|
||||
["Submitted", "eval:self.docstatus==1"],
|
||||
["Return", "eval:self.is_return==1 and self.docstatus==1"],
|
||||
["Debit Note Issued", "eval:self.outstanding_amount < 0 and self.docstatus==1"],
|
||||
["Paid", "eval:self.outstanding_amount==0 and self.docstatus==1 and self.is_return==0"],
|
||||
["Unpaid", "eval:self.outstanding_amount > 0 and getdate(self.due_date) >= getdate(nowdate()) and self.docstatus==1"],
|
||||
["Overdue", "eval:self.outstanding_amount > 0 and getdate(self.due_date) < getdate(nowdate()) and self.docstatus==1"],
|
||||
["Cancelled", "eval:self.docstatus==2"],
|
||||
],
|
||||
"Purchase Order": [
|
||||
["Draft", None],
|
||||
["To Receive and Bill", "eval:self.per_received < 100 and self.per_billed < 100 and self.docstatus == 1"],
|
||||
|
||||
@@ -189,6 +189,7 @@ scheduler_events = {
|
||||
"erpnext.stock.reorder_item.reorder_item",
|
||||
"erpnext.setup.doctype.email_digest.email_digest.send",
|
||||
"erpnext.support.doctype.issue.issue.auto_close_tickets",
|
||||
"erpnext.controllers.accounts_controller.update_invoice_status",
|
||||
"erpnext.accounts.doctype.fiscal_year.fiscal_year.auto_create_fiscal_year",
|
||||
"erpnext.hr.doctype.employee.employee.send_birthday_reminders",
|
||||
"erpnext.projects.doctype.task.task.set_tasks_as_overdue",
|
||||
|
||||
@@ -129,22 +129,23 @@
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "department",
|
||||
"fieldtype": "Link",
|
||||
"fieldtype": "Read Only",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Department",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "department",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Department",
|
||||
"options": "employee.department",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -157,23 +158,25 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "eval:doc.designation",
|
||||
"fieldname": "designation",
|
||||
"fieldtype": "Link",
|
||||
"fieldtype": "Read Only",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Designation",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "designation",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Designation",
|
||||
"options": "employee.designation",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -187,22 +190,23 @@
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "branch",
|
||||
"fieldtype": "Link",
|
||||
"fieldtype": "Read Only",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Branch",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "branch",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Branch",
|
||||
"options": "employee.branch",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
@@ -1344,7 +1348,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-11-03 16:02:55.891380",
|
||||
"modified": "2016-11-06 09:54:36.478329",
|
||||
"modified_by": "Administrator",
|
||||
"module": "HR",
|
||||
"name": "Salary Slip",
|
||||
|
||||
@@ -340,6 +340,10 @@ erpnext.patches.v7_0.update_status_of_zero_amount_sales_order
|
||||
erpnext.patches.v7_1.add_field_for_task_dependent
|
||||
erpnext.patches.v7_0.repost_bin_qty_and_item_projected_qty
|
||||
erpnext.patches.v7_1.set_prefered_contact_email
|
||||
execute:frappe.db.sql("update `tabSingles` set value = 1 where field = 'unlink_payment_on_cancellation_of_invoice' and doctype = 'Accounts Settings'")
|
||||
execute:frappe.reload_doc('accounts', 'doctype', 'accounts_settings')
|
||||
execute:frappe.db.set_value("Accounts Settings", "Accounts Settings", "unlink_payment_on_cancellation_of_invoice", 0)
|
||||
execute:frappe.db.sql("update `tabStock Entry` set total_amount = null where purpose in('Repack', 'Manufacture')")
|
||||
erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
|
||||
erpnext.patches.v7_0.repost_gle_for_pi_with_update_stock #2016-11-01
|
||||
erpnext.patches.v7_1.add_account_user_role_for_timesheet
|
||||
erpnext.patches.v7_0.set_base_amount_in_invoice_payment_table
|
||||
erpnext.patches.v7_1.update_invoice_status
|
||||
@@ -5,5 +5,5 @@ def execute():
|
||||
frappe.rename_doc("Role", "Material User", "Stock User")
|
||||
if not frappe.db.exists("Role", "Stock Manager"):
|
||||
frappe.rename_doc("Role", "Material Manager", "Stock Manager")
|
||||
if not frappe.db.exists("Role", "Stock Manager"):
|
||||
if not frappe.db.exists("Role", "Item Manager"):
|
||||
frappe.rename_doc("Role", "Material Master Manager", "Item Manager")
|
||||
|
||||
@@ -3,11 +3,12 @@ from erpnext.manufacturing.doctype.production_order.production_order \
|
||||
import make_timesheet, add_timesheet_detail
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc('projects', 'doctype', 'task')
|
||||
frappe.reload_doc('projects', 'doctype', 'timesheet')
|
||||
if not frappe.db.table_exists("Time Log"):
|
||||
return
|
||||
|
||||
for data in frappe.db.sql("select * from `tabTime Log` where docstatus < 2", as_dict=1):
|
||||
for data in frappe.db.sql("select * from `tabTime Log`", as_dict=1):
|
||||
if data.task:
|
||||
company = frappe.db.get_value("Task", data.task, "company")
|
||||
elif data.production_order:
|
||||
@@ -18,7 +19,10 @@ def execute():
|
||||
time_sheet = make_timesheet(data.production_order)
|
||||
args = get_timelog_data(data)
|
||||
add_timesheet_detail(time_sheet, args)
|
||||
time_sheet.docstatus = data.docstatus
|
||||
if data.docstatus == 2:
|
||||
time_sheet.docstatus = 0
|
||||
else:
|
||||
time_sheet.docstatus = data.docstatus
|
||||
time_sheet.employee = data.employee
|
||||
time_sheet.note = data.note
|
||||
time_sheet.company = company
|
||||
@@ -38,6 +42,10 @@ def execute():
|
||||
d.db_set("docstatus", 1)
|
||||
time_sheet.update_production_order(time_sheet.name)
|
||||
time_sheet.update_task_and_project()
|
||||
if data.docstatus == 2:
|
||||
time_sheet.db_set("docstatus", 2)
|
||||
for d in time_sheet.get("time_logs"):
|
||||
d.db_set("docstatus", 2)
|
||||
|
||||
def get_timelog_data(data):
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.utils import flt
|
||||
|
||||
def execute():
|
||||
si_list = frappe.db.sql("""
|
||||
select distinct parent
|
||||
from `tabSales Invoice Payment`
|
||||
where docstatus!=2 and parenttype = 'Sales Invoice'
|
||||
and amount != 0 and base_amount = 0
|
||||
""")
|
||||
|
||||
count = 0
|
||||
for d in si_list:
|
||||
si = frappe.get_doc("Sales Invoice", d[0])
|
||||
for p in si.get("payments"):
|
||||
if p.amount and not p.base_amount:
|
||||
base_amount = flt(p.amount*si.conversion_rate, si.precision("base_paid_amount"))
|
||||
frappe.db.set_value("Sales Invoice Payment", p.name, "base_amount", base_amount, update_modified=False)
|
||||
|
||||
count +=1
|
||||
|
||||
if count % 200 == 0:
|
||||
frappe.db.commit()
|
||||
31
erpnext/patches/v7_1/add_account_user_role_for_timesheet.py
Normal file
31
erpnext/patches/v7_1/add_account_user_role_for_timesheet.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# 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():
|
||||
if not frappe.db.get_value('DocPerm', {'parent': 'Timesheet', 'role': 'Accounts User', 'permlevel': 1}):
|
||||
doc = frappe.get_doc('DocType', 'Timesheet')
|
||||
doc.append('permissions', {
|
||||
'role': "Accounts User",
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'write': 1,
|
||||
'create': 1,
|
||||
'delete': 1,
|
||||
'submit': 1,
|
||||
'cancel': 1,
|
||||
'amend': 1,
|
||||
'report': 1,
|
||||
'email': 1
|
||||
})
|
||||
|
||||
doc.append('permissions', {
|
||||
'role': "Accounts User",
|
||||
'permlevel': 1,
|
||||
'read': 1,
|
||||
'write': 1
|
||||
})
|
||||
|
||||
doc.save(ignore_permissions=True)
|
||||
34
erpnext/patches/v7_1/update_invoice_status.py
Normal file
34
erpnext/patches/v7_1/update_invoice_status.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# 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.reload_doc('accounts', 'doctype', 'sales_invoice')
|
||||
frappe.reload_doc('accounts', 'doctype', 'purchase_invoice')
|
||||
|
||||
frappe.db.sql("""
|
||||
update
|
||||
`tabPurchase Invoice`
|
||||
set
|
||||
status = (Case When outstanding_amount = 0 and docstatus = 1 and is_return = 0 then 'Paid'
|
||||
when due_date < CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Overdue'
|
||||
when due_date >= CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Unpaid'
|
||||
when outstanding_amount < 0 and docstatus =1 then 'Debit Note Issued'
|
||||
when is_return = 1 and docstatus =1 then 'Return'
|
||||
when docstatus = 2 then 'Cancelled'
|
||||
else 'Draft'
|
||||
End)""")
|
||||
|
||||
frappe.db.sql("""
|
||||
update
|
||||
`tabSales Invoice`
|
||||
set status = (Case When outstanding_amount = 0 and docstatus = 1 and is_return = 0 then 'Paid'
|
||||
when due_date < CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Overdue'
|
||||
when due_date >= CURDATE() and outstanding_amount > 0 and docstatus =1 then 'Unpaid'
|
||||
when outstanding_amount < 0 and docstatus =1 then 'Credit Note Issued'
|
||||
when is_return = 1 and docstatus =1 then 'Return'
|
||||
when docstatus = 2 then 'Cancelled'
|
||||
else 'Draft'
|
||||
End)""")
|
||||
@@ -847,7 +847,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-11-03 16:06:32.259060",
|
||||
"modified": "2016-11-04 18:27:08.484033",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Projects",
|
||||
"name": "Timesheet",
|
||||
@@ -916,48 +916,6 @@
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
@@ -978,6 +936,48 @@
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 0,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"delete": 0,
|
||||
"email": 0,
|
||||
"export": 0,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"is_custom": 0,
|
||||
"permlevel": 1,
|
||||
"print": 0,
|
||||
"read": 1,
|
||||
"report": 0,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 0,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
|
||||
@@ -322,18 +322,7 @@ def make_sales_invoice(source_name, target=None):
|
||||
@frappe.whitelist()
|
||||
def make_salary_slip(source_name, target_doc=None):
|
||||
target = frappe.new_doc("Salary Slip")
|
||||
set_missing_values(source_name, target)
|
||||
|
||||
target.append("timesheets", get_mapped_doc("Timesheet", source_name, {
|
||||
"Timesheet": {
|
||||
"doctype": "Salary Slip Timesheet",
|
||||
"field_map": {
|
||||
"total_hours": "working_hours",
|
||||
"name": "time_sheet"
|
||||
},
|
||||
}
|
||||
}))
|
||||
|
||||
set_missing_values(source_name, target)
|
||||
target.run_method("get_emp_and_leave_details")
|
||||
|
||||
return target
|
||||
|
||||
@@ -372,7 +372,7 @@
|
||||
"in_list_view": 0,
|
||||
"label": "Customer's Purchase Order",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "po_no",
|
||||
"oldfieldtype": "Data",
|
||||
"permlevel": 0,
|
||||
@@ -403,7 +403,7 @@
|
||||
"in_list_view": 0,
|
||||
"label": "Customer's Purchase Order Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "po_date",
|
||||
"oldfieldtype": "Date",
|
||||
"permlevel": 0,
|
||||
@@ -3226,7 +3226,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-11-03 16:07:46.757630",
|
||||
"modified": "2016-11-05 08:09:08.921026",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Order",
|
||||
|
||||
Reference in New Issue
Block a user