Merge branch 'develop' into multi_company

This commit is contained in:
Rucha Mahabal 2020-05-17 22:53:03 +05:30 committed by GitHub
commit 9e8414798c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 16 deletions

View File

@ -1,4 +1,5 @@
{
"actions": [],
"allow_events_in_timeline": 1,
"allow_import": 1,
"autoname": "naming_series:",
@ -447,7 +448,7 @@
"idx": 5,
"image_field": "image",
"links": [],
"modified": "2020-04-08 22:26:11.687110",
"modified": "2020-05-11 20:27:45.868960",
"modified_by": "Administrator",
"module": "CRM",
"name": "Lead",
@ -504,15 +505,6 @@
"read": 1,
"report": 1,
"role": "Sales User"
},
{
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Guest",
"share": 1
}
],
"search_fields": "lead_name,lead_owner,status",

View File

@ -21,7 +21,7 @@ class Attendance(Document):
date_of_joining = frappe.db.get_value("Employee", self.employee, "date_of_joining")
# leaves can be marked for future dates
if self.status not in ('On Leave', 'Half Day') and getdate(self.attendance_date) > getdate(nowdate()):
if self.status != 'On Leave' and not self.leave_application and getdate(self.attendance_date) > getdate(nowdate()):
frappe.throw(_("Attendance can not be marked for future dates"))
elif date_of_joining and getdate(self.attendance_date) < getdate(date_of_joining):
frappe.throw(_("Attendance date can not be less than employee's joining date"))
@ -41,7 +41,7 @@ class Attendance(Document):
leave_record = frappe.db.sql("""
select leave_type, half_day, half_day_date
from `tabLeave Application`
where employee = %s
where employee = %s
and %s between from_date and to_date
and status = 'Approved'
and docstatus = 1

View File

@ -363,6 +363,9 @@ class StockEntry(StockController):
+ self.work_order + ":" + ", ".join(other_ste), DuplicateEntryForWorkOrderError)
def set_incoming_rate(self):
if self.purpose == "Repack":
self.set_basic_rate_for_finished_goods()
for d in self.items:
if d.s_warehouse:
args = self.get_args_for_incoming_rate(d)
@ -475,20 +478,31 @@ class StockEntry(StockController):
"allow_zero_valuation": item.allow_zero_valuation_rate,
})
def set_basic_rate_for_finished_goods(self, raw_material_cost, scrap_material_cost):
def set_basic_rate_for_finished_goods(self, raw_material_cost=0, scrap_material_cost=0):
total_fg_qty = 0
if not raw_material_cost and self.get("items"):
raw_material_cost = sum([flt(row.basic_amount) for row in self.items
if row.s_warehouse and not row.t_warehouse])
total_fg_qty = sum([flt(row.qty) for row in self.items
if row.t_warehouse and not row.s_warehouse])
if self.purpose in ["Manufacture", "Repack"]:
for d in self.get("items"):
if (d.transfer_qty and (d.bom_no or d.t_warehouse)
and (getattr(self, "pro_doc", frappe._dict()).scrap_warehouse != d.t_warehouse)):
if self.work_order \
and frappe.db.get_single_value("Manufacturing Settings", "material_consumption"):
if (self.work_order and self.purpose == "Manufacture"
and frappe.db.get_single_value("Manufacturing Settings", "material_consumption")):
bom_items = self.get_bom_raw_materials(d.transfer_qty)
raw_material_cost = sum([flt(row.qty)*flt(row.rate) for row in bom_items.values()])
if raw_material_cost:
if raw_material_cost and self.purpose == "Manufacture":
d.basic_rate = flt((raw_material_cost - scrap_material_cost) / flt(d.transfer_qty), d.precision("basic_rate"))
d.basic_amount = flt((raw_material_cost - scrap_material_cost), d.precision("basic_amount"))
elif self.purpose == "Repack" and total_fg_qty:
d.basic_rate = flt(raw_material_cost) / flt(total_fg_qty)
d.basic_amount = d.basic_rate * d.qty
def distribute_additional_costs(self):
if self.purpose == "Material Issue":