Compare commits
183 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f7621c40d | ||
|
|
b17f056f8d | ||
|
|
31f6c984f0 | ||
|
|
3ee5db123f | ||
|
|
3c3855ac8c | ||
|
|
3b8682f534 | ||
|
|
dbb3b49625 | ||
|
|
b78ab03b2b | ||
|
|
92b253dceb | ||
|
|
1b26c6f02a | ||
|
|
0287b1f75c | ||
|
|
e19578bac1 | ||
|
|
e7eb92ce70 | ||
|
|
6ae352bf12 | ||
|
|
4743cbe002 | ||
|
|
f6215c7740 | ||
|
|
2ba88c4a5f | ||
|
|
1a6299176a | ||
|
|
2029ea9abf | ||
|
|
5ecceb55fe | ||
|
|
c3daa91c8a | ||
|
|
68dfc934bf | ||
|
|
9490d9dee3 | ||
|
|
c95e4e89d5 | ||
|
|
b362bb076d | ||
|
|
031b1251cf | ||
|
|
4642d0697e | ||
|
|
4f0231e34b | ||
|
|
0277ae298a | ||
|
|
6eb55d4d3d | ||
|
|
1b41b50a95 | ||
|
|
31dce7fa49 | ||
|
|
a4fa96cc79 | ||
|
|
6208c49859 | ||
|
|
52e8c3d42b | ||
|
|
10224c9d86 | ||
|
|
abfe09b8ee | ||
|
|
54c865e77c | ||
|
|
712440c045 | ||
|
|
7057970c0c | ||
|
|
c7402e2989 | ||
|
|
e07e5bbe00 | ||
|
|
04069bbc00 | ||
|
|
63e00dcfd2 | ||
|
|
2ed71bac20 | ||
|
|
5601d9fbda | ||
|
|
7b4b31fdf7 | ||
|
|
ec25117ab0 | ||
|
|
dfa013e73f | ||
|
|
f2791f8898 | ||
|
|
66773229a4 | ||
|
|
ead48094b6 | ||
|
|
d6822ddd7c | ||
|
|
4944fb33ce | ||
|
|
845f1c636e | ||
|
|
98dbccd1d6 | ||
|
|
7346ff3d08 | ||
|
|
21761c204c | ||
|
|
87f3ba139e | ||
|
|
11498cac94 | ||
|
|
7a31f6aaca | ||
|
|
7d5a2390dd | ||
|
|
081c3ec476 | ||
|
|
e2f054cc27 | ||
|
|
7e98eb3ab7 | ||
|
|
8462f4ad2c | ||
|
|
add4c96280 | ||
|
|
45b5da0826 | ||
|
|
dc24d0151c | ||
|
|
c452b4b7cc | ||
|
|
335763da49 | ||
|
|
5bd8cfd9fe | ||
|
|
2ed025e62d | ||
|
|
836f9f34e4 | ||
|
|
98a8fae7c2 | ||
|
|
690f8b9323 | ||
|
|
79ffc2b3a7 | ||
|
|
13b3b070e3 | ||
|
|
2878cc7757 | ||
|
|
d57e793bf3 | ||
|
|
4d32afde30 | ||
|
|
ad3fd5166b | ||
|
|
010657145d | ||
|
|
973f78e7d3 | ||
|
|
5aa465ae44 | ||
|
|
28777bf693 | ||
|
|
2fbafab4b2 | ||
|
|
b09ed41c52 | ||
|
|
cdba583a25 | ||
|
|
2d916436c5 | ||
|
|
7ee9e9d06b | ||
|
|
b72abbc402 | ||
|
|
ce7b238e88 | ||
|
|
f082b3d8a1 | ||
|
|
eda4265dbc | ||
|
|
a9eae0b424 | ||
|
|
c3fc490d53 | ||
|
|
108e935744 | ||
|
|
eac82039e3 | ||
|
|
e0a8f2d859 | ||
|
|
fcca772383 | ||
|
|
c5fb88c1cd | ||
|
|
aacb0a702e | ||
|
|
f3a9d788bf | ||
|
|
6203cf7f04 | ||
|
|
4ec5d5594b | ||
|
|
a3cb828ed3 | ||
|
|
5e13e0c316 | ||
|
|
bfeb7c4a57 | ||
|
|
43f627a83a | ||
|
|
d0b3a3734e | ||
|
|
94365fa035 | ||
|
|
e0ce9407cb | ||
|
|
dea3fb0d64 | ||
|
|
1dae1c40b9 | ||
|
|
fd654a06e8 | ||
|
|
5bf1f89da7 | ||
|
|
b6c8c7436f | ||
|
|
1dc8ff5220 | ||
|
|
06d81822fd | ||
|
|
0c883500bb | ||
|
|
4ce020f521 | ||
|
|
11cb9de10a | ||
|
|
f9b63dd36a | ||
|
|
282695f536 | ||
|
|
809abdf295 | ||
|
|
79dc136d50 | ||
|
|
2407d87b0d | ||
|
|
276053b35f | ||
|
|
dc4c2733f4 | ||
|
|
f6f2fc4079 | ||
|
|
68b5eaa82f | ||
|
|
238fd68803 | ||
|
|
22a4b82bd2 | ||
|
|
f456eb6254 | ||
|
|
408a8e804c | ||
|
|
e0b39b860f | ||
|
|
fde7febf0d | ||
|
|
eebf194468 | ||
|
|
6f701b3b6a | ||
|
|
8147f74e4e | ||
|
|
dc65dc3778 | ||
|
|
a7fb9216c9 | ||
|
|
81b98261ae | ||
|
|
c20072e940 | ||
|
|
e4c2ebfc57 | ||
|
|
587c061550 | ||
|
|
40a9f6f8e9 | ||
|
|
f0b0464cce | ||
|
|
4e803af0e6 | ||
|
|
4ccd8d3326 | ||
|
|
9768467d53 | ||
|
|
59de1e23bc | ||
|
|
f19b1e0c6b | ||
|
|
d33a3a295f | ||
|
|
f749302d25 | ||
|
|
9c47efb592 | ||
|
|
ea61046e8d | ||
|
|
3f671ea60f | ||
|
|
c1a7c3b08b | ||
|
|
d1225661d2 | ||
|
|
302eee9406 | ||
|
|
b434464b1c | ||
|
|
aabeb38c15 | ||
|
|
fe93ea56b6 | ||
|
|
b301603740 | ||
|
|
d7ba759844 | ||
|
|
8efe58bd3c | ||
|
|
6609938483 | ||
|
|
84662f2db5 | ||
|
|
da975f5a76 | ||
|
|
f34c96bf7a | ||
|
|
0f96f8e68f | ||
|
|
991962b6fd | ||
|
|
c481e27d88 | ||
|
|
56e04e0727 | ||
|
|
2244ac4d52 | ||
|
|
024b537b7f | ||
|
|
e4ee5c3f1c | ||
|
|
3ed3a2d176 | ||
|
|
de58657537 | ||
|
|
1b7d66fab6 | ||
|
|
9fc0a8cbf8 |
@@ -10,15 +10,16 @@ install:
|
||||
- sudo service mysql stop
|
||||
- sudo apt-get install python-software-properties
|
||||
- sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
|
||||
- sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main'
|
||||
- sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu precise main'
|
||||
- sudo apt-get update
|
||||
- sudo apt-get purge -y mysql-common
|
||||
- sudo apt-get install mariadb-server mariadb-common libmariadbclient-dev
|
||||
- ./ci/fix-mariadb.sh
|
||||
|
||||
- wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-precise-amd64.deb
|
||||
- sudo dpkg -i wkhtmltox-0.12.1_linux-precise-amd64.deb
|
||||
- CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@develop
|
||||
- sudo apt-get install xfonts-75dpi xfonts-base -y
|
||||
- wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.2.1/wkhtmltox-0.12.2.1_linux-precise-amd64.deb
|
||||
- sudo dpkg -i wkhtmltox-0.12.2.1_linux-precise-amd64.deb
|
||||
- CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@v4.x.x
|
||||
- CFLAGS=-O0 pip install --editable .
|
||||
|
||||
before_script:
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# ERPNext - Open source ERP for small and medium-size business [](https://travis-ci.org/frappe/erpnext)
|
||||
|
||||
[](https://gitter.im/frappe/erpnext?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
[https://erpnext.com](https://erpnext.com)
|
||||
|
||||
Includes: Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Requires MariaDB.
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
__version__ = '4.17.0'
|
||||
from __future__ import unicode_literals
|
||||
__version__ = '4.25.2'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
test_records = frappe.get_test_records('Budget Distribution')
|
||||
test_records = frappe.get_test_records('Budget Distribution')
|
||||
|
||||
@@ -18,17 +18,17 @@ class CForm(Document):
|
||||
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
|
||||
|
||||
if inv and inv[0][0] != 'Yes':
|
||||
frappe.throw("C-form is not applicable for Invoice: %s" % d.invoice_no)
|
||||
frappe.throw("C-form is not applicable for Invoice: {0}".format(d.invoice_no))
|
||||
|
||||
elif inv and inv[0][1] and inv[0][1] != self.name:
|
||||
frappe.throw("""Invoice %s is tagged in another C-form: %s.
|
||||
frappe.throw("""Invoice {0} is tagged in another C-form: {1}.
|
||||
If you want to change C-form no for this invoice,
|
||||
please remove invoice no from the previous c-form and then try again""" %
|
||||
(d.invoice_no, inv[0][1]))
|
||||
please remove invoice no from the previous c-form and then try again"""\
|
||||
.format(d.invoice_no, inv[0][1]))
|
||||
|
||||
elif not inv:
|
||||
frappe.throw("Row %s: Invoice %s is invalid, it might be cancelled / does not exist. \
|
||||
Please enter a valid Invoice" % d.idx, d.invoice_no)
|
||||
frappe.throw("Row {0}: Invoice {1} is invalid, it might be cancelled / does not exist. \
|
||||
Please enter a valid Invoice".format(d.idx, d.invoice_no))
|
||||
|
||||
def on_update(self):
|
||||
""" Update C-Form No on invoices"""
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
account_properties = {
|
||||
"Deutscher Kontenplan SKR03": {
|
||||
"Bilanzkonten": {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -405,12 +405,12 @@ def get_expense_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
# Hence the first condition is an "OR"
|
||||
return frappe.db.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.report_type = "Profit and Loss"
|
||||
or tabAccount.account_type = "Expense Account")
|
||||
or tabAccount.account_type in ("Expense Account", "Fixed Asset"))
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
|
||||
and tabAccount.company = %(company)s
|
||||
and tabAccount.{key} LIKE %(txt)s
|
||||
{mcond}""".format(key=searchfield, mcond=get_match_cond(doctype)),
|
||||
{'company': filters['company'], 'txt': "%%{0}%%".format(txt)})
|
||||
|
||||
@@ -114,7 +114,7 @@ erpnext.POS = Class.extend({
|
||||
});
|
||||
|
||||
this.wrapper.find('input.discount-amount').on("change", function() {
|
||||
frappe.model.set_value(me.frm.doctype, me.frm.docname, "discount_amount", this.value);
|
||||
frappe.model.set_value(me.frm.doctype, me.frm.docname, "discount_amount", flt(this.value));
|
||||
});
|
||||
|
||||
this.call_function("remove-items", function() {me.remove_selected_items();});
|
||||
|
||||
@@ -244,7 +244,7 @@ cur_frm.cscript.hide_fields = function(doc) {
|
||||
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_normal, true);
|
||||
}
|
||||
|
||||
item_flds_stock = ['serial_no', 'batch_no', 'actual_qty', 'expense_account', 'warehouse']
|
||||
item_flds_stock = ['serial_no', 'batch_no', 'actual_qty', 'actual_batch_qty', 'expense_account', 'warehouse']
|
||||
cur_frm.fields_dict['entries'].grid.set_column_disp(item_flds_stock,
|
||||
(cint(doc.update_stock)==1 ? true : false));
|
||||
|
||||
|
||||
@@ -422,6 +422,15 @@
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "other_charges_total_export",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Taxes and Charges",
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "other_charges_total",
|
||||
"fieldtype": "Currency",
|
||||
@@ -438,23 +447,24 @@
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "other_charges_total_export",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Taxes and Charges",
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "discount_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Discount Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"options": "currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0
|
||||
},
|
||||
{
|
||||
"fieldname": "base_discount_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Discount Amount (Company Currency)",
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "totals",
|
||||
"fieldtype": "Section Break",
|
||||
@@ -1192,7 +1202,7 @@
|
||||
"icon": "icon-file-text",
|
||||
"idx": 1,
|
||||
"is_submittable": 1,
|
||||
"modified": "2014-12-11 16:26:12.402110",
|
||||
"modified": "2015-01-12 17:34:36.353241",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
||||
@@ -59,6 +59,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
if cint(self.update_stock):
|
||||
self.validate_item_code()
|
||||
self.validate_warehouse()
|
||||
self.update_current_stock()
|
||||
self.validate_delivery_note()
|
||||
|
||||
@@ -350,6 +351,11 @@ class SalesInvoice(SellingController):
|
||||
if not d.item_code:
|
||||
msgprint(_("Item Code required at Row No {0}").format(d.idx), raise_exception=True)
|
||||
|
||||
def validate_warehouse(self):
|
||||
for d in self.get('entries'):
|
||||
if not d.warehouse:
|
||||
frappe.throw(_("Warehouse required at Row No {0}").format(d.idx))
|
||||
|
||||
def validate_delivery_note(self):
|
||||
for d in self.get("entries"):
|
||||
if d.delivery_note:
|
||||
@@ -458,7 +464,7 @@ class SalesInvoice(SellingController):
|
||||
|
||||
def make_gl_entries(self, repost_future_gle=True):
|
||||
gl_entries = self.get_gl_entries()
|
||||
|
||||
|
||||
if gl_entries:
|
||||
from erpnext.accounts.general_ledger import make_gl_entries
|
||||
|
||||
@@ -475,6 +481,10 @@ class SalesInvoice(SellingController):
|
||||
and cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
items, warehouses = self.get_items_and_warehouses()
|
||||
update_gl_entries_after(self.posting_date, self.posting_time, warehouses, items)
|
||||
elif self.docstatus == 2 and cint(self.update_stock) \
|
||||
and cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
from erpnext.accounts.general_ledger import delete_gl_entries
|
||||
delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
|
||||
|
||||
def get_gl_entries(self, warehouse_account=None):
|
||||
from erpnext.accounts.general_ledger import merge_similar_entries
|
||||
@@ -503,7 +513,7 @@ class SalesInvoice(SellingController):
|
||||
"debit": self.grand_total,
|
||||
"remarks": self.remarks,
|
||||
"against_voucher": self.name,
|
||||
"against_voucher_type": self.doctype,
|
||||
"against_voucher_type": self.doctype
|
||||
})
|
||||
)
|
||||
|
||||
@@ -537,6 +547,7 @@ class SalesInvoice(SellingController):
|
||||
# expense account gl entries
|
||||
if cint(frappe.defaults.get_global_default("auto_accounting_for_stock")) \
|
||||
and cint(self.update_stock):
|
||||
|
||||
gl_entries += super(SalesInvoice, self).get_gl_entries()
|
||||
|
||||
def make_pos_gl_entries(self, gl_entries):
|
||||
@@ -605,11 +616,10 @@ def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
and tabAccount.docstatus!=2
|
||||
and ifnull(tabAccount.master_type, "")=""
|
||||
and ifnull(tabAccount.master_name, "")=""
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype)})
|
||||
|
||||
and tabAccount.company = %(company)s
|
||||
and tabAccount.{key} LIKE %(txt)s
|
||||
{mcond}""".format(key=searchfield, mcond=get_match_cond(doctype)),
|
||||
{'company': filters['company'], 'txt': "%%{0}%%".format(txt)})
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_delivery_note(source_name, target_doc=None):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest, json, copy
|
||||
|
||||
@@ -339,6 +339,19 @@
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"fieldname": "actual_batch_qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Available Batch Qty at Warehouse",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"read_only": 1,
|
||||
"width": "150px"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"fieldname": "actual_qty",
|
||||
@@ -439,7 +452,7 @@
|
||||
],
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"modified": "2014-09-09 05:35:36.019576",
|
||||
"modified": "2015-03-10 14:56:45.641026",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice Item",
|
||||
|
||||
@@ -46,17 +46,17 @@ cur_frm.pformat.other_charges= function(doc){
|
||||
var new_val = flt(val)/flt(doc.conversion_rate);
|
||||
return new_val;
|
||||
}
|
||||
|
||||
|
||||
function print_hide(fieldname) {
|
||||
var doc_field = frappe.meta.get_docfield(doc.doctype, fieldname, doc.name);
|
||||
return doc_field.print_hide;
|
||||
}
|
||||
|
||||
|
||||
out ='';
|
||||
if (!doc.print_without_amount) {
|
||||
var cl = doc.other_charges || [];
|
||||
|
||||
// outer table
|
||||
// outer table
|
||||
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
|
||||
|
||||
// main table
|
||||
@@ -77,12 +77,12 @@ cur_frm.pformat.other_charges= function(doc){
|
||||
|
||||
// Discount Amount
|
||||
if(!print_hide('discount_amount') && doc.discount_amount)
|
||||
out += make_row('Discount Amount', convert_rate(doc.discount_amount), 0);
|
||||
out += make_row('Discount Amount', doc.discount_amount, 0);
|
||||
|
||||
// grand total
|
||||
if(!print_hide('grand_total_export'))
|
||||
out += make_row('Grand Total', doc.grand_total_export, 1);
|
||||
|
||||
|
||||
if(!print_hide('rounded_total_export'))
|
||||
out += make_row('Rounded Total', doc.rounded_total_export, 1);
|
||||
|
||||
@@ -92,7 +92,7 @@ cur_frm.pformat.other_charges= function(doc){
|
||||
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
|
||||
out += '<td style="width:50%;">' + doc.in_words_export + '</td></tr>';
|
||||
}
|
||||
out += '</table></td></tr></table></div>';
|
||||
out += '</table></td></tr></table></div>';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -139,14 +139,14 @@ cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query =
|
||||
"account_type": ["Tax", "Chargeable", "Income Account"],
|
||||
"company": doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return{
|
||||
'company': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.rate = function(doc, cdt, cdn) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"creation": "2012-05-01 12:46:31",
|
||||
"doc_type": "Journal Voucher",
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Payment Receipt Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Received On\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Received From\"), doc.pay_to_recd_from),\n (_(\"Amount\"), \"<strong>\" + doc.total_amount or 0 + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n <div class=\"row\">\n <div class=\"col-xs-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n",
|
||||
"idx": 1,
|
||||
"modified": "2015-01-12 11:03:22.893209",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Receipt Voucher",
|
||||
"owner": "Administrator",
|
||||
"print_format_type": "Server",
|
||||
"creation": "2012-05-01 12:46:31",
|
||||
"doc_type": "Journal Voucher",
|
||||
"docstatus": 0,
|
||||
"doctype": "Print Format",
|
||||
"html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Payment Receipt Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Received On\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Received From\"), doc.pay_to_recd_from),\n (_(\"Amount\"), \"<strong>\" + frappe.utils.cstr(doc.total_amount or 0) + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n <div class=\"row\">\n <div class=\"col-xs-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n",
|
||||
"idx": 1,
|
||||
"modified": "2015-01-16 11:03:22.893209",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Payment Receipt Voucher",
|
||||
"owner": "Administrator",
|
||||
"print_format_type": "Server",
|
||||
"standard": "Yes"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,23 +135,23 @@ class AccountsReceivableReport(object):
|
||||
|
||||
def prepare_conditions(self):
|
||||
conditions = [""]
|
||||
values = {}
|
||||
values = []
|
||||
|
||||
if self.filters.company:
|
||||
conditions.append("company=%(company)s")
|
||||
values["company"] = self.filters.company
|
||||
conditions.append("company=%s")
|
||||
values.append(self.filters.company)
|
||||
|
||||
if self.filters.account:
|
||||
conditions.append("account=%(account)s")
|
||||
values["account"] = self.filters.account
|
||||
conditions.append("account=%s")
|
||||
values.append(self.filters.account)
|
||||
else:
|
||||
account_map = self.get_account_map()
|
||||
if not account_map:
|
||||
frappe.throw(_("No Customer Accounts found."))
|
||||
else:
|
||||
accounts_list = ["'{0}'".format(frappe.db.escape(ac)) for ac in account_map]
|
||||
conditions.append("account in ({0})".format(", ".join(accounts_list)))
|
||||
|
||||
conditions.append("account in ({0})".format(", ".join(["%s"] * len(account_map))))
|
||||
values += account_map.keys()
|
||||
|
||||
return " and ".join(conditions), values
|
||||
|
||||
def get_gl_entries_for(self, account, against_voucher_type, against_voucher):
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.034953",
|
||||
"modified": "2015-03-30 05:33:45.353064",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Delivered Items To Be Billed",
|
||||
"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_name` 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\"\nfrom `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note`.docstatus = 1 and\n\t`tabDelivery Note`.`status` != \"Stopped\" 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_name` 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` != \"Stopped\" 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",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Delivered Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -161,7 +161,8 @@ def add_total_row(out, balance_must_be, period_list):
|
||||
def get_accounts(company, root_type):
|
||||
# root lft, rgt
|
||||
root_account = frappe.db.sql("""select lft, rgt from `tabAccount`
|
||||
where company=%s and root_type=%s order by lft limit 1""",
|
||||
where company=%s and root_type=%s and ifnull(parent_account, '') = ''
|
||||
order by lft limit 1""",
|
||||
(company, root_type), as_dict=True)
|
||||
|
||||
if not root_account:
|
||||
|
||||
@@ -10,40 +10,40 @@ def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
columns = get_columns()
|
||||
last_col = len(columns)
|
||||
|
||||
|
||||
item_list = get_items(filters)
|
||||
aii_account_map = get_aii_accounts()
|
||||
if item_list:
|
||||
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
|
||||
|
||||
|
||||
data = []
|
||||
for d in item_list:
|
||||
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_name, d.credit_to, d.project_name, d.company, d.purchase_order,
|
||||
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
|
||||
d.supplier_name, d.credit_to, d.project_name, d.company, d.purchase_order,
|
||||
d.purchase_receipt, expense_account, d.qty, d.base_rate, d.base_amount]
|
||||
for tax in tax_accounts:
|
||||
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
|
||||
|
||||
total_tax = sum(row[last_col:])
|
||||
row += [total_tax, d.base_amount + total_tax]
|
||||
|
||||
|
||||
data.append(row)
|
||||
|
||||
|
||||
return columns, data
|
||||
|
||||
|
||||
|
||||
|
||||
def get_columns():
|
||||
return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
|
||||
_("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier") + ":Link/Customer:120",
|
||||
_("Supplier Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
|
||||
_("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100",
|
||||
_("Expense Account") + ":Link/Account:140", _("Qty") + ":Float:120", _("Rate") + ":Currency:120",
|
||||
return [_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
|
||||
_("Invoice") + ":Link/Purchase Invoice:120", _("Posting Date") + ":Date:80", _("Supplier") + ":Link/Customer:120",
|
||||
_("Supplier Account") + ":Link/Account:120", _("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100",
|
||||
_("Purchase Order") + ":Link/Purchase Order:100", _("Purchase Receipt") + ":Link/Purchase Receipt:100",
|
||||
_("Expense Account") + ":Link/Account:140", _("Qty") + ":Float:120", _("Rate") + ":Currency:120",
|
||||
_("Amount") + ":Currency:120"]
|
||||
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
|
||||
|
||||
for opts in (("company", " and company=%(company)s"),
|
||||
("account", " and pi.credit_to = %(account)s"),
|
||||
("item_code", " and pi_item.item_code = %(item_code)s"),
|
||||
@@ -53,48 +53,56 @@ def get_conditions(filters):
|
||||
conditions += opts[1]
|
||||
|
||||
return conditions
|
||||
|
||||
|
||||
def get_items(filters):
|
||||
conditions = get_conditions(filters)
|
||||
match_conditions = frappe.build_match_conditions("Purchase Invoice")
|
||||
|
||||
return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
|
||||
pi.supplier, pi.remarks, pi_item.item_code, pi_item.item_name, pi_item.item_group,
|
||||
pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt,
|
||||
|
||||
return frappe.db.sql("""select pi_item.parent, pi.posting_date, pi.credit_to, pi.company,
|
||||
pi.supplier, pi.remarks, pi.net_total, pi_item.item_code, pi_item.item_name, pi_item.item_group,
|
||||
pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt,
|
||||
pi_item.expense_account, pi_item.qty, pi_item.base_rate, pi_item.base_amount, pi.supplier_name
|
||||
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
|
||||
order by pi.posting_date desc, pi_item.item_code desc""" % (conditions, match_conditions), filters, as_dict=1)
|
||||
|
||||
|
||||
def get_aii_accounts():
|
||||
return dict(frappe.db.sql("select name, stock_received_but_not_billed from tabCompany"))
|
||||
|
||||
|
||||
def get_tax_accounts(item_list, columns):
|
||||
import json
|
||||
item_tax = {}
|
||||
tax_accounts = []
|
||||
|
||||
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail
|
||||
from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
|
||||
and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
|
||||
and parent in (%s)""" % ', '.join(['%s']*len(item_list)), tuple([item.parent for item in item_list]))
|
||||
|
||||
for parent, account_head, item_wise_tax_detail in tax_details:
|
||||
|
||||
invoice_wise_items = {}
|
||||
for d in item_list:
|
||||
invoice_wise_items.setdefault(d.parent, []).append(d)
|
||||
|
||||
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
|
||||
from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
|
||||
and docstatus = 1 and ifnull(account_head, '') != '' and category in ('Total', 'Valuation and Total')
|
||||
and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)), tuple(invoice_wise_items.keys()))
|
||||
|
||||
for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
|
||||
if account_head not in tax_accounts:
|
||||
tax_accounts.append(account_head)
|
||||
|
||||
|
||||
if item_wise_tax_detail:
|
||||
try:
|
||||
item_wise_tax_detail = json.loads(item_wise_tax_detail)
|
||||
for item, tax_amount in item_wise_tax_detail.items():
|
||||
item_tax.setdefault(parent, {}).setdefault(item, {})[account_head] = \
|
||||
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
|
||||
|
||||
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
elif charge_type == "Actual" and tax_amount:
|
||||
for d in invoice_wise_items.get(parent, []):
|
||||
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
|
||||
(tax_amount * d.base_amount) / d.net_total
|
||||
|
||||
tax_accounts.sort()
|
||||
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
|
||||
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
|
||||
|
||||
return item_tax, tax_accounts
|
||||
return item_tax, tax_accounts
|
||||
|
||||
@@ -14,36 +14,36 @@ def execute(filters=None):
|
||||
item_list = get_items(filters)
|
||||
if item_list:
|
||||
item_tax, tax_accounts = get_tax_accounts(item_list, columns)
|
||||
|
||||
|
||||
data = []
|
||||
for d in item_list:
|
||||
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
|
||||
d.customer_name, d.debit_to, d.territory, d.project_name, d.company, d.sales_order,
|
||||
row = [d.item_code, d.item_name, d.item_group, d.parent, d.posting_date,
|
||||
d.customer_name, d.debit_to, d.territory, d.project_name, d.company, d.sales_order,
|
||||
d.delivery_note, d.income_account, d.qty, d.base_rate, d.base_amount]
|
||||
|
||||
|
||||
for tax in tax_accounts:
|
||||
row.append(item_tax.get(d.parent, {}).get(d.item_code, {}).get(tax, 0))
|
||||
|
||||
total_tax = sum(row[last_col:])
|
||||
row += [total_tax, d.base_amount + total_tax]
|
||||
|
||||
|
||||
data.append(row)
|
||||
|
||||
|
||||
return columns, data
|
||||
|
||||
|
||||
def get_columns():
|
||||
return [
|
||||
_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
|
||||
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
|
||||
_("Item Code") + ":Link/Item:120", _("Item Name") + "::120", _("Item Group") + ":Link/Item Group:100",
|
||||
_("Invoice") + ":Link/Sales Invoice:120", _("Posting Date") + ":Date:80", _("Customer") + ":Link/Customer:120",
|
||||
_("Customer Account") + ":Link/Account:120", _("Territory") + ":Link/Territory:80",
|
||||
_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100",
|
||||
_("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140",
|
||||
_("Project") + ":Link/Project:80", _("Company") + ":Link/Company:100", _("Sales Order") + ":Link/Sales Order:100",
|
||||
_("Delivery Note") + ":Link/Delivery Note:100", _("Income Account") + ":Link/Account:140",
|
||||
_("Qty") + ":Float:120", _("Rate") + ":Currency:120", _("Amount") + ":Currency:120"
|
||||
]
|
||||
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
|
||||
|
||||
for opts in (("company", " and company=%(company)s"),
|
||||
("account", " and si.debit_to = %(account)s"),
|
||||
("item_code", " and si_item.item_code = %(item_code)s"),
|
||||
@@ -53,32 +53,36 @@ def get_conditions(filters):
|
||||
conditions += opts[1]
|
||||
|
||||
return conditions
|
||||
|
||||
|
||||
def get_items(filters):
|
||||
conditions = get_conditions(filters)
|
||||
return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name,
|
||||
si.customer, si.remarks, si.territory, si.company, si_item.item_code, si_item.item_name,
|
||||
si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
|
||||
return frappe.db.sql("""select si_item.parent, si.posting_date, si.debit_to, si.project_name,
|
||||
si.customer, si.remarks, si.territory, si.company, si.net_total, 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.base_rate, si_item.base_amount, si.customer_name
|
||||
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
|
||||
where si.name = si_item.parent and si.docstatus = 1 %s
|
||||
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
|
||||
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)
|
||||
|
||||
|
||||
def get_tax_accounts(item_list, columns):
|
||||
import json
|
||||
item_tax = {}
|
||||
tax_accounts = []
|
||||
|
||||
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail
|
||||
from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
|
||||
|
||||
invoice_wise_items = {}
|
||||
for d in item_list:
|
||||
invoice_wise_items.setdefault(d.parent, []).append(d)
|
||||
|
||||
tax_details = frappe.db.sql("""select parent, account_head, item_wise_tax_detail, charge_type, tax_amount
|
||||
from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
|
||||
and docstatus = 1 and ifnull(account_head, '') != ''
|
||||
and parent in (%s)""" % ', '.join(['%s']*len(item_list)),
|
||||
tuple([item.parent for item in item_list]))
|
||||
|
||||
for parent, account_head, item_wise_tax_detail in tax_details:
|
||||
and parent in (%s)""" % ', '.join(['%s']*len(invoice_wise_items)),
|
||||
tuple(invoice_wise_items.keys()))
|
||||
|
||||
for parent, account_head, item_wise_tax_detail, charge_type, tax_amount in tax_details:
|
||||
if account_head not in tax_accounts:
|
||||
tax_accounts.append(account_head)
|
||||
|
||||
|
||||
if item_wise_tax_detail:
|
||||
try:
|
||||
item_wise_tax_detail = json.loads(item_wise_tax_detail)
|
||||
@@ -87,9 +91,13 @@ def get_tax_accounts(item_list, columns):
|
||||
flt(tax_amount[1]) if isinstance(tax_amount, list) else flt(tax_amount)
|
||||
except ValueError:
|
||||
continue
|
||||
|
||||
elif charge_type == "Actual" and tax_amount:
|
||||
for d in invoice_wise_items.get(parent, []):
|
||||
item_tax.setdefault(parent, {}).setdefault(d.item_code, {})[account_head] = \
|
||||
flt((tax_amount * d.base_amount) / d.net_total)
|
||||
|
||||
tax_accounts.sort()
|
||||
columns += [account_head + ":Currency:80" for account_head in tax_accounts]
|
||||
columns += ["Total Tax:Currency:80", "Total:Currency:80"]
|
||||
|
||||
return item_tax, tax_accounts
|
||||
return item_tax, tax_accounts
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.197631",
|
||||
"modified": "2015-03-30 05:33:29.382709",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Ordered Items To Be Billed",
|
||||
"owner": "Administrator",
|
||||
"query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc",
|
||||
"query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.base_amount as \"Amount:Currency:110\",\n (`tabSales Order Item`.billed_amt * ifnull(`tabSales Order`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabSales Order Item`.base_amount, 0) - (ifnull(`tabSales Order Item`.billed_amt, 0) * ifnull(`tabSales Order`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order`.`company` as \"Company:Link/Company:\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.billed_amt,0) < ifnull(`tabSales Order Item`.amount,0)\norder by `tabSales Order`.transaction_date asc",
|
||||
"ref_doctype": "Sales Invoice",
|
||||
"report_name": "Ordered Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.244501",
|
||||
"modified": "2015-03-30 05:37:23.626083",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Purchase Order Items To Be Billed",
|
||||
"owner": "Administrator",
|
||||
"query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t`tabPurchase Order Item`.billed_amt as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - ifnull(`tabPurchase Order Item`.billed_amt, 0)) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Stopped\"\n\tand ifnull(`tabPurchase Order Item`.billed_amt, 0) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc",
|
||||
"query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.base_amount as \"Amount:Currency:100\",\n\t(`tabPurchase Order Item`.billed_amt * ifnull(`tabPurchase Order`.conversion_rate, 1)) as \"Billed Amount:Currency:100\", \n\t(`tabPurchase Order Item`.base_amount - (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1))) as \"Amount to Bill:Currency:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\",\n\t`tabPurchase Order`.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Stopped\"\n\tand (ifnull(`tabPurchase Order Item`.billed_amt, 0) * ifnull(`tabPurchase Order`.conversion_rate, 1)) < ifnull(`tabPurchase Order Item`.base_amount, 0)\norder by `tabPurchase Order`.transaction_date asc",
|
||||
"ref_doctype": "Purchase Invoice",
|
||||
"report_name": "Purchase Order Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-08-08 11:20:27.023487",
|
||||
"modified": "2015-04-14 11:56:02.323769",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Received Items To Be Billed",
|
||||
"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_name` 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\"\nfrom `tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n `tabPurchase Receipt`.docstatus = 1 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_name` 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\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",
|
||||
"ref_doctype": "Purchase Invoice",
|
||||
"report_name": "Received Items To Be Billed",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -209,26 +209,17 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
|
||||
calculate_totals: function() {
|
||||
var tax_count = this.frm.tax_doclist.length;
|
||||
this.frm.doc.grand_total = flt(tax_count ?
|
||||
this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
|
||||
this.frm.doc.grand_total_import = flt(tax_count ?
|
||||
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
|
||||
this.frm.doc.grand_total = flt(tax_count ? this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
|
||||
|
||||
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
|
||||
precision("total_tax"));
|
||||
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, precision("total_tax"));
|
||||
|
||||
this.frm.doc.grand_total = flt(this.frm.doc.grand_total, precision("grand_total"));
|
||||
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
|
||||
|
||||
// rounded totals
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total", this.frm.doc.name)) {
|
||||
this.frm.doc.rounded_total = Math.round(this.frm.doc.grand_total);
|
||||
}
|
||||
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
|
||||
this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
|
||||
}
|
||||
|
||||
// other charges added/deducted
|
||||
this.frm.doc.other_charges_added = 0.0
|
||||
this.frm.doc.other_charges_deducted = 0.0
|
||||
@@ -246,6 +237,16 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
frappe.model.round_floats_in(this.frm.doc,
|
||||
["other_charges_added", "other_charges_deducted"]);
|
||||
}
|
||||
|
||||
this.frm.doc.grand_total_import = flt((this.frm.doc.other_charges_added || this.frm.doc.other_charges_deducted) ?
|
||||
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
|
||||
|
||||
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total_import, precision("grand_total_import"));
|
||||
|
||||
if(frappe.meta.get_docfield(this.frm.doc.doctype, "rounded_total_import", this.frm.doc.name)) {
|
||||
this.frm.doc.rounded_total_import = Math.round(this.frm.doc.grand_total_import);
|
||||
}
|
||||
|
||||
this.frm.doc.other_charges_added_import = flt(this.frm.doc.other_charges_added /
|
||||
this.frm.doc.conversion_rate, precision("other_charges_added_import"));
|
||||
this.frm.doc.other_charges_deducted_import = flt(this.frm.doc.other_charges_deducted /
|
||||
|
||||
@@ -389,6 +389,7 @@
|
||||
"fieldname": "advance_paid",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Advance Paid",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
@@ -775,7 +776,7 @@
|
||||
"icon": "icon-file-text",
|
||||
"idx": 1,
|
||||
"is_submittable": 1,
|
||||
"modified": "2014-11-27 17:27:38.839440",
|
||||
"modified": "2015-04-27 13:40:17.589085",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Purchase Order",
|
||||
|
||||
@@ -198,6 +198,17 @@ class PurchaseOrder(BuyingController):
|
||||
def on_update(self):
|
||||
pass
|
||||
|
||||
def before_recurring(self):
|
||||
super(PurchaseOrder, self).before_recurring()
|
||||
|
||||
for field in ("per_received", "per_billed"):
|
||||
self.set(field, None)
|
||||
|
||||
for d in self.get("po_details"):
|
||||
for field in ("received_qty", "billed_amt", "prevdoc_doctype", "prevdoc_docname",
|
||||
"prevdoc_detail_docname", "supplier_quotation", "supplier_quotation_item"):
|
||||
d.set(field, None)
|
||||
|
||||
def set_missing_values(source, target):
|
||||
target.ignore_pricing_rule = 1
|
||||
target.run_method("set_missing_values")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.103261",
|
||||
"modified": "2015-03-30 05:39:39.876374",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Item-wise Purchase History",
|
||||
"owner": "Administrator",
|
||||
"query": "select\n po_item.item_code as \"Item Code:Link/Item:120\",\n\tpo_item.item_name as \"Item Name::120\",\n\tpo_item.description as \"Description::150\",\n\tpo_item.qty as \"Qty:Float:100\",\n\tpo_item.stock_uom as \"UOM:Link/UOM:80\",\n\tpo_item.base_rate as \"Rate:Currency:120\",\n\tpo_item.base_amount as \"Amount:Currency:120\",\n\tpo.name as \"Purchase Order:Link/Purchase Order:120\",\n\tpo.transaction_date as \"Transaction Date:Date:140\",\n\tpo.supplier as \"Supplier:Link/Supplier:130\",\n\tpo_item.project_name as \"Project:Link/Project:130\",\n\tifnull(po_item.received_qty, 0) as \"Received Qty:Float:120\"\nfrom\n\t`tabPurchase Order` po, `tabPurchase Order Item` po_item\nwhere\n\tpo.name = po_item.parent and po.docstatus = 1\norder by po.name desc",
|
||||
"query": "select\n po_item.item_code as \"Item Code:Link/Item:120\",\n\tpo_item.item_name as \"Item Name::120\",\n\tpo_item.description as \"Description::150\",\n\tpo_item.qty as \"Qty:Float:100\",\n\tpo_item.stock_uom as \"UOM:Link/UOM:80\",\n\tpo_item.base_rate as \"Rate:Currency:120\",\n\tpo_item.base_amount as \"Amount:Currency:120\",\n\tpo.name as \"Purchase Order:Link/Purchase Order:120\",\n\tpo.transaction_date as \"Transaction Date:Date:140\",\n\tpo.supplier as \"Supplier:Link/Supplier:130\",\n\tpo_item.project_name as \"Project:Link/Project:130\",\n\tifnull(po_item.received_qty, 0) as \"Received Qty:Float:120\",\n\tpo.company as \"Company:Link/Company:\"\nfrom\n\t`tabPurchase Order` po, `tabPurchase Order Item` po_item\nwhere\n\tpo.name = po_item.parent and po.docstatus = 1\norder by po.name desc",
|
||||
"ref_doctype": "Purchase Order",
|
||||
"report_name": "Item-wise Purchase History",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.280960",
|
||||
"modified": "2015-03-30 05:41:52.889977",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Buying",
|
||||
"name": "Requested Items To Be Ordered",
|
||||
"owner": "Administrator",
|
||||
"query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.qty, 0)) as \"Qty:Float:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.qty, 0))\norder by mr.transaction_date asc",
|
||||
"query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tsum(ifnull(mr_item.qty, 0)) as \"Qty:Float:100\",\n\tsum(ifnull(mr_item.ordered_qty, 0)) as \"Ordered Qty:Float:100\", \n\t(sum(mr_item.qty) - sum(ifnull(mr_item.ordered_qty, 0))) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\",\n\tmr.company as \"Company:Link/Company:\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\ngroup by mr.name, mr_item.item_code\nhaving\n\tsum(ifnull(mr_item.ordered_qty, 0)) < sum(ifnull(mr_item.qty, 0))\norder by mr.transaction_date asc",
|
||||
"ref_doctype": "Purchase Order",
|
||||
"report_name": "Requested Items To Be Ordered",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
from frappe.widgets.moduleview import add_setup_section
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
from frappe import _
|
||||
|
||||
def get_data():
|
||||
|
||||
@@ -112,6 +112,8 @@ class AccountsController(TransactionBase):
|
||||
if item.get("item_code"):
|
||||
args = parent_dict.copy()
|
||||
args.update(item.as_dict())
|
||||
if not args.get("transaction_date"):
|
||||
args["transaction_date"] = args.get("posting_date")
|
||||
ret = get_item_details(args)
|
||||
|
||||
for fieldname, value in ret.items():
|
||||
@@ -183,6 +185,7 @@ class AccountsController(TransactionBase):
|
||||
|
||||
self.calculate_net_total()
|
||||
self.calculate_taxes()
|
||||
self.manipulate_grand_total_for_inclusive_tax()
|
||||
self.calculate_totals()
|
||||
self._cleanup()
|
||||
|
||||
@@ -295,7 +298,7 @@ class AccountsController(TransactionBase):
|
||||
self.precision("tax_amount", tax))
|
||||
|
||||
def adjust_discount_amount_loss(self, tax):
|
||||
discount_amount_loss = self.grand_total - flt(self.discount_amount) - tax.total
|
||||
discount_amount_loss = self.grand_total - flt(self.base_discount_amount) - tax.total
|
||||
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
|
||||
discount_amount_loss, self.precision("tax_amount", tax))
|
||||
tax.total = flt(tax.total + discount_amount_loss, self.precision("total", tax))
|
||||
@@ -351,6 +354,22 @@ class AccountsController(TransactionBase):
|
||||
self.precision(base_field, item))
|
||||
item.set(base_field, value_in_company_currency)
|
||||
|
||||
def manipulate_grand_total_for_inclusive_tax(self):
|
||||
# if fully inclusive taxes and diff
|
||||
if (self.meta.get_field("net_total_export") and self.tax_doclist
|
||||
and all(cint(t.included_in_print_rate) for t in self.tax_doclist)):
|
||||
|
||||
last_tax = self.tax_doclist[-1]
|
||||
|
||||
diff = self.net_total_export - flt(last_tax.total / self.conversion_rate,
|
||||
self.precision("grand_total_export"))
|
||||
|
||||
if diff and abs(diff) <= (2.0 / 10**(self.precision("tax_amount", last_tax))):
|
||||
adjustment_amount = flt(diff * self.conversion_rate, self.precision("tax_amount", last_tax))
|
||||
last_tax.tax_amount += adjustment_amount
|
||||
last_tax.tax_amount_after_discount_amount += adjustment_amount
|
||||
last_tax.total += adjustment_amount
|
||||
|
||||
def calculate_total_advance(self, parenttype, advance_parentfield):
|
||||
if self.doctype == parenttype and self.docstatus < 2:
|
||||
sum_of_allocated_amount = sum([flt(adv.allocated_amount, self.precision("allocated_amount", adv))
|
||||
|
||||
@@ -91,8 +91,7 @@ class BuyingController(StockController):
|
||||
item.rate = flt(item.price_list_rate * (1.0 - (item.discount_percentage / 100.0)),
|
||||
self.precision("rate", item))
|
||||
|
||||
item.amount = flt(item.rate * item.qty,
|
||||
self.precision("amount", item))
|
||||
item.amount = flt(item.rate * item.qty, self.precision("amount", item))
|
||||
item.item_tax_amount = 0.0;
|
||||
|
||||
self._set_in_company_currency(item, "amount", "base_amount")
|
||||
@@ -111,20 +110,14 @@ class BuyingController(StockController):
|
||||
|
||||
def calculate_totals(self):
|
||||
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
|
||||
self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
|
||||
if self.tax_doclist else self.net_total_import
|
||||
|
||||
self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax"))
|
||||
|
||||
self.grand_total = flt(self.grand_total, self.precision("grand_total"))
|
||||
self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
|
||||
|
||||
if self.meta.get_field("rounded_total"):
|
||||
self.rounded_total = rounded(self.grand_total)
|
||||
|
||||
if self.meta.get_field("rounded_total_import"):
|
||||
self.rounded_total_import = rounded(self.grand_total_import)
|
||||
|
||||
if self.meta.get_field("other_charges_added"):
|
||||
self.other_charges_added = flt(sum([flt(d.tax_amount) for d in self.tax_doclist
|
||||
if d.add_deduct_tax=="Add" and d.category in ["Valuation and Total", "Total"]]),
|
||||
@@ -135,6 +128,14 @@ class BuyingController(StockController):
|
||||
if d.add_deduct_tax=="Deduct" and d.category in ["Valuation and Total", "Total"]]),
|
||||
self.precision("other_charges_deducted"))
|
||||
|
||||
self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
|
||||
if (self.other_charges_added or self.other_charges_deducted) else self.net_total_import
|
||||
|
||||
self.grand_total_import = flt(self.grand_total_import, self.precision("grand_total_import"))
|
||||
|
||||
if self.meta.get_field("rounded_total_import"):
|
||||
self.rounded_total_import = rounded(self.grand_total_import)
|
||||
|
||||
if self.meta.get_field("other_charges_added_import"):
|
||||
self.other_charges_added_import = flt(self.other_charges_added /
|
||||
self.conversion_rate, self.precision("other_charges_added_import"))
|
||||
|
||||
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.widgets.reportview import get_match_cond
|
||||
from frappe.model.db_query import DatabaseQuery
|
||||
from frappe.utils import nowdate
|
||||
|
||||
def get_filters_cond(doctype, filters, conditions):
|
||||
if filters:
|
||||
@@ -154,8 +155,6 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
return tax_accounts
|
||||
|
||||
def item_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
from frappe.utils import nowdate
|
||||
|
||||
conditions = []
|
||||
|
||||
return frappe.db.sql("""select tabItem.name,
|
||||
@@ -229,36 +228,48 @@ def get_delivery_notes_to_be_billed(doctype, txt, searchfield, start, page_len,
|
||||
}, { "start": start, "page_len": page_len, "txt": ("%%%s%%" % txt) })
|
||||
|
||||
def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
|
||||
from erpnext.controllers.queries import get_match_cond
|
||||
if not filters.get("posting_date"):
|
||||
filters["posting_date"] = nowdate()
|
||||
|
||||
if filters.has_key('warehouse'):
|
||||
return frappe.db.sql("""select batch_no from `tabStock Ledger Entry` sle
|
||||
where item_code = '%(item_code)s'
|
||||
and warehouse = '%(warehouse)s'
|
||||
and batch_no like '%(txt)s'
|
||||
and exists(select * from `tabBatch`
|
||||
where name = sle.batch_no
|
||||
and (ifnull(expiry_date, '')='' or expiry_date >= '%(posting_date)s')
|
||||
and docstatus != 2)
|
||||
%(mcond)s
|
||||
group by batch_no having sum(actual_qty) > 0
|
||||
order by batch_no desc
|
||||
limit %(start)s, %(page_len)s """ % {'item_code': filters['item_code'],
|
||||
'warehouse': filters['warehouse'], 'posting_date': filters['posting_date'],
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype),
|
||||
'start': start, 'page_len': page_len})
|
||||
batch_nos = None
|
||||
args = {
|
||||
'item_code': filters.get("item_code"),
|
||||
'warehouse': filters.get("warehouse"),
|
||||
'posting_date': filters.get('posting_date'),
|
||||
'txt': "%%%s%%" % txt,
|
||||
'mcond':get_match_cond(doctype),
|
||||
"start": start,
|
||||
"page_len": page_len
|
||||
}
|
||||
|
||||
if args.get("warehouse"):
|
||||
batch_nos = frappe.db.sql("""select sle.batch_no
|
||||
from `tabStock Ledger Entry` sle, `tabBatch`
|
||||
where sle.batch_no = `tabBatch`.name
|
||||
and sle.item_code = '%(item_code)s'
|
||||
and sle.warehouse = '%(warehouse)s'
|
||||
and sle.batch_no like '%(txt)s'
|
||||
and (ifnull(`tabBatch`.expiry_date, '2099-12-31') >= %(posting_date)s
|
||||
or `tabBatch`.expiry_date = '')
|
||||
and `tabBatch`.docstatus != 2
|
||||
%(mcond)s
|
||||
group by batch_no having sum(actual_qty) > 0
|
||||
order by batch_no desc
|
||||
limit %(start)s, %(page_len)s """
|
||||
% args)
|
||||
|
||||
if batch_nos:
|
||||
return batch_nos
|
||||
else:
|
||||
return frappe.db.sql("""select name from tabBatch
|
||||
where docstatus != 2
|
||||
and item = '%(item_code)s'
|
||||
and (ifnull(expiry_date, '')='' or expiry_date >= '%(posting_date)s')
|
||||
and name like '%(txt)s'
|
||||
%(mcond)s
|
||||
order by name desc
|
||||
limit %(start)s, %(page_len)s""" % {'item_code': filters['item_code'],
|
||||
'posting_date': filters['posting_date'], 'txt': "%%%s%%" % txt,
|
||||
'mcond':get_match_cond(doctype),'start': start,
|
||||
'page_len': page_len})
|
||||
return frappe.db.sql("""select name from `tabBatch`
|
||||
where item = '%(item_code)s'
|
||||
and docstatus < 2
|
||||
and (ifnull(expiry_date, '2099-12-31') >= %(posting_date)s
|
||||
or expiry_date = '' or expiry_date = "0000-00-00")
|
||||
%(mcond)s
|
||||
order by name desc
|
||||
limit %(start)s, %(page_len)s
|
||||
""" % args)
|
||||
|
||||
def get_account_list(doctype, txt, searchfield, start, page_len, filters):
|
||||
filter_list = []
|
||||
|
||||
@@ -218,11 +218,11 @@ class SellingController(StockController):
|
||||
def calculate_totals(self):
|
||||
self.grand_total = flt(self.tax_doclist[-1].total if self.tax_doclist else self.net_total)
|
||||
|
||||
self.grand_total_export = flt(self.grand_total / self.conversion_rate) \
|
||||
if self.tax_doclist else self.net_total_export
|
||||
|
||||
self.other_charges_total = flt(self.grand_total - self.net_total, self.precision("other_charges_total"))
|
||||
|
||||
self.grand_total_export = flt(self.grand_total / self.conversion_rate) \
|
||||
if (self.other_charges_total or self.discount_amount) else self.net_total_export
|
||||
|
||||
self.other_charges_total_export = flt(self.grand_total_export - self.net_total_export +
|
||||
flt(self.discount_amount), self.precision("other_charges_total_export"))
|
||||
|
||||
@@ -234,16 +234,20 @@ class SellingController(StockController):
|
||||
|
||||
def apply_discount_amount(self):
|
||||
if self.discount_amount:
|
||||
self.base_discount_amount = flt(self.discount_amount * self.conversion_rate, self.precision("base_discount_amount"))
|
||||
|
||||
grand_total_for_discount_amount = self.get_grand_total_for_discount_amount()
|
||||
|
||||
if grand_total_for_discount_amount:
|
||||
# calculate item amount after Discount Amount
|
||||
for item in self.item_doclist:
|
||||
distributed_amount = flt(self.discount_amount) * item.base_amount / grand_total_for_discount_amount
|
||||
distributed_amount = flt(self.base_discount_amount) * item.base_amount / grand_total_for_discount_amount
|
||||
item.base_amount = flt(item.base_amount - distributed_amount, self.precision("base_amount", item))
|
||||
|
||||
self.discount_amount_applied = True
|
||||
self._calculate_taxes_and_totals()
|
||||
else:
|
||||
self.base_discount_amount = 0
|
||||
|
||||
def get_grand_total_for_discount_amount(self):
|
||||
actual_taxes_dict = {}
|
||||
@@ -387,6 +391,7 @@ class SellingController(StockController):
|
||||
'qty': d.qty,
|
||||
'reserved_qty': reserved_qty_for_main_item,
|
||||
'uom': d.stock_uom,
|
||||
'stock_uom': d.stock_uom,
|
||||
'batch_no': cstr(d.get("batch_no")).strip(),
|
||||
'serial_no': cstr(d.get("serial_no")).strip(),
|
||||
'name': d.name
|
||||
|
||||
@@ -197,9 +197,10 @@ class StockController(AccountsController):
|
||||
sl_dict.update(args)
|
||||
return sl_dict
|
||||
|
||||
def make_sl_entries(self, sl_entries, is_amended=None):
|
||||
def make_sl_entries(self, sl_entries, is_amended=None, allow_negative_stock=False,
|
||||
via_landed_cost_voucher=False):
|
||||
from erpnext.stock.stock_ledger import make_sl_entries
|
||||
make_sl_entries(sl_entries, is_amended)
|
||||
make_sl_entries(sl_entries, is_amended, allow_negative_stock, via_landed_cost_voucher)
|
||||
|
||||
def make_gl_entries_on_cancel(self):
|
||||
if frappe.db.sql("""select name from `tabGL Entry` where voucher_type=%s
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import frappe.permissions
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from __future__ import unicode_literals
|
||||
app_name = "erpnext"
|
||||
app_title = "ERPNext"
|
||||
app_publisher = "Web Notes Technologies Pvt. Ltd. and Contributors"
|
||||
app_description = "Open Source Enterprise Resource Planning for Small and Midsized Organizations"
|
||||
app_icon = "icon-th"
|
||||
app_color = "#e74c3c"
|
||||
app_version = "4.17.0"
|
||||
app_version = "4.25.2"
|
||||
|
||||
error_report_email = "support@erpnext.com"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
test_ignore = ["Leave Block List"]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
test_records = frappe.get_test_records('Leave Allocation')
|
||||
|
||||
@@ -33,7 +33,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
||||
cur_frm.set_intro(__("You are the Leave Approver for this record. Please Update the 'Status' and Save"));
|
||||
cur_frm.toggle_enable("status", true);
|
||||
} else {
|
||||
cur_frm.set_intro(__("This Leave Application is pending approval. Only the Leave Apporver can update status."))
|
||||
cur_frm.set_intro(__("This Leave Application is pending approval. Only the Leave Approver can update status."))
|
||||
cur_frm.toggle_enable("status", false);
|
||||
if(!doc.__islocal) {
|
||||
cur_frm.frm_head.appframe.set_title_right("");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -45,7 +45,7 @@ class SalarySlip(TransactionBase):
|
||||
|
||||
def get_leave_details(self, lwp=None):
|
||||
if not self.fiscal_year:
|
||||
self.fiscal_year = frappe.get_default("fiscal_year")
|
||||
self.fiscal_year = frappe.db.get_default("fiscal_year")
|
||||
if not self.month:
|
||||
self.month = "%02d" % getdate(nowdate()).month
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -8,6 +8,8 @@ from frappe.utils import cint, cstr, flt
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
class BOM(Document):
|
||||
|
||||
def autoname(self):
|
||||
@@ -25,7 +27,7 @@ class BOM(Document):
|
||||
self.validate_main_item()
|
||||
|
||||
from erpnext.utilities.transaction_base import validate_uom_is_integer
|
||||
validate_uom_is_integer(self, "stock_uom", "qty")
|
||||
validate_uom_is_integer(self, "stock_uom", "qty", "BOM Item")
|
||||
|
||||
self.validate_operations()
|
||||
self.validate_materials()
|
||||
@@ -360,7 +362,7 @@ class BOM(Document):
|
||||
"Add items to Flat BOM table"
|
||||
frappe.db.sql("""delete from `tabBOM Explosion Item` where parent=%s""", self.name)
|
||||
self.set('flat_bom_details', [])
|
||||
for d in self.cur_exploded_items:
|
||||
for d in sorted(self.cur_exploded_items, key=itemgetter(0)):
|
||||
ch = self.append('flat_bom_details', {})
|
||||
for i in self.cur_exploded_items[d].keys():
|
||||
ch.set(i, self.cur_exploded_items[d][i])
|
||||
@@ -393,30 +395,23 @@ def get_bom_items_as_dict(bom, qty=1, fetch_exploded=1):
|
||||
item.expense_account as expense_account,
|
||||
item.buying_cost_center as cost_center
|
||||
from
|
||||
`tab%(table)s` bom_item, `tabBOM` bom, `tabItem` item
|
||||
`tab{table}` bom_item, `tabBOM` bom, `tabItem` item
|
||||
where
|
||||
bom_item.parent = bom.name
|
||||
and bom_item.docstatus < 2
|
||||
and bom_item.parent = "%(bom)s"
|
||||
and bom_item.parent = %(bom)s
|
||||
and item.name = bom_item.item_code
|
||||
%(conditions)s
|
||||
{conditions}
|
||||
group by item_code, stock_uom"""
|
||||
|
||||
if fetch_exploded:
|
||||
items = frappe.db.sql(query % {
|
||||
"qty": qty,
|
||||
"table": "BOM Explosion Item",
|
||||
"bom": bom,
|
||||
"conditions": """and ifnull(item.is_pro_applicable, 'No') = 'No'
|
||||
and ifnull(item.is_sub_contracted_item, 'No') = 'No' """
|
||||
}, as_dict=True)
|
||||
query = query.format(table="BOM Explosion Item",
|
||||
conditions="""and ifnull(item.is_pro_applicable, 'No') = 'No'
|
||||
and ifnull(item.is_sub_contracted_item, 'No') = 'No' """)
|
||||
items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
|
||||
else:
|
||||
items = frappe.db.sql(query % {
|
||||
"qty": qty,
|
||||
"table": "BOM Item",
|
||||
"bom": bom,
|
||||
"conditions": ""
|
||||
}, as_dict=True)
|
||||
query = query.format(table="BOM Item", conditions="")
|
||||
items = frappe.db.sql(query, { "qty": qty, "bom": bom }, as_dict=True)
|
||||
|
||||
# make unique
|
||||
for item in items:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:16.977800",
|
||||
"modified": "2015-03-30 05:42:42.742398",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Completed Production Orders",
|
||||
"owner": "Administrator",
|
||||
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) = `tabProduction Order`.qty",
|
||||
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\",\n `tabProduction Order`.company as \"Company:Link/Company:\",\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) = `tabProduction Order`.qty",
|
||||
"ref_doctype": "Production Order",
|
||||
"report_name": "Completed Production Orders",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-09-17 12:41:55.740299",
|
||||
"modified": "2015-03-30 05:43:20.932301",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Issued Items Against Production Order",
|
||||
"owner": "Administrator",
|
||||
"query": "select\n ste.production_order as \"Production Order:Link/Production Order:120\",\n ste.posting_date as \"Issue Date:Date:140\",\n ste_item.item_code as \"Item Code:Link/Item:120\",\n\tste_item.description as \"Description::150\",\n\tste_item.transfer_qty as \"Qty:Float:100\",\n\tste_item.stock_uom as \"UOM:Link/UOM:80\",\n\tste_item.amount as \"Amount:Currency:120\",\n\tste_item.serial_no as \"Serial No:Link/Serial No:80\",\n\tste_item.s_warehouse as \"Source Warehouse:Link/Warehouse:120\",\n\tste_item.t_warehouse as \"Target Warehouse:Link/Warehouse:120\",\n\tpro.production_item as \"Finished Goods:Link/Item:120\", \n\tste.name as \"Stock Entry:Link/Stock Entry:120\"\nfrom\n\t`tabStock Entry` ste, `tabStock Entry Detail` ste_item, `tabProduction Order` pro\nwhere\n\tifnull(ste.production_order, '') != '' and ste.name = ste_item.parent \n\tand ste.production_order = pro.name and ste.docstatus = 1 \n\tand ste.purpose = 'Manufacture' or 'Repack'\norder by ste.posting_date, ste.production_order, ste_item.item_code",
|
||||
"query": "select\n ste.production_order as \"Production Order:Link/Production Order:120\",\n ste.posting_date as \"Issue Date:Date:140\",\n ste_item.item_code as \"Item Code:Link/Item:120\",\n\tste_item.description as \"Description::150\",\n\tste_item.transfer_qty as \"Qty:Float:100\",\n\tste_item.stock_uom as \"UOM:Link/UOM:80\",\n\tste_item.amount as \"Amount:Currency:120\",\n\tste_item.serial_no as \"Serial No:Link/Serial No:80\",\n\tste_item.s_warehouse as \"Source Warehouse:Link/Warehouse:120\",\n\tste_item.t_warehouse as \"Target Warehouse:Link/Warehouse:120\",\n\tpro.production_item as \"Finished Goods:Link/Item:120\", \n\tste.name as \"Stock Entry:Link/Stock Entry:120\",\n\tste.company as \"Company:Link/Company:\"\nfrom\n\t`tabStock Entry` ste, `tabStock Entry Detail` ste_item, `tabProduction Order` pro\nwhere\n\tifnull(ste.production_order, '') != '' and ste.name = ste_item.parent \n\tand ste.production_order = pro.name and ste.docstatus = 1 \n\tand ste.purpose = 'Manufacture' or 'Repack'\norder by ste.posting_date, ste.production_order, ste_item.item_code",
|
||||
"ref_doctype": "Production Order",
|
||||
"report_name": "Issued Items Against Production Order",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.192207",
|
||||
"modified": "2015-03-30 05:43:59.976254",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Open Production Orders",
|
||||
"owner": "Administrator",
|
||||
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND NOT EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
|
||||
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\",\n `tabProduction Order`.company as \"Company:Link/Company:\",\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND NOT EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
|
||||
"ref_doctype": "Production Order",
|
||||
"report_name": "Open Production Orders",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
"doctype": "Report",
|
||||
"idx": 1,
|
||||
"is_standard": "Yes",
|
||||
"modified": "2014-06-03 07:18:17.223807",
|
||||
"modified": "2015-03-30 05:44:32.894553",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Manufacturing",
|
||||
"name": "Production Orders in Progress",
|
||||
"owner": "Administrator",
|
||||
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
|
||||
"query": "SELECT\n `tabProduction Order`.name as \"Production Order:Link/Production Order:200\",\n `tabProduction Order`.creation as \"Date:Date:120\",\n `tabProduction Order`.production_item as \"Item:Link/Item:150\",\n `tabProduction Order`.qty as \"To Produce:Int:100\",\n `tabProduction Order`.produced_qty as \"Produced:Int:100\",\n `tabProduction Order`.company as \"Company:Link/Company:\"\nFROM\n `tabProduction Order`\nWHERE\n `tabProduction Order`.docstatus=1\n AND ifnull(`tabProduction Order`.produced_qty,0) < `tabProduction Order`.qty\n AND EXISTS (SELECT name from `tabStock Entry` where production_order =`tabProduction Order`.name) ",
|
||||
"ref_doctype": "Production Order",
|
||||
"report_name": "Production Orders in Progress",
|
||||
"report_type": "Query Report"
|
||||
|
||||
@@ -90,3 +90,12 @@ erpnext.patches.v4_2.fix_gl_entries_for_stock_transactions
|
||||
erpnext.patches.v4_2.update_requested_and_ordered_qty
|
||||
execute:frappe.delete_doc("DocType", "Contact Control")
|
||||
erpnext.patches.v4_2.recalculate_bom_costs
|
||||
erpnext.patches.v4_2.discount_amount
|
||||
erpnext.patches.v4_2.update_landed_cost_voucher
|
||||
erpnext.patches.v4_2.set_item_has_batch
|
||||
erpnext.patches.v4_2.update_stock_uom_for_dn_in_sle
|
||||
erpnext.patches.v4_2.repost_reserved_qty
|
||||
erpnext.patches.v4_2.repost_sle_for_si_with_no_warehouse
|
||||
erpnext.patches.v4_2.fix_recurring_orders
|
||||
erpnext.patches.v4_2.delete_gl_entries_for_cancelled_invoices
|
||||
erpnext.patches.v4_2.update_advance_paid
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
import frappe.model
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.templates.pages.style_settings import default_properties
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
cancelled_invoices = frappe.db.sql_list("""select name from `tabSales Invoice`
|
||||
where docstatus = 2 and ifnull(update_stock, 0) = 1""")
|
||||
|
||||
if cancelled_invoices:
|
||||
frappe.db.sql("""delete from `tabGL Entry`
|
||||
where voucher_type = 'Sales Invoice' and voucher_no in (%s)"""
|
||||
% (', '.join(['%s']*len(cancelled_invoices))), tuple(cancelled_invoices))
|
||||
12
erpnext/patches/v4_2/discount_amount.py
Normal file
12
erpnext/patches/v4_2/discount_amount.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.modules import scrub, get_doctype_module
|
||||
|
||||
def execute():
|
||||
for dt in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
|
||||
frappe.reload_doc(get_doctype_module(dt), "doctype", scrub(dt))
|
||||
frappe.db.sql("""update `tab{0}` set base_discount_amount=discount_amount,
|
||||
discount_amount=discount_amount/conversion_rate""".format(dt))
|
||||
41
erpnext/patches/v4_2/fix_recurring_orders.py
Normal file
41
erpnext/patches/v4_2/fix_recurring_orders.py
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
sales_orders = frappe.db.sql("""select name from `tabSales Order`
|
||||
where docstatus = 1 and ifnull(is_recurring, 0) = 1
|
||||
and (per_delivered > 0 or per_billed > 0)""", as_dict=1)
|
||||
|
||||
for so in sales_orders:
|
||||
if not frappe.db.exists("Delivery Note Item", {"against_sales_order": so.name, "docstatus": 1}):
|
||||
frappe.db.sql("""update `tabSales Order` set per_delivered = 0,
|
||||
delivery_status = 'Not Delivered' where name = %s""", so.name)
|
||||
frappe.db.sql("""update `tabSales Order Item` set delivered_qty = 0
|
||||
where parent = %s""", so.name)
|
||||
|
||||
if not frappe.db.exists("Sales Invoice Item", {"sales_order": so.name, "docstatus": 1}):
|
||||
frappe.db.sql("""update `tabSales Order` set per_billed = 0,
|
||||
billing_status = 'Not Billed' where name = %s""", so.name)
|
||||
frappe.db.sql("""update `tabSales Order Item` set billed_amt = 0
|
||||
where parent = %s""", so.name)
|
||||
|
||||
purchase_orders = frappe.db.sql("""select name from `tabPurchase Order`
|
||||
where docstatus = 1 and ifnull(is_recurring, 0) = 1
|
||||
and (per_received > 0 or per_billed > 0)""", as_dict=1)
|
||||
|
||||
for po in purchase_orders:
|
||||
if not frappe.db.exists("Purchase Receipt Item", {"prevdoc_doctype": "Purchase Order",
|
||||
"prevdoc_docname": po.name, "docstatus": 1}):
|
||||
frappe.db.sql("""update `tabPurchase Order` set per_received = 0
|
||||
where name = %s""", po.name)
|
||||
frappe.db.sql("""update `tabPurchase Order Item` set received_qty = 0
|
||||
where parent = %s""", po.name)
|
||||
|
||||
if not frappe.db.exists("Purchase Invoice Item", {"purchase_order": po.name, "docstatus": 1}):
|
||||
frappe.db.sql("""update `tabPurchase Order` set per_billed = 0
|
||||
where name = %s""", po.name)
|
||||
frappe.db.sql("""update `tabPurchase Order Item` set billed_amt = 0
|
||||
where parent = %s""", po.name)
|
||||
12
erpnext/patches/v4_2/repost_reserved_qty.py
Normal file
12
erpnext/patches/v4_2/repost_reserved_qty.py
Normal file
@@ -0,0 +1,12 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.utilities.repost_stock import update_bin_qty, get_reserved_qty
|
||||
|
||||
def execute():
|
||||
for item_code, warehouse in frappe.db.sql("select item_code, warehouse from tabBin where ifnull(reserved_qty, 0) < 0"):
|
||||
update_bin_qty(item_code, warehouse, {
|
||||
"reserved_qty": get_reserved_qty(item_code, warehouse)
|
||||
})
|
||||
34
erpnext/patches/v4_2/repost_sle_for_si_with_no_warehouse.py
Normal file
34
erpnext/patches/v4_2/repost_sle_for_si_with_no_warehouse.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from erpnext.stock.stock_ledger import NegativeStockError
|
||||
|
||||
def execute():
|
||||
si_list = frappe.db.sql("""select distinct si.name
|
||||
from `tabSales Invoice Item` si_item, `tabSales Invoice` si
|
||||
where si.name = si_item.parent and si.modified > '2015-02-16' and si.docstatus=1
|
||||
and ifnull(si_item.warehouse, '') = '' and ifnull(si.update_stock, 0) = 1
|
||||
order by posting_date, posting_time""", as_dict=1)
|
||||
|
||||
failed_list = []
|
||||
for si in si_list:
|
||||
try:
|
||||
si_doc = frappe.get_doc("Sales Invoice", si.name)
|
||||
si_doc.docstatus = 2
|
||||
si_doc.on_cancel()
|
||||
|
||||
si_doc.docstatus = 1
|
||||
si_doc.set_missing_item_details()
|
||||
si_doc.on_submit()
|
||||
frappe.db.commit()
|
||||
except:
|
||||
failed_list.append(si.name)
|
||||
frappe.local.stockledger_exceptions = None
|
||||
frappe.db.rollback()
|
||||
|
||||
print "Failed to repost: ", failed_list
|
||||
|
||||
|
||||
|
||||
65
erpnext/patches/v4_2/set_item_has_batch.py
Normal file
65
erpnext/patches/v4_2/set_item_has_batch.py
Normal file
@@ -0,0 +1,65 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.db.sql("update tabItem set has_batch_no = 'No' where ifnull(has_batch_no, '') = ''")
|
||||
frappe.db.sql("update tabItem set has_serial_no = 'No' where ifnull(has_serial_no, '') = ''")
|
||||
|
||||
item_list = frappe.db.sql("""select name, has_batch_no, has_serial_no from tabItem
|
||||
where ifnull(is_stock_item, 'No') = 'Yes'""", as_dict=1)
|
||||
|
||||
sle_count = get_sle_count()
|
||||
sle_with_batch = get_sle_with_batch()
|
||||
sle_with_serial = get_sle_with_serial()
|
||||
|
||||
batch_items = get_items_with_batch()
|
||||
serialized_items = get_items_with_serial()
|
||||
|
||||
for d in item_list:
|
||||
if d.has_batch_no == 'Yes':
|
||||
if d.name not in batch_items and sle_count.get(d.name) and sle_count.get(d.name) != sle_with_batch.get(d.name):
|
||||
frappe.db.set_value("Item", d.name, "has_batch_no", "No")
|
||||
else:
|
||||
if d.name in batch_items or (sle_count.get(d.name) and sle_count.get(d.name) == sle_with_batch.get(d.name)):
|
||||
frappe.db.set_value("Item", d.name, "has_batch_no", "Yes")
|
||||
|
||||
if d.has_serial_no == 'Yes':
|
||||
if d.name not in serialized_items and sle_count.get(d.name) and sle_count.get(d.name) != sle_with_serial.get(d.name):
|
||||
frappe.db.set_value("Item", d.name, "has_serial_no", "No")
|
||||
else:
|
||||
if d.name in serialized_items or (sle_count.get(d.name) and sle_count.get(d.name) == sle_with_serial.get(d.name)):
|
||||
frappe.db.set_value("Item", d.name, "has_serial_no", "Yes")
|
||||
|
||||
|
||||
def get_sle_count():
|
||||
sle_count = {}
|
||||
for d in frappe.db.sql("""select item_code, count(name) as cnt from `tabStock Ledger Entry` group by item_code""", as_dict=1):
|
||||
sle_count.setdefault(d.item_code, d.cnt)
|
||||
|
||||
return sle_count
|
||||
|
||||
def get_sle_with_batch():
|
||||
sle_with_batch = {}
|
||||
for d in frappe.db.sql("""select item_code, count(name) as cnt from `tabStock Ledger Entry`
|
||||
where ifnull(batch_no, '') != '' group by item_code""", as_dict=1):
|
||||
sle_with_batch.setdefault(d.item_code, d.cnt)
|
||||
|
||||
return sle_with_batch
|
||||
|
||||
|
||||
def get_sle_with_serial():
|
||||
sle_with_serial = {}
|
||||
for d in frappe.db.sql("""select item_code, count(name) as cnt from `tabStock Ledger Entry`
|
||||
where ifnull(serial_no, '') != '' group by item_code""", as_dict=1):
|
||||
sle_with_serial.setdefault(d.item_code, d.cnt)
|
||||
|
||||
return sle_with_serial
|
||||
|
||||
def get_items_with_batch():
|
||||
return frappe.db.sql_list("select item from tabBatch")
|
||||
|
||||
def get_items_with_serial():
|
||||
return frappe.db.sql_list("select item_code from `tabSerial No`")
|
||||
13
erpnext/patches/v4_2/update_advance_paid.py
Normal file
13
erpnext/patches/v4_2/update_advance_paid.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for dt in ("Sales Order", "Purchase Order"):
|
||||
orders_with_advance = frappe.db.sql("""select name from `tab{0}`
|
||||
where docstatus < 2 and ifnull(advance_paid, 0) != 0""".format(dt), as_dict=1)
|
||||
|
||||
for order in orders_with_advance:
|
||||
frappe.get_doc(dt, order.name).set_total_advance_paid()
|
||||
10
erpnext/patches/v4_2/update_landed_cost_voucher.py
Normal file
10
erpnext/patches/v4_2/update_landed_cost_voucher.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("stock", "doctype", "landed_cost_voucher")
|
||||
frappe.db.sql("""update `tabLanded Cost Voucher` set distribute_charges_based_on = 'Amount'
|
||||
where docstatus=1""")
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
|
||||
11
erpnext/patches/v4_2/update_stock_uom_for_dn_in_sle.py
Normal file
11
erpnext/patches/v4_2/update_stock_uom_for_dn_in_sle.py
Normal file
@@ -0,0 +1,11 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.db.sql("""update `tabStock Ledger Entry` sle, tabItem item
|
||||
set sle.stock_uom = item.stock_uom
|
||||
where sle.voucher_type="Delivery Note" and item.name = sle.item_code
|
||||
and sle.stock_uom != item.stock_uom""")
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, unittest
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
|
||||
@@ -148,7 +148,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
order_type: me.frm.doc.order_type,
|
||||
is_pos: cint(me.frm.doc.is_pos),
|
||||
is_subcontracted: me.frm.doc.is_subcontracted,
|
||||
transaction_date: me.frm.doc.transaction_date,
|
||||
transaction_date: me.frm.doc.transaction_date || me.frm.doc.posting_date,
|
||||
ignore_pricing_rule: me.frm.doc.ignore_pricing_rule,
|
||||
doctype: item.doctype,
|
||||
name: item.name,
|
||||
@@ -404,23 +404,27 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
_set_values_for_item_list: function(children) {
|
||||
var me = this;
|
||||
var price_list_rate_changed = false;
|
||||
$.each(children, function(i, d) {
|
||||
for(var i=0, l=children.length; i<l; i++) {
|
||||
var d = children[i];
|
||||
var existing_pricing_rule = frappe.model.get_value(d.doctype, d.name, "pricing_rule");
|
||||
$.each(d, function(k, v) {
|
||||
|
||||
for(var k in d) {
|
||||
var v = d[k];
|
||||
if (["doctype", "name"].indexOf(k)===-1) {
|
||||
if(k=="price_list_rate") {
|
||||
if(flt(v) != flt(d.price_list_rate)) price_list_rate_changed = true;
|
||||
}
|
||||
frappe.model.set_value(d.doctype, d.name, k, v);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// if pricing rule set as blank from an existing value, apply price_list
|
||||
if(!me.frm.doc.ignore_pricing_rule && existing_pricing_rule && !d.pricing_rule) {
|
||||
me.apply_price_list(frappe.get_doc(d.doctype, d.name));
|
||||
}
|
||||
}
|
||||
|
||||
if(!price_list_rate_changed) me.calculate_taxes_and_totals();
|
||||
});
|
||||
if(!price_list_rate_changed) me.calculate_taxes_and_totals();
|
||||
},
|
||||
|
||||
apply_price_list: function(item) {
|
||||
@@ -628,6 +632,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
this.determine_exclusive_rate && this.determine_exclusive_rate();
|
||||
this.calculate_net_total();
|
||||
this.calculate_taxes();
|
||||
this.manipulate_grand_total_for_inclusive_tax && this.manipulate_grand_total_for_inclusive_tax();
|
||||
this.calculate_totals();
|
||||
this._cleanup();
|
||||
|
||||
@@ -734,7 +739,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
},
|
||||
|
||||
adjust_discount_amount_loss: function(tax) {
|
||||
var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.discount_amount) - tax.total;
|
||||
var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.base_discount_amount) - tax.total;
|
||||
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
|
||||
discount_amount_loss, precision("tax_amount", tax));
|
||||
tax.total = flt(tax.total + discount_amount_loss, precision("total", tax));
|
||||
@@ -748,8 +753,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
|
||||
// distribute the tax amount proportionally to each item row
|
||||
var actual = flt(tax.rate, precision("tax_amount", tax));
|
||||
current_tax_amount = this.frm.doc.net_total ?
|
||||
((item.base_amount / this.frm.doc.net_total) * actual) :
|
||||
0.0;
|
||||
((item.base_amount / this.frm.doc.net_total) * actual) : 0.0;
|
||||
|
||||
} else if(tax.charge_type == "On Net Total") {
|
||||
current_tax_amount = (tax_rate / 100.0) * item.base_amount;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user