Merge pull request #7842 from superlack/develop
Add Sales Orders to Project costing and billing section
This commit is contained in:
commit
258c8199fb
@ -1024,6 +1024,35 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "total_sales_cost",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Total Sales Cost (via Sales Order)",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"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,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -1232,4 +1261,4 @@
|
|||||||
"timeline_field": "customer",
|
"timeline_field": "customer",
|
||||||
"track_changes": 0,
|
"track_changes": 0,
|
||||||
"track_seen": 1
|
"track_seen": 1
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,13 @@ class Project(Document):
|
|||||||
from `tabPurchase Invoice Item` where project = %s and docstatus=1""", self.name)
|
from `tabPurchase Invoice Item` where project = %s and docstatus=1""", self.name)
|
||||||
|
|
||||||
self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
|
self.total_purchase_cost = total_purchase_cost and total_purchase_cost[0][0] or 0
|
||||||
|
|
||||||
|
def update_sales_costing(self):
|
||||||
|
total_sales_cost = frappe.db.sql("""select sum(grand_total)
|
||||||
|
from `tabSales Order` where project = %s and docstatus=1""", self.name)
|
||||||
|
|
||||||
|
self.total_sales_cost = total_sales_cost and total_sales_cost[0][0] or 0
|
||||||
|
|
||||||
|
|
||||||
def send_welcome_email(self):
|
def send_welcome_email(self):
|
||||||
url = get_url("/project/?name={0}".format(self.name))
|
url = get_url("/project/?name={0}".format(self.name))
|
||||||
|
@ -157,7 +157,7 @@ class SalesOrder(SellingController):
|
|||||||
self.update_reserved_qty()
|
self.update_reserved_qty()
|
||||||
|
|
||||||
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)
|
frappe.get_doc('Authorization Control').validate_approving_authority(self.doctype, self.company, self.base_grand_total, self)
|
||||||
|
self.update_project()
|
||||||
self.update_prevdoc_status('submit')
|
self.update_prevdoc_status('submit')
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
@ -167,10 +167,19 @@ class SalesOrder(SellingController):
|
|||||||
|
|
||||||
self.check_nextdoc_docstatus()
|
self.check_nextdoc_docstatus()
|
||||||
self.update_reserved_qty()
|
self.update_reserved_qty()
|
||||||
|
self.update_project()
|
||||||
self.update_prevdoc_status('cancel')
|
self.update_prevdoc_status('cancel')
|
||||||
|
|
||||||
frappe.db.set(self, 'status', 'Cancelled')
|
frappe.db.set(self, 'status', 'Cancelled')
|
||||||
|
|
||||||
|
def update_project(self):
|
||||||
|
project_list = []
|
||||||
|
if self.project:
|
||||||
|
project = frappe.get_doc("Project", self.project)
|
||||||
|
project.flags.dont_sync_tasks = True
|
||||||
|
project.update_sales_costing()
|
||||||
|
project.save()
|
||||||
|
project_list.append(self.project)
|
||||||
|
|
||||||
def check_credit_limit(self):
|
def check_credit_limit(self):
|
||||||
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
from erpnext.selling.doctype.customer.customer import check_credit_limit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user