fixed conflict

This commit is contained in:
Nabin Hait 2016-05-11 12:52:31 +05:30
commit b81ed45b2b
17 changed files with 119 additions and 49 deletions

View File

@ -1,2 +1,2 @@
from __future__ import unicode_literals from __future__ import unicode_literals
__version__ = '6.27.16' __version__ = '6.27.17'

View File

@ -34,6 +34,12 @@ frappe.query_reports["Item-wise Purchase Register"] = {
"fieldtype": "Link", "fieldtype": "Link",
"options": "Company", "options": "Company",
"default": frappe.defaults.get_user_default("Company") "default": frappe.defaults.get_user_default("Company")
},
{
"fieldname":"mode_of_payment",
"label": __("Mode of Payment"),
"fieldtype": "Link",
"options": "Mode of Payment"
} }
] ]
} }

View File

@ -35,7 +35,7 @@ def execute(filters=None):
expense_account = d.expense_account or aii_account_map.get(d.company) expense_account = d.expense_account or aii_account_map.get(d.company)
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier, row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.supplier,
d.supplier_name, d.credit_to, d.project, d.company, d.purchase_order, d.supplier_name, d.credit_to, d.mode_of_payment, d.project, d.company, d.purchase_order,
purchase_receipt, expense_account, d.qty, d.base_net_rate, d.base_net_amount] purchase_receipt, expense_account, d.qty, d.base_net_rate, d.base_net_amount]
for tax in tax_accounts: for tax in tax_accounts:
@ -53,7 +53,8 @@ def get_columns():
return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120",
_("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Purchase Invoice:120", _("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Purchase Invoice:120",
_("Posting Date") + ":Date:80", _("Supplier") + ":Link/Supplier:120", _("Posting Date") + ":Date:80", _("Supplier") + ":Link/Supplier:120",
"Supplier Name::120", "Payable Account:Link/Account:120", _("Project") + ":Link/Project:80", "Supplier Name::120", "Payable Account:Link/Account:120",
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
_("Company") + ":Link/Company:100", _("Purchase Order") + ":Link/Purchase Order:100", _("Company") + ":Link/Company:100", _("Purchase Order") + ":Link/Purchase Order:100",
_("Purchase Receipt") + ":Link/Purchase Receipt:100", _("Expense Account") + ":Link/Account:140", _("Purchase Receipt") + ":Link/Purchase Receipt:100", _("Expense Account") + ":Link/Account:140",
_("Qty") + ":Float:120", _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120" _("Qty") + ":Float:120", _("Rate") + ":Currency/currency:120", _("Amount") + ":Currency/currency:120"
@ -66,7 +67,8 @@ def get_conditions(filters):
("supplier", " and pi.supplier = %(supplier)s"), ("supplier", " and pi.supplier = %(supplier)s"),
("item_code", " and pi_item.item_code = %(item_code)s"), ("item_code", " and pi_item.item_code = %(item_code)s"),
("from_date", " and pi.posting_date>=%(from_date)s"), ("from_date", " and pi.posting_date>=%(from_date)s"),
("to_date", " and pi.posting_date<=%(to_date)s")): ("to_date", " and pi.posting_date<=%(to_date)s"),
("mode_of_payment", " and ifnull(mode_of_payment, '') = %(mode_of_payment)s")):
if filters.get(opts[0]): if filters.get(opts[0]):
conditions += opts[1] conditions += opts[1]
@ -82,7 +84,7 @@ def get_items(filters):
pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name, pi.supplier, pi.remarks, pi.base_net_total, pi_item.item_code, pi_item.item_name,
pi_item.item_group, pi_item.project, pi_item.purchase_order, pi_item.purchase_receipt, pi_item.item_group, pi_item.project, pi_item.purchase_order, pi_item.purchase_receipt,
pi_item.po_detail, pi_item.expense_account, pi_item.qty, pi_item.base_net_rate, pi_item.po_detail, pi_item.expense_account, pi_item.qty, pi_item.base_net_rate,
pi_item.base_net_amount, pi.supplier_name pi_item.base_net_amount, pi.supplier_name, pi.mode_of_payment
from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
where pi.name = pi_item.parent and pi.docstatus = 1 %s %s where pi.name = pi_item.parent and pi.docstatus = 1 %s %s
order by pi.posting_date desc, pi_item.item_code desc order by pi.posting_date desc, pi_item.item_code desc

View File

@ -28,6 +28,12 @@ frappe.query_reports["Item-wise Sales Register"] = frappe.query_reports["Sales R
"fieldtype": "Link", "fieldtype": "Link",
"options": "Company", "options": "Company",
"default": frappe.defaults.get_user_default("Company") "default": frappe.defaults.get_user_default("Company")
},
{
"fieldname":"mode_of_payment",
"label": __("Mode of Payment"),
"fieldtype": "Link",
"options": "Mode of Payment"
} }
] ]
} }

View File

@ -32,7 +32,7 @@ def execute(filters=None):
from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail)) from `tabDelivery Note Item` where docstatus=1 and so_detail=%s""", d.so_detail))
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name, row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date, d.customer, d.customer_name,
d.customer_group, d.debit_to, d.territory, d.project, d.company, d.sales_order, d.customer_group, d.debit_to, d.mode_of_payment, d.territory, d.project, d.company, d.sales_order,
delivery_note, d.income_account, d.qty, d.base_net_rate, d.base_net_amount] delivery_note, d.income_account, d.qty, d.base_net_rate, d.base_net_amount]
for tax in tax_accounts: for tax in tax_accounts:
@ -51,7 +51,8 @@ def get_columns():
_("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Sales Invoice:120", _("Item Group") + ":Link/Item Group:100", _("Invoice") + ":Link/Sales Invoice:120",
_("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120", _("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
_("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120", _("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120",
_("Receivable Account") + ":Link/Account:120", _("Territory") + ":Link/Territory:80", _("Receivable Account") + ":Link/Account:120",
_("Mode of Payment") + ":Link/Mode of Payment:80", _("Territory") + ":Link/Territory:80",
_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100", _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
_("Income Account") + ":Link/Account:140", _("Qty") + ":Float:120", _("Income Account") + ":Link/Account:140", _("Qty") + ":Float:120",
@ -65,7 +66,8 @@ def get_conditions(filters):
("customer", " and si.customer = %(customer)s"), ("customer", " and si.customer = %(customer)s"),
("item_code", " and si_item.item_code = %(item_code)s"), ("item_code", " and si_item.item_code = %(item_code)s"),
("from_date", " and si.posting_date>=%(from_date)s"), ("from_date", " and si.posting_date>=%(from_date)s"),
("to_date", " and si.posting_date<=%(to_date)s")): ("to_date", " and si.posting_date<=%(to_date)s"),
("mode_of_payment", " and ifnull(mode_of_payment, '') = %(mode_of_payment)s")):
if filters.get(opts[0]): if filters.get(opts[0]):
conditions += opts[1] conditions += opts[1]
@ -80,7 +82,7 @@ def get_items(filters):
si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order, si_item.item_code, si_item.item_name, si_item.item_group, si_item.sales_order,
si_item.delivery_note, si_item.income_account, si_item.qty, si_item.delivery_note, si_item.income_account, si_item.qty,
si_item.base_net_rate, si_item.base_net_amount, si.customer_name, si_item.base_net_rate, si_item.base_net_amount, si.customer_name,
si.customer_group, si_item.so_detail si.customer_group, si_item.so_detail, si.mode_of_payment
from `tabSales Invoice` si, `tabSales Invoice Item` si_item from `tabSales Invoice` si, `tabSales Invoice Item` si_item
where si.name = si_item.parent and si.docstatus = 1 %s where si.name = si_item.parent and si.docstatus = 1 %s
order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1) order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)

View File

@ -28,6 +28,12 @@ frappe.query_reports["Purchase Register"] = {
"fieldtype": "Link", "fieldtype": "Link",
"options": "Company", "options": "Company",
"default": frappe.defaults.get_user_default("Company") "default": frappe.defaults.get_user_default("Company")
},
{
"fieldname":"mode_of_payment",
"label": __("Mode of Payment"),
"fieldtype": "Link",
"options": "Mode of Payment"
} }
] ]
} }

View File

@ -33,7 +33,7 @@ def execute(filters=None):
row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name, row = [inv.name, inv.posting_date, inv.supplier, inv.supplier_name,
supplier_details.get(inv.supplier), supplier_details.get(inv.supplier),
inv.credit_to, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks, inv.credit_to, inv.mode_of_payment, ", ".join(project), inv.bill_no, inv.bill_date, inv.remarks,
", ".join(purchase_order), ", ".join(purchase_receipt), company_currency] ", ".join(purchase_order), ", ".join(purchase_receipt), company_currency]
# map expense values # map expense values
@ -64,10 +64,10 @@ def execute(filters=None):
def get_columns(invoice_list): def get_columns(invoice_list):
"""return columns based on filters""" """return columns based on filters"""
columns = [ columns = [
_("Invoice") + ":Link/Purchase Invoice:120", _("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80",
_("Posting Date") + ":Date:80", _("Supplier Id") + "::120", _("Supplier Id") + "::120", _("Supplier Name") + "::120",
_("Supplier Name") + "::120", _("Supplier Type") + ":Link/Supplier Type:120", _("Supplier Type") + ":Link/Supplier Type:120", _("Payable Account") + ":Link/Account:120",
_("Payable Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", _("Mode of Payment") + ":Link/Mode of Payment:80", _("Project") + ":Link/Project:80",
_("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150", _("Bill No") + "::120", _("Bill Date") + ":Date:80", _("Remarks") + "::150",
_("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Order") + ":Link/Purchase Order:100",
_("Purchase Receipt") + ":Link/Purchase Receipt:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100",
@ -114,6 +114,8 @@ def get_conditions(filters):
if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s" if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s" if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
if filters.get("mode_of_payment"): conditions += " and ifnull(mode_of_payment, '') = %(mode_of_payment)s"
return conditions return conditions
@ -121,8 +123,8 @@ def get_invoices(filters):
conditions = get_conditions(filters) conditions = get_conditions(filters)
return frappe.db.sql(""" return frappe.db.sql("""
select select
name, posting_date, credit_to, supplier, supplier_name, name, posting_date, credit_to, supplier, supplier_name, bill_no, bill_date, remarks,
bill_no, bill_date, remarks, base_net_total, base_grand_total, outstanding_amount base_net_total, base_grand_total, outstanding_amount, mode_of_payment
from `tabPurchase Invoice` from `tabPurchase Invoice`
where docstatus = 1 %s where docstatus = 1 %s
order by posting_date desc, name desc""" % conditions, filters, as_dict=1) order by posting_date desc, name desc""" % conditions, filters, as_dict=1)

View File

@ -28,6 +28,12 @@ frappe.query_reports["Sales Register"] = {
"fieldtype": "Link", "fieldtype": "Link",
"options": "Company", "options": "Company",
"default": frappe.defaults.get_user_default("Company") "default": frappe.defaults.get_user_default("Company")
},
{
"fieldname":"mode_of_payment",
"label": __("Mode of Payment"),
"fieldtype": "Link",
"options": "Mode of Payment"
} }
] ]
} }

View File

@ -33,7 +33,7 @@ def execute(filters=None):
row = [inv.name, inv.posting_date, inv.customer, inv.customer_name, row = [inv.name, inv.posting_date, inv.customer, inv.customer_name,
customer_map.get(inv.customer, {}).get("customer_group"), customer_map.get(inv.customer, {}).get("customer_group"),
customer_map.get(inv.customer, {}).get("territory"), customer_map.get(inv.customer, {}).get("territory"),
inv.debit_to, inv.project, inv.remarks, inv.debit_to, inv.mode_of_payment, inv.project, inv.remarks,
", ".join(sales_order), ", ".join(delivery_note), company_currency] ", ".join(sales_order), ", ".join(delivery_note), company_currency]
# map income values # map income values
@ -65,9 +65,11 @@ def execute(filters=None):
def get_columns(invoice_list): def get_columns(invoice_list):
"""return columns based on filters""" """return columns based on filters"""
columns = [ columns = [
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer Id") + "::120", _("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80",
_("Customer Name") + "::120", _("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80", _("Customer Id") + "::120", _("Customer Name") + "::120",
_("Receivable Account") + ":Link/Account:120", _("Project") +":Link/Project:80", _("Remarks") + "::150", _("Customer Group") + ":Link/Customer Group:120", _("Territory") + ":Link/Territory:80",
_("Receivable Account") + ":Link/Account:120", _("Mode of Payment") + ":Link/Mode of Payment:80",
_("Project") +":Link/Project:80", _("Remarks") + "::150",
_("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100", _("Sales Order") + ":Link/Sales Order:100", _("Delivery Note") + ":Link/Delivery Note:100",
{ {
"fieldname": "currency", "fieldname": "currency",
@ -110,13 +112,15 @@ def get_conditions(filters):
if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s" if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s"
if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s" if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s"
if filters.get("mode_of_payment"): conditions += " and ifnull(mode_of_payment, '') = %(mode_of_payment)s"
return conditions return conditions
def get_invoices(filters): def get_invoices(filters):
conditions = get_conditions(filters) conditions = get_conditions(filters)
return frappe.db.sql("""select name, posting_date, debit_to, project, customer, return frappe.db.sql("""select name, posting_date, debit_to, project, customer, customer_name, remarks,
customer_name, remarks, base_net_total, base_grand_total, base_rounded_total, outstanding_amount base_net_total, base_grand_total, base_rounded_total, outstanding_amount, mode_of_payment
from `tabSales Invoice` from `tabSales Invoice`
where docstatus = 1 %s order by posting_date desc, name desc""" % where docstatus = 1 %s order by posting_date desc, name desc""" %
conditions, filters, as_dict=1) conditions, filters, as_dict=1)

View File

@ -330,19 +330,23 @@ class BuyingController(StockController):
pr_qty = flt(d.qty) * flt(d.conversion_factor) pr_qty = flt(d.qty) * flt(d.conversion_factor)
if pr_qty: if pr_qty:
val_rate_db_precision = 6 if cint(self.precision("valuation_rate", d)) <= 6 else 9
rate = flt(d.valuation_rate, val_rate_db_precision)
sle = self.get_sl_entries(d, { sle = self.get_sl_entries(d, {
"actual_qty": flt(pr_qty), "actual_qty": flt(pr_qty),
"serial_no": cstr(d.serial_no).strip() "serial_no": cstr(d.serial_no).strip()
}) })
if self.is_return: if self.is_return:
original_incoming_rate = frappe.db.get_value("Stock Ledger Entry",
{"voucher_type": "Purchase Receipt", "voucher_no": self.return_against,
"item_code": d.item_code}, "incoming_rate")
sle.update({ sle.update({
"outgoing_rate": rate "outgoing_rate": original_incoming_rate
}) })
else: else:
val_rate_db_precision = 6 if cint(self.precision("valuation_rate", d)) <= 6 else 9
incoming_rate = flt(d.valuation_rate, val_rate_db_precision)
sle.update({ sle.update({
"incoming_rate": rate "incoming_rate": incoming_rate
}) })
sl_entries.append(sle) sl_entries.append(sle)

View File

@ -62,8 +62,8 @@ def validate_returned_items(doc):
if doc.doctype in ("Delivery Note", "Sales Invoice"): if doc.doctype in ("Delivery Note", "Sales Invoice"):
for d in frappe.db.sql("""select item_code, sum(qty) as qty, serial_no, batch_no from `tabPacked Item` for d in frappe.db.sql("""select item_code, qty, serial_no, batch_no from `tabPacked Item`
where parent = %s group by item_code""".format(doc.doctype), doc.return_against, as_dict=1): where parent = %s""".format(doc.doctype), doc.return_against, as_dict=1):
valid_items = get_ref_item_dict(valid_items, d) valid_items = get_ref_item_dict(valid_items, d)
already_returned_items = get_already_returned_items(doc) already_returned_items = get_already_returned_items(doc)

View File

@ -7,7 +7,7 @@ app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = """ERP made simple""" app_description = """ERP made simple"""
app_icon = "icon-th" app_icon = "icon-th"
app_color = "#e74c3c" app_color = "#e74c3c"
app_version = "6.27.16" app_version = "6.27.17"
app_email = "info@erpnext.com" app_email = "info@erpnext.com"
app_license = "GNU General Public License (v3)" app_license = "GNU General Public License (v3)"
source_link = "https://github.com/frappe/erpnext" source_link = "https://github.com/frappe/erpnext"

View File

@ -422,6 +422,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
"fieldname": "items_for_production", "fieldname": "items_for_production",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -524,7 +525,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.", "description": "",
"fieldname": "create_production_orders", "fieldname": "create_production_orders",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"hidden": 0, "hidden": 0,
@ -625,7 +626,32 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty", "fieldname": "create_material_requests_for_all_required_qty",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Create Material Requests for All Required Qty",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty, if \"Create Material Requests for All Required Qty\" is unchecked.",
"fieldname": "create_material_requests", "fieldname": "create_material_requests",
"fieldtype": "Button", "fieldtype": "Button",
"hidden": 0, "hidden": 0,
@ -683,7 +709,7 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2016-03-16 06:18:50.179089", "modified": "2016-05-10 12:55:45.647374",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Planning Tool", "name": "Production Planning Tool",

View File

@ -386,19 +386,24 @@ class ProductionPlanningTool(Document):
self.create_material_request() self.create_material_request()
def get_requested_items(self): def get_requested_items(self):
item_projected_qty = self.get_projected_qty()
items_to_be_requested = frappe._dict() items_to_be_requested = frappe._dict()
if not self.create_material_requests_for_all_required_qty:
item_projected_qty = self.get_projected_qty()
for item, so_item_qty in self.item_dict.items(): for item, so_item_qty in self.item_dict.items():
requested_qty = 0
total_qty = sum([flt(d[0]) for d in so_item_qty]) total_qty = sum([flt(d[0]) for d in so_item_qty])
if total_qty > item_projected_qty.get(item, 0): requested_qty = 0
if self.create_material_requests_for_all_required_qty:
requested_qty = total_qty
elif total_qty > item_projected_qty.get(item, 0):
# shortage # shortage
requested_qty = total_qty - flt(item_projected_qty.get(item)) requested_qty = total_qty - flt(item_projected_qty.get(item))
# consider minimum order qty # consider minimum order qty
if requested_qty < flt(so_item_qty[0][3]): if requested_qty and requested_qty < flt(so_item_qty[0][3]):
requested_qty = flt(so_item_qty[0][3]) requested_qty = flt(so_item_qty[0][3])
# distribute requested qty SO wise # distribute requested qty SO wise
for item_details in so_item_qty: for item_details in so_item_qty:

View File

@ -189,12 +189,9 @@ class PurchaseReceipt(BuyingController):
for d in self.get("items"): for d in self.get("items"):
if d.item_code in stock_items and flt(d.valuation_rate) and flt(d.qty): if d.item_code in stock_items and flt(d.valuation_rate) and flt(d.qty):
if warehouse_account.get(d.warehouse): if warehouse_account.get(d.warehouse):
stock_value_diff = frappe.db.get_value("Stock Ledger Entry",
val_rate_db_precision = 6 if cint(d.precision("valuation_rate")) <= 6 else 9 {"voucher_type": "Purchase Receipt", "voucher_no": self.name,
"voucher_detail_no": d.name}, "stock_value_difference")
# warehouse account
stock_value_diff = flt(flt(d.valuation_rate, val_rate_db_precision) * flt(d.qty)
* flt(d.conversion_factor), d.precision("base_net_amount"))
gl_entries.append(self.get_gl_dict({ gl_entries.append(self.get_gl_dict({
"account": warehouse_account[d.warehouse]["name"], "account": warehouse_account[d.warehouse]["name"],
@ -239,14 +236,20 @@ class PurchaseReceipt(BuyingController):
}, warehouse_account[self.supplier_warehouse]["account_currency"])) }, warehouse_account[self.supplier_warehouse]["account_currency"]))
# divisional loss adjustment # divisional loss adjustment
distributed_amount = flt(flt(d.base_net_amount, d.precision("base_net_amount"))) + \ valuation_amount_as_per_doc = flt(d.base_net_amount, d.precision("base_net_amount")) + \
flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost) + flt(d.item_tax_amount) flt(d.landed_cost_voucher_amount) + flt(d.rm_supp_cost) + flt(d.item_tax_amount)
divisional_loss = flt(distributed_amount - stock_value_diff, divisional_loss = flt(valuation_amount_as_per_doc - stock_value_diff,
d.precision("base_net_amount")) d.precision("base_net_amount"))
if divisional_loss: if divisional_loss:
if self.is_return or flt(d.item_tax_amount):
loss_account = expenses_included_in_valuation
else:
loss_account = stock_rbnb
gl_entries.append(self.get_gl_dict({ gl_entries.append(self.get_gl_dict({
"account": stock_rbnb, "account": loss_account,
"against": warehouse_account[d.warehouse]["name"], "against": warehouse_account[d.warehouse]["name"],
"cost_center": d.cost_center, "cost_center": d.cost_center,
"remarks": self.get("remarks") or _("Accounting Entry for Stock"), "remarks": self.get("remarks") or _("Accounting Entry for Stock"),

View File

@ -215,8 +215,6 @@ class update_entries_after(object):
stock_value_change = 0 stock_value_change = 0
if incoming_rate: if incoming_rate:
stock_value_change = actual_qty * incoming_rate stock_value_change = actual_qty * incoming_rate
elif flt(sle.outgoing_rate):
stock_value_change = actual_qty * flt(sle.outgoing_rate)
elif actual_qty < 0: elif actual_qty < 0:
# In case of delivery/stock issue, get average purchase rate # In case of delivery/stock issue, get average purchase rate
# of serial nos of current entry # of serial nos of current entry

View File

@ -1,7 +1,7 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
from pip.req import parse_requirements from pip.req import parse_requirements
version = "6.27.16" version = "6.27.17"
requirements = parse_requirements("requirements.txt", session="") requirements = parse_requirements("requirements.txt", session="")
setup( setup(