mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
Merge branch 'hotfix'
This commit is contained in:
@@ -23,9 +23,6 @@ script:
|
|||||||
- cd ~/frappe-bench
|
- cd ~/frappe-bench
|
||||||
- bench get-app erpnext $TRAVIS_BUILD_DIR
|
- bench get-app erpnext $TRAVIS_BUILD_DIR
|
||||||
- bench use test_site
|
- bench use test_site
|
||||||
- bench setup redis-cache
|
|
||||||
- bench setup redis-async-broker
|
|
||||||
- bench setup procfile --with-celery-broker
|
|
||||||
- bench reinstall
|
- bench reinstall
|
||||||
- bench build
|
- bench build
|
||||||
- bench build-website
|
- bench build-website
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
__version__ = '6.27.5'
|
__version__ = '6.27.6'
|
||||||
|
|||||||
@@ -353,25 +353,31 @@ class JournalEntry(AccountsController):
|
|||||||
self.remark = ("\n").join(r) #User Remarks is not mandatory
|
self.remark = ("\n").join(r) #User Remarks is not mandatory
|
||||||
|
|
||||||
def set_print_format_fields(self):
|
def set_print_format_fields(self):
|
||||||
total_amount = 0.0
|
bank_amount = party_amount = total_amount = 0.0
|
||||||
bank_account_currency = None
|
currency = bank_account_currency = party_account_currency = pay_to_recd_from= None
|
||||||
pay_to_recd_from = None
|
|
||||||
for d in self.get('accounts'):
|
for d in self.get('accounts'):
|
||||||
if d.party_type and d.party:
|
if d.party_type and d.party:
|
||||||
if not pay_to_recd_from:
|
if not pay_to_recd_from:
|
||||||
pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
|
pay_to_recd_from = frappe.db.get_value(d.party_type, d.party,
|
||||||
"customer_name" if d.party_type=="Customer" else "supplier_name")
|
"customer_name" if d.party_type=="Customer" else "supplier_name")
|
||||||
|
|
||||||
|
party_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
||||||
|
party_account_currency = d.account_currency
|
||||||
|
|
||||||
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
|
elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]:
|
||||||
total_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
bank_amount += (d.debit_in_account_currency or d.credit_in_account_currency)
|
||||||
bank_account_currency = d.account_currency
|
bank_account_currency = d.account_currency
|
||||||
|
|
||||||
if pay_to_recd_from:
|
if pay_to_recd_from:
|
||||||
self.pay_to_recd_from = pay_to_recd_from
|
self.pay_to_recd_from = pay_to_recd_from
|
||||||
else:
|
if bank_amount:
|
||||||
total_amount = 0
|
total_amount = bank_amount
|
||||||
|
currency = bank_account_currency
|
||||||
|
else:
|
||||||
|
total_amount = party_amount
|
||||||
|
currency = party_account_currency
|
||||||
|
|
||||||
self.set_total_amount(total_amount, bank_account_currency)
|
self.set_total_amount(total_amount, currency)
|
||||||
|
|
||||||
def set_total_amount(self, amt, currency):
|
def set_total_amount(self, amt, currency):
|
||||||
self.total_amount = amt
|
self.total_amount = amt
|
||||||
@@ -664,7 +670,7 @@ def get_payment_entry(ref_doc, args):
|
|||||||
bank_row.cost_center = cost_center
|
bank_row.cost_center = cost_center
|
||||||
|
|
||||||
amount = args.get("debit_in_account_currency") or args.get("amount")
|
amount = args.get("debit_in_account_currency") or args.get("amount")
|
||||||
|
|
||||||
if bank_row.account_currency == args.get("party_account_currency"):
|
if bank_row.account_currency == args.get("party_account_currency"):
|
||||||
bank_row.set(args.get("amount_field_bank"), amount)
|
bank_row.set(args.get("amount_field_bank"), amount)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ class SalesInvoice(SellingController):
|
|||||||
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
|
frappe.throw(_("Cash or Bank Account is mandatory for making payment entry"))
|
||||||
|
|
||||||
if flt(self.paid_amount) + flt(self.write_off_amount) \
|
if flt(self.paid_amount) + flt(self.write_off_amount) \
|
||||||
- flt(self.base_grand_total) > 1/(10**(self.precision("base_grand_total") + 1)):
|
- flt(self.grand_total) > 1/(10**(self.precision("grand_total") + 1)):
|
||||||
frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total"""))
|
frappe.throw(_("""Paid amount + Write Off Amount can not be greater than Grand Total"""))
|
||||||
|
|
||||||
|
|
||||||
@@ -471,7 +471,7 @@ class SalesInvoice(SellingController):
|
|||||||
frappe.db.set(self,'paid_amount',0)
|
frappe.db.set(self,'paid_amount',0)
|
||||||
|
|
||||||
frappe.db.set(self, 'base_paid_amount',
|
frappe.db.set(self, 'base_paid_amount',
|
||||||
flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount")))
|
flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount")))
|
||||||
|
|
||||||
def check_prev_docstatus(self):
|
def check_prev_docstatus(self):
|
||||||
for d in self.get('items'):
|
for d in self.get('items'):
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2015-11-02 12:32:02.048551",
|
"modified": "2016-04-04 17:27:19.104519",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Delivered Items To Be Billed",
|
"name": "Delivered Items To Be Billed",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabDelivery Note Item`.`qty` - ifnull((select sum(qty) from `tabSales Invoice Item` \n\t where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n\t `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Qty:Float:110\",\n\t(`tabDelivery Note Item`.`base_amount` - ifnull((select sum(base_amount) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\n\t\tas \"Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n (`tabDelivery Note Item`.qty > ifnull((select sum(qty) from `tabSales Invoice Item` \n where `tabSales Invoice Item`.docstatus=1 and \n `tabSales Invoice Item`.delivery_note = `tabDelivery Note`.name and\n `tabSales Invoice Item`.dn_detail = `tabDelivery Note Item`.name), 0))\norder by `tabDelivery Note`.`name` desc",
|
"query": "select\n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n\t`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n\t`tabDelivery Note`.`posting_date` as \"Date:Date\",\n\t`tabDelivery Note`.`project` as \"Project\",\n\t`tabDelivery Note Item`.`item_code` as \"Item:Link/Item:120\",\n\t`tabDelivery Note Item`.`billed_amt` as \"Pending Amount:Currency:110\",\n\t`tabDelivery Note Item`.`item_name` as \"Item Name::150\",\n\t`tabDelivery Note Item`.`description` as \"Description::200\",\n\t`tabDelivery Note`.`company` as \"Company:Link/Company:\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` not in (\"Stopped\", \"Closed\") and\n `tabDelivery Note`.name = `tabDelivery Note Item`.parent and\n `tabDelivery Note`.per_billed < 100\norder by `tabDelivery Note`.`name` desc",
|
||||||
"ref_doctype": "Sales Invoice",
|
"ref_doctype": "Sales Invoice",
|
||||||
"report_name": "Delivered Items To Be Billed",
|
"report_name": "Delivered Items To Be Billed",
|
||||||
"report_type": "Query Report"
|
"report_type": "Query Report"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2016-02-23 18:48:42.372321",
|
"modified": "2016-04-01 08:26:43.868609",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Ordered Items To Be Billed",
|
"name": "Ordered Items To Be Billed",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2016-02-23 18:51:21.968327",
|
"modified": "2016-04-01 08:27:32.122070",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Purchase Order Items To Be Billed",
|
"name": "Purchase Order Items To Be Billed",
|
||||||
|
|||||||
@@ -7,12 +7,12 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2015-11-02 12:33:11.681513",
|
"modified": "2016-04-04 17:27:29.449124",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Received Items To Be Billed",
|
"name": "Received Items To Be Billed",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t(`tabPurchase Receipt Item`.`qty` - ifnull((select sum(qty) from `tabPurchase Invoice Item` \n\t where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus = 1 and\n\t `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t as \"Qty:Float:110\",\n\t(`tabPurchase Receipt Item`.`base_amount` - ifnull((select sum(base_amount) \n from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus = 1 and\n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\n\t as \"Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.docstatus = 1 and `tabPurchase Receipt`.status != \"Closed\" and \n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n (`tabPurchase Receipt Item`.qty > ifnull((select sum(qty) from `tabPurchase Invoice Item` \n where `tabPurchase Invoice Item`.purchase_receipt = `tabPurchase Receipt`.name and\n `tabPurchase Invoice Item`.docstatus=1 and \n `tabPurchase Invoice Item`.pr_detail = `tabPurchase Receipt Item`.name), 0))\norder by `tabPurchase Receipt`.`name` desc",
|
"query": "select\n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Receipt`.`posting_date` as \"Date:Date\",\n\t`tabPurchase Receipt Item`.`project` as \"Project\",\n\t`tabPurchase Receipt Item`.`item_code` as \"Item:Link/Item:120\",\n\t`tabPurchase Receipt Item`.`billed_amt` as \"Pending Amount:Currency:110\",\n\t`tabPurchase Receipt Item`.`item_name` as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.`description` as \"Description::200\",\n\t`tabPurchase Receipt`.`company` as \"Company:Link/Company:\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.docstatus = 1 and `tabPurchase Receipt`.status != \"Closed\" and \n `tabPurchase Receipt`.name = `tabPurchase Receipt Item`.parent and\n `tabPurchase Receipt`.per_billed < 100\norder by `tabPurchase Receipt`.`name` desc",
|
||||||
"ref_doctype": "Purchase Invoice",
|
"ref_doctype": "Purchase Invoice",
|
||||||
"report_name": "Received Items To Be Billed",
|
"report_name": "Received Items To Be Billed",
|
||||||
"report_type": "Query Report"
|
"report_type": "Query Report"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2016-02-22 11:27:39.445257",
|
"modified": "2016-04-01 08:26:52.361800",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Item-wise Purchase History",
|
"name": "Item-wise Purchase History",
|
||||||
|
|||||||
@@ -184,8 +184,8 @@ def item_query(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
idx desc,
|
idx desc,
|
||||||
name, item_name
|
name, item_name
|
||||||
limit %(start)s, %(page_len)s """.format(key=searchfield,
|
limit %(start)s, %(page_len)s """.format(key=searchfield,
|
||||||
fcond=get_filters_cond(doctype, filters, conditions),
|
fcond=get_filters_cond(doctype, filters, conditions).replace('%', '%%'),
|
||||||
mcond=get_match_cond(doctype)),
|
mcond=get_match_cond(doctype).replace('%', '%%')),
|
||||||
{
|
{
|
||||||
"today": nowdate(),
|
"today": nowdate(),
|
||||||
"txt": "%%%s%%" % txt,
|
"txt": "%%%s%%" % txt,
|
||||||
|
|||||||
@@ -283,8 +283,8 @@ class calculate_taxes_and_totals(object):
|
|||||||
last_tax.tax_amount += diff
|
last_tax.tax_amount += diff
|
||||||
last_tax.tax_amount_after_discount_amount += diff
|
last_tax.tax_amount_after_discount_amount += diff
|
||||||
last_tax.total += diff
|
last_tax.total += diff
|
||||||
|
|
||||||
self._set_in_company_currency(last_tax,
|
self._set_in_company_currency(last_tax,
|
||||||
["total", "tax_amount", "tax_amount_after_discount_amount"])
|
["total", "tax_amount", "tax_amount_after_discount_amount"])
|
||||||
|
|
||||||
def calculate_totals(self):
|
def calculate_totals(self):
|
||||||
@@ -319,22 +319,22 @@ class calculate_taxes_and_totals(object):
|
|||||||
self.doc.round_floats_in(self.doc, ["grand_total", "base_grand_total"])
|
self.doc.round_floats_in(self.doc, ["grand_total", "base_grand_total"])
|
||||||
|
|
||||||
if self.doc.meta.get_field("rounded_total"):
|
if self.doc.meta.get_field("rounded_total"):
|
||||||
self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total,
|
self.doc.rounded_total = round_based_on_smallest_currency_fraction(self.doc.grand_total,
|
||||||
self.doc.currency, self.doc.precision("rounded_total"))
|
self.doc.currency, self.doc.precision("rounded_total"))
|
||||||
if self.doc.meta.get_field("base_rounded_total"):
|
if self.doc.meta.get_field("base_rounded_total"):
|
||||||
company_currency = get_company_currency(self.doc.company)
|
company_currency = get_company_currency(self.doc.company)
|
||||||
|
|
||||||
self.doc.base_rounded_total = \
|
self.doc.base_rounded_total = \
|
||||||
round_based_on_smallest_currency_fraction(self.doc.base_grand_total,
|
round_based_on_smallest_currency_fraction(self.doc.base_grand_total,
|
||||||
company_currency, self.doc.precision("base_rounded_total"))
|
company_currency, self.doc.precision("base_rounded_total"))
|
||||||
|
|
||||||
def _cleanup(self):
|
def _cleanup(self):
|
||||||
for tax in self.doc.get("taxes"):
|
for tax in self.doc.get("taxes"):
|
||||||
tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':'))
|
tax.item_wise_tax_detail = json.dumps(tax.item_wise_tax_detail, separators=(',', ':'))
|
||||||
|
|
||||||
def set_discount_amount(self):
|
def set_discount_amount(self):
|
||||||
if not self.doc.discount_amount and self.doc.additional_discount_percentage:
|
if not self.doc.discount_amount and self.doc.additional_discount_percentage:
|
||||||
self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on)))
|
self.doc.discount_amount = flt(flt(self.doc.get(scrub(self.doc.apply_discount_on)))
|
||||||
* self.doc.additional_discount_percentage / 100, self.doc.precision("discount_amount"))
|
* self.doc.additional_discount_percentage / 100, self.doc.precision("discount_amount"))
|
||||||
|
|
||||||
def apply_discount_amount(self):
|
def apply_discount_amount(self):
|
||||||
@@ -397,13 +397,13 @@ class calculate_taxes_and_totals(object):
|
|||||||
for adv in self.doc.get("advances")])
|
for adv in self.doc.get("advances")])
|
||||||
|
|
||||||
self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance"))
|
self.doc.total_advance = flt(total_allocated_amount, self.doc.precision("total_advance"))
|
||||||
|
|
||||||
if self.doc.party_account_currency == self.doc.currency:
|
if self.doc.party_account_currency == self.doc.currency:
|
||||||
invoice_total = self.doc.grand_total
|
invoice_total = self.doc.grand_total
|
||||||
else:
|
else:
|
||||||
invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
|
invoice_total = flt(self.doc.grand_total * self.doc.conversion_rate,
|
||||||
self.doc.precision("grand_total"))
|
self.doc.precision("grand_total"))
|
||||||
|
|
||||||
if invoice_total > 0 and self.doc.total_advance > invoice_total:
|
if invoice_total > 0 and self.doc.total_advance > invoice_total:
|
||||||
frappe.throw(_("Advance amount cannot be greater than {0} {1}")
|
frappe.throw(_("Advance amount cannot be greater than {0} {1}")
|
||||||
.format(self.doc.party_account_currency, invoice_total))
|
.format(self.doc.party_account_currency, invoice_total))
|
||||||
@@ -417,21 +417,23 @@ class calculate_taxes_and_totals(object):
|
|||||||
# total_advance is only for non POS Invoice
|
# total_advance is only for non POS Invoice
|
||||||
if self.doc.is_return:
|
if self.doc.is_return:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.doc.round_floats_in(self.doc, ["grand_total", "total_advance", "write_off_amount"])
|
self.doc.round_floats_in(self.doc, ["grand_total", "total_advance", "write_off_amount"])
|
||||||
|
self._set_in_company_currency(self.doc, ['write_off_amount'])
|
||||||
|
|
||||||
if self.doc.party_account_currency == self.doc.currency:
|
if self.doc.party_account_currency == self.doc.currency:
|
||||||
total_amount_to_pay = flt(self.doc.grand_total - self.doc.total_advance
|
total_amount_to_pay = flt(self.doc.grand_total - self.doc.total_advance
|
||||||
- flt(self.doc.write_off_amount), self.doc.precision("grand_total"))
|
- flt(self.doc.write_off_amount), self.doc.precision("grand_total"))
|
||||||
else:
|
else:
|
||||||
total_amount_to_pay = flt(flt(self.doc.grand_total *
|
total_amount_to_pay = flt(flt(self.doc.grand_total *
|
||||||
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
|
self.doc.conversion_rate, self.doc.precision("grand_total")) - self.doc.total_advance
|
||||||
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
|
- flt(self.doc.base_write_off_amount), self.doc.precision("grand_total"))
|
||||||
|
|
||||||
if self.doc.doctype == "Sales Invoice":
|
if self.doc.doctype == "Sales Invoice":
|
||||||
self.doc.round_floats_in(self.doc, ["paid_amount"])
|
self.doc.round_floats_in(self.doc, ["paid_amount"])
|
||||||
paid_amount = self.doc.paid_amount \
|
paid_amount = self.doc.paid_amount \
|
||||||
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
if self.doc.party_account_currency == self.doc.currency else self.doc.base_paid_amount
|
||||||
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount),
|
self.doc.outstanding_amount = flt(total_amount_to_pay - flt(paid_amount),
|
||||||
self.doc.precision("outstanding_amount"))
|
self.doc.precision("outstanding_amount"))
|
||||||
elif self.doc.doctype == "Purchase Invoice":
|
elif self.doc.doctype == "Purchase Invoice":
|
||||||
self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
|
self.doc.outstanding_amount = flt(total_amount_to_pay, self.doc.precision("outstanding_amount"))
|
||||||
|
|||||||
@@ -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.5"
|
app_version = "6.27.6"
|
||||||
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"
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class ProductionPlanningTool(Document):
|
|||||||
pp_so.sales_order_date = cstr(r['transaction_date'])
|
pp_so.sales_order_date = cstr(r['transaction_date'])
|
||||||
pp_so.customer = cstr(r['customer'])
|
pp_so.customer = cstr(r['customer'])
|
||||||
pp_so.grand_total = flt(r['base_grand_total'])
|
pp_so.grand_total = flt(r['base_grand_total'])
|
||||||
|
|
||||||
def get_pending_material_requests(self):
|
def get_pending_material_requests(self):
|
||||||
""" Pull Material Requests that are pending based on criteria selected"""
|
""" Pull Material Requests that are pending based on criteria selected"""
|
||||||
mr_filter = item_filter = ""
|
mr_filter = item_filter = ""
|
||||||
@@ -81,7 +81,7 @@ class ProductionPlanningTool(Document):
|
|||||||
mr_filter += " and mr.transaction_date <= %(to_date)s"
|
mr_filter += " and mr.transaction_date <= %(to_date)s"
|
||||||
if self.warehouse:
|
if self.warehouse:
|
||||||
mr_filter += " and mr_item.warehouse = %(warehouse)s"
|
mr_filter += " and mr_item.warehouse = %(warehouse)s"
|
||||||
|
|
||||||
if self.fg_item:
|
if self.fg_item:
|
||||||
item_filter += " and item.name = %(item)s"
|
item_filter += " and item.name = %(item)s"
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@ class ProductionPlanningTool(Document):
|
|||||||
}, as_dict=1)
|
}, as_dict=1)
|
||||||
|
|
||||||
self.add_mr_in_table(pending_mr)
|
self.add_mr_in_table(pending_mr)
|
||||||
|
|
||||||
def add_mr_in_table(self, pending_mr):
|
def add_mr_in_table(self, pending_mr):
|
||||||
""" Add Material Requests in the table"""
|
""" Add Material Requests in the table"""
|
||||||
self.clear_table("material_requests")
|
self.clear_table("material_requests")
|
||||||
@@ -119,7 +119,7 @@ class ProductionPlanningTool(Document):
|
|||||||
self.get_so_items()
|
self.get_so_items()
|
||||||
elif self.get_items_from == "Material Request":
|
elif self.get_items_from == "Material Request":
|
||||||
self.get_mr_items()
|
self.get_mr_items()
|
||||||
|
|
||||||
def get_so_items(self):
|
def get_so_items(self):
|
||||||
so_list = [d.sales_order for d in self.get('sales_orders') if d.sales_order]
|
so_list = [d.sales_order for d in self.get('sales_orders') if d.sales_order]
|
||||||
if not so_list:
|
if not so_list:
|
||||||
@@ -128,7 +128,7 @@ class ProductionPlanningTool(Document):
|
|||||||
|
|
||||||
item_condition = ""
|
item_condition = ""
|
||||||
if self.fg_item:
|
if self.fg_item:
|
||||||
item_condition = ' and so_item.item_code = "' + self.fg_item + '"'
|
item_condition = ' and so_item.item_code = "{0}"'.format(frappe.db.escape(self.fg_item))
|
||||||
|
|
||||||
items = frappe.db.sql("""select distinct parent, item_code, warehouse,
|
items = frappe.db.sql("""select distinct parent, item_code, warehouse,
|
||||||
(qty - delivered_qty) as pending_qty
|
(qty - delivered_qty) as pending_qty
|
||||||
@@ -139,7 +139,7 @@ class ProductionPlanningTool(Document):
|
|||||||
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
||||||
|
|
||||||
if self.fg_item:
|
if self.fg_item:
|
||||||
item_condition = ' and pi.item_code = "' + self.fg_item + '"'
|
item_condition = ' and pi.item_code = "{0}"'.format(frappe.db.escape(self.fg_item))
|
||||||
|
|
||||||
packed_items = frappe.db.sql("""select distinct pi.parent, pi.item_code, pi.warehouse as warehouse,
|
packed_items = frappe.db.sql("""select distinct pi.parent, pi.item_code, pi.warehouse as warehouse,
|
||||||
(((so_item.qty - so_item.delivered_qty) * pi.qty) / so_item.qty)
|
(((so_item.qty - so_item.delivered_qty) * pi.qty) / so_item.qty)
|
||||||
@@ -153,7 +153,7 @@ class ProductionPlanningTool(Document):
|
|||||||
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
||||||
|
|
||||||
self.add_items(items + packed_items)
|
self.add_items(items + packed_items)
|
||||||
|
|
||||||
def get_mr_items(self):
|
def get_mr_items(self):
|
||||||
mr_list = [d.material_request for d in self.get('material_requests') if d.material_request]
|
mr_list = [d.material_request for d in self.get('material_requests') if d.material_request]
|
||||||
if not mr_list:
|
if not mr_list:
|
||||||
@@ -173,7 +173,7 @@ class ProductionPlanningTool(Document):
|
|||||||
(", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
|
(", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
|
||||||
|
|
||||||
self.add_items(items)
|
self.add_items(items)
|
||||||
|
|
||||||
|
|
||||||
def add_items(self, items):
|
def add_items(self, items):
|
||||||
self.clear_table("items")
|
self.clear_table("items")
|
||||||
@@ -187,13 +187,13 @@ class ProductionPlanningTool(Document):
|
|||||||
pi.bom_no = item_details and item_details.bom_no or ''
|
pi.bom_no = item_details and item_details.bom_no or ''
|
||||||
pi.planned_qty = flt(p['pending_qty'])
|
pi.planned_qty = flt(p['pending_qty'])
|
||||||
pi.pending_qty = flt(p['pending_qty'])
|
pi.pending_qty = flt(p['pending_qty'])
|
||||||
|
|
||||||
if self.get_items_from == "Sales Order":
|
if self.get_items_from == "Sales Order":
|
||||||
pi.sales_order = p['parent']
|
pi.sales_order = p['parent']
|
||||||
elif self.get_items_from == "Material Request":
|
elif self.get_items_from == "Material Request":
|
||||||
pi.material_request = p['parent']
|
pi.material_request = p['parent']
|
||||||
pi.material_request_item = p['name']
|
pi.material_request_item = p['name']
|
||||||
|
|
||||||
def validate_data(self):
|
def validate_data(self):
|
||||||
self.validate_company()
|
self.validate_company()
|
||||||
for d in self.get('items'):
|
for d in self.get('items'):
|
||||||
@@ -201,7 +201,7 @@ class ProductionPlanningTool(Document):
|
|||||||
frappe.throw(_("Please select BOM for Item in Row {0}".format(d.idx)))
|
frappe.throw(_("Please select BOM for Item in Row {0}".format(d.idx)))
|
||||||
else:
|
else:
|
||||||
validate_bom_no(d.item_code, d.bom_no)
|
validate_bom_no(d.item_code, d.bom_no)
|
||||||
|
|
||||||
if not flt(d.planned_qty):
|
if not flt(d.planned_qty):
|
||||||
frappe.throw(_("Please enter Planned Qty for Item {0} at row {1}").format(d.item_code, d.idx))
|
frappe.throw(_("Please enter Planned Qty for Item {0} at row {1}").format(d.item_code, d.idx))
|
||||||
|
|
||||||
@@ -213,17 +213,17 @@ class ProductionPlanningTool(Document):
|
|||||||
validate_uom_is_integer(self, "stock_uom", "planned_qty")
|
validate_uom_is_integer(self, "stock_uom", "planned_qty")
|
||||||
|
|
||||||
items = self.get_production_items()
|
items = self.get_production_items()
|
||||||
|
|
||||||
pro_list = []
|
pro_list = []
|
||||||
frappe.flags.mute_messages = True
|
frappe.flags.mute_messages = True
|
||||||
|
|
||||||
for key in items:
|
for key in items:
|
||||||
production_order = self.create_production_order(items[key])
|
production_order = self.create_production_order(items[key])
|
||||||
if production_order:
|
if production_order:
|
||||||
pro_list.append(production_order)
|
pro_list.append(production_order)
|
||||||
|
|
||||||
frappe.flags.mute_messages = False
|
frappe.flags.mute_messages = False
|
||||||
|
|
||||||
if pro_list:
|
if pro_list:
|
||||||
pro_list = ["""<a href="#Form/Production Order/%s" target="_blank">%s</a>""" % \
|
pro_list = ["""<a href="#Form/Production Order/%s" target="_blank">%s</a>""" % \
|
||||||
(p, p) for p in pro_list]
|
(p, p) for p in pro_list]
|
||||||
@@ -247,14 +247,14 @@ class ProductionPlanningTool(Document):
|
|||||||
"fg_warehouse" : d.warehouse,
|
"fg_warehouse" : d.warehouse,
|
||||||
"status" : "Draft",
|
"status" : "Draft",
|
||||||
}
|
}
|
||||||
|
|
||||||
""" Club similar BOM and item for processing in case of Sales Orders """
|
""" Club similar BOM and item for processing in case of Sales Orders """
|
||||||
if self.get_items_from == "Material Request":
|
if self.get_items_from == "Material Request":
|
||||||
item_details.update({
|
item_details.update({
|
||||||
"qty": d.planned_qty
|
"qty": d.planned_qty
|
||||||
})
|
})
|
||||||
item_dict[(d.item_code, d.material_request_item, d.warehouse)] = item_details
|
item_dict[(d.item_code, d.material_request_item, d.warehouse)] = item_details
|
||||||
|
|
||||||
else:
|
else:
|
||||||
item_details.update({
|
item_details.update({
|
||||||
"qty":flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),{})
|
"qty":flt(item_dict.get((d.item_code, d.sales_order, d.warehouse),{})
|
||||||
@@ -275,7 +275,7 @@ class ProductionPlanningTool(Document):
|
|||||||
pro.wip_warehouse = warehouse.get('wip_warehouse')
|
pro.wip_warehouse = warehouse.get('wip_warehouse')
|
||||||
if not pro.fg_warehouse:
|
if not pro.fg_warehouse:
|
||||||
pro.fg_warehouse = warehouse.get('fg_warehouse')
|
pro.fg_warehouse = warehouse.get('fg_warehouse')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pro.insert()
|
pro.insert()
|
||||||
return pro.name
|
return pro.name
|
||||||
@@ -283,7 +283,7 @@ class ProductionPlanningTool(Document):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def get_so_wise_planned_qty(self):
|
def get_so_wise_planned_qty(self):
|
||||||
"""
|
"""
|
||||||
bom_dict {
|
bom_dict {
|
||||||
bom_no: ['sales_order', 'qty']
|
bom_no: ['sales_order', 'qty']
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,7 @@ class ProductionPlanningTool(Document):
|
|||||||
else:
|
else:
|
||||||
bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)])
|
bom_dict.setdefault(d.bom_no, []).append([d.sales_order, flt(d.planned_qty)])
|
||||||
return bom_dict
|
return bom_dict
|
||||||
|
|
||||||
def download_raw_materials(self):
|
def download_raw_materials(self):
|
||||||
""" Create csv data for required raw material to produce finished goods"""
|
""" Create csv data for required raw material to produce finished goods"""
|
||||||
self.validate_data()
|
self.validate_data()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2016-01-28 14:59:04.611174",
|
"modified": "2016-04-01 08:26:55.705992",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
"name": "Item-wise Sales History",
|
"name": "Item-wise Sales History",
|
||||||
@@ -16,4 +16,4 @@
|
|||||||
"ref_doctype": "Sales Order",
|
"ref_doctype": "Sales Order",
|
||||||
"report_name": "Item-wise Sales History",
|
"report_name": "Item-wise Sales History",
|
||||||
"report_type": "Query Report"
|
"report_type": "Query Report"
|
||||||
}
|
}
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
{
|
{
|
||||||
"apply_user_permissions": 1,
|
"add_total_row": 0,
|
||||||
"creation": "2013-08-20 15:08:10",
|
"apply_user_permissions": 1,
|
||||||
"docstatus": 0,
|
"creation": "2013-08-20 15:08:10",
|
||||||
"doctype": "Report",
|
"disabled": 0,
|
||||||
"idx": 1,
|
"docstatus": 0,
|
||||||
"is_standard": "Yes",
|
"doctype": "Report",
|
||||||
"modified": "2014-06-03 07:18:17.128918",
|
"idx": 1,
|
||||||
"modified_by": "Administrator",
|
"is_standard": "Yes",
|
||||||
"module": "Stock",
|
"modified": "2016-04-01 08:27:14.436178",
|
||||||
"name": "Items To Be Requested",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator",
|
"module": "Stock",
|
||||||
|
"name": "Items To Be Requested",
|
||||||
|
"owner": "Administrator",
|
||||||
"query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabItem.is_purchase_item = 1\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC",
|
"query": "SELECT\n tabBin.item_code as \"Item:Link/Item:120\",\n tabBin.warehouse as \"Warehouse:Link/Warehouse:120\",\n tabBin.actual_qty as \"Actual:Float:90\",\n tabBin.indented_qty as \"Requested:Float:90\",\n tabBin.reserved_qty as \"Reserved:Float:90\",\n tabBin.ordered_qty as \"Ordered:Float:90\",\n tabBin.projected_qty as \"Projected:Float:90\"\nFROM\n tabBin, tabItem\nWHERE\n tabBin.item_code = tabItem.name\n AND tabItem.is_purchase_item = 1\n AND tabBin.projected_qty < 0\nORDER BY\n tabBin.projected_qty ASC",
|
||||||
"ref_doctype": "Item",
|
"ref_doctype": "Item",
|
||||||
"report_name": "Items To Be Requested",
|
"report_name": "Items To Be Requested",
|
||||||
"report_type": "Query Report"
|
"report_type": "Query Report"
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2015-11-04 12:00:40.085130",
|
"modified": "2016-04-01 08:27:03.318987",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Ordered Items To Be Delivered",
|
"name": "Ordered Items To Be Delivered",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"doctype": "Report",
|
"doctype": "Report",
|
||||||
"idx": 1,
|
"idx": 1,
|
||||||
"is_standard": "Yes",
|
"is_standard": "Yes",
|
||||||
"modified": "2015-11-04 12:01:22.108641",
|
"modified": "2016-04-01 08:26:59.904034",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Purchase Order Items To Be Received",
|
"name": "Purchase Order Items To Be Received",
|
||||||
|
|||||||
@@ -85,13 +85,18 @@ cur_frm.add_fetch('item_code', 'description', 'description');
|
|||||||
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
||||||
if(doc.serial_no) {
|
if(doc.serial_no) {
|
||||||
return{
|
return{
|
||||||
filters:{ 'serial_no': doc.serial_no}
|
doctype: "Serial No",
|
||||||
|
fields: "item_code",
|
||||||
|
filters:{
|
||||||
|
name: doc.serial_no
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
return{
|
return{
|
||||||
filters:[
|
filters:[
|
||||||
['Item', 'docstatus', '!=', 2]
|
['Item', 'docstatus', '!=', 2],
|
||||||
|
['Item', 'disabled', '=', 0]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -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.5"
|
version = "6.27.6"
|
||||||
requirements = parse_requirements("requirements.txt", session="")
|
requirements = parse_requirements("requirements.txt", session="")
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
|
|||||||
Reference in New Issue
Block a user