mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 10:49:09 +00:00
Merge branch 'version-12-hotfix' into batch-source-reference
This commit is contained in:
@@ -14,7 +14,7 @@ import frappe, erpnext
|
|||||||
from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency
|
from erpnext.accounts.report.utils import get_currency, convert_to_presentation_currency
|
||||||
from erpnext.accounts.utils import get_fiscal_year
|
from erpnext.accounts.utils import get_fiscal_year
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import (flt, getdate, get_first_day, add_months, add_days, formatdate, cstr)
|
from frappe.utils import (flt, getdate, get_first_day, add_months, add_days, formatdate, cstr, cint)
|
||||||
|
|
||||||
from six import itervalues
|
from six import itervalues
|
||||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
|
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import get_accounting_dimensions, get_dimension_with_children
|
||||||
@@ -43,7 +43,7 @@ def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, accumulated_v
|
|||||||
start_date = year_start_date
|
start_date = year_start_date
|
||||||
months = get_months(year_start_date, year_end_date)
|
months = get_months(year_start_date, year_end_date)
|
||||||
|
|
||||||
for i in range(math.ceil(months / months_to_add)):
|
for i in range(cint(math.ceil(months / months_to_add))):
|
||||||
period = frappe._dict({
|
period = frappe._dict({
|
||||||
"from_date": start_date
|
"from_date": start_date
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ def _execute(filters=None):
|
|||||||
|
|
||||||
data.append(row)
|
data.append(row)
|
||||||
added_item.append((d.parent, d.item_code))
|
added_item.append((d.parent, d.item_code))
|
||||||
|
# gst is already added, just add qty and taxable value
|
||||||
|
else:
|
||||||
|
row = [d.gst_hsn_code, d.description, d.stock_uom, d.stock_qty, d.base_net_amount, d.base_net_amount]
|
||||||
|
for tax in tax_columns:
|
||||||
|
row += [0]
|
||||||
|
data.append(row)
|
||||||
if data:
|
if data:
|
||||||
data = get_merged_data(columns, data) # merge same hsn code data
|
data = get_merged_data(columns, data) # merge same hsn code data
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
import json
|
import json
|
||||||
import frappe.utils
|
import frappe.utils
|
||||||
from frappe.utils import cstr, flt, getdate, cint, nowdate, add_days, get_link_to_form
|
from frappe.utils import cstr, flt, getdate, cint, nowdate, add_days, get_link_to_form, strip_html
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from six import string_types
|
from six import string_types
|
||||||
from frappe.model.utils import get_fetch_values
|
from frappe.model.utils import get_fetch_values
|
||||||
@@ -994,15 +994,20 @@ def make_raw_material_request(items, company, sales_order, project=None):
|
|||||||
))
|
))
|
||||||
for item in raw_materials:
|
for item in raw_materials:
|
||||||
item_doc = frappe.get_cached_doc('Item', item.get('item_code'))
|
item_doc = frappe.get_cached_doc('Item', item.get('item_code'))
|
||||||
|
|
||||||
schedule_date = add_days(nowdate(), cint(item_doc.lead_time_days))
|
schedule_date = add_days(nowdate(), cint(item_doc.lead_time_days))
|
||||||
material_request.append('items', {
|
row = material_request.append('items', {
|
||||||
'item_code': item.get('item_code'),
|
'item_code': item.get('item_code'),
|
||||||
'qty': item.get('quantity'),
|
'qty': item.get('quantity'),
|
||||||
'schedule_date': schedule_date,
|
'schedule_date': schedule_date,
|
||||||
'warehouse': item.get('warehouse'),
|
'warehouse': item.get('warehouse'),
|
||||||
'sales_order': sales_order,
|
'sales_order': sales_order,
|
||||||
'project': project
|
'project': project
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if not (strip_html(item.get("description")) and strip_html(item_doc.description)):
|
||||||
|
row.description = item_doc.item_name or item.get('item_code')
|
||||||
|
|
||||||
material_request.insert()
|
material_request.insert()
|
||||||
material_request.flags.ignore_permissions = 1
|
material_request.flags.ignore_permissions = 1
|
||||||
material_request.run_method("set_missing_values")
|
material_request.run_method("set_missing_values")
|
||||||
|
|||||||
@@ -500,7 +500,7 @@ class StockEntry(StockController):
|
|||||||
d.basic_amount = flt((raw_material_cost - scrap_material_cost), d.precision("basic_amount"))
|
d.basic_amount = flt((raw_material_cost - scrap_material_cost), d.precision("basic_amount"))
|
||||||
elif self.purpose == "Repack" and total_fg_qty and not d.set_basic_rate_manually:
|
elif self.purpose == "Repack" and total_fg_qty and not d.set_basic_rate_manually:
|
||||||
d.basic_rate = flt(raw_material_cost) / flt(total_fg_qty)
|
d.basic_rate = flt(raw_material_cost) / flt(total_fg_qty)
|
||||||
d.basic_amount = d.basic_rate * d.qty
|
d.basic_amount = d.basic_rate * flt(d.qty)
|
||||||
|
|
||||||
def distribute_additional_costs(self):
|
def distribute_additional_costs(self):
|
||||||
if self.purpose == "Material Issue":
|
if self.purpose == "Material Issue":
|
||||||
|
|||||||
Reference in New Issue
Block a user