This commit is contained in:
Rushabh Mehta
2013-01-21 10:23:21 +05:30
39 changed files with 1911 additions and 1762 deletions

View File

@@ -23,17 +23,11 @@ from webnotes.model.wrapper import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
from utilities.transaction_base import TransactionBase
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d, dl
self.entries = []
def get_company_currency(self,arg=''):
dcc = TransactionBase().get_company_currency(arg)
return dcc
def get_period_difference(self,arg, cost_center =''):
# used in General Ledger Page Report
# used for Budget where cost center passed as extra argument

View File

@@ -18,15 +18,14 @@ from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getdate
from webnotes.model import db_exists
from webnotes.model.doc import addchild, make_autoname
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.wrapper import getlist
from webnotes.model.code import get_obj
from webnotes import form, msgprint
from webnotes import msgprint
from setup.utils import get_company_currency
sql = webnotes.conn.sql
from utilities.transaction_base import TransactionBase
class DocType:
def __init__(self,d,dl):
@@ -238,7 +237,7 @@ class DocType:
self.doc.pay_to_recd_from = webnotes.conn.get_value(master_type, ' - '.join(d.account.split(' - ')[:-1]), master_type == 'Customer' and 'customer_name' or 'supplier_name')
if acc_type == 'Bank or Cash':
dcc = TransactionBase().get_company_currency(self.doc.company)
dcc = get_company_currency(self.doc.company)
amt = cint(d.debit) and d.debit or d.credit
self.doc.total_amount = dcc +' '+ cstr(amt)
self.doc.total_amount_in_words = get_obj('Sales Common').get_total_in_words(dcc, cstr(amt))

View File

@@ -20,41 +20,42 @@ cur_frm.cscript.other_fname = "purchase_tax_details";
wn.require('app/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js');
wn.require('app/buying/doctype/purchase_common/purchase_common.js');
erpnext.buying.PurchaseInvoiceController = erpnext.buying.BuyingController.extend({
refresh: function(doc) {
this._super();
// Show / Hide button
if(doc.docstatus==1 && doc.outstanding_amount > 0)
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
}
cur_frm.cscript.is_opening(doc);
}
});
var new_cscript = new erpnext.buying.PurchaseInvoiceController({frm: cur_frm});
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new_cscript);
cur_frm.cscript.onload = function(doc,dt,dn) {
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
}
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
var callback = function(doc, dt, dn) {
var callback1 = function(doc, dt, dn) {
if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn);
}
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, dt, dn, callback1);
if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn);
}
cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
}
cur_frm.cscript.refresh = function(doc, dt, dn) {
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, dt, dn, callback);
cur_frm.clear_custom_buttons();
erpnext.hide_naming_series();
if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, dt, dn);
// Show / Hide button
if(doc.docstatus==1 && doc.outstanding_amount > 0)
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
}
cur_frm.cscript.is_opening(doc, dt, dn);
}
cur_frm.cscript.supplier = function(doc,dt,dn) {
var callback = function(r,rt) {
var doc = locals[cur_frm.doctype][cur_frm.docname];
@@ -162,13 +163,6 @@ cur_frm.cscript.get_items = function(doc, dt, dn) {
$c_obj(make_doclist(dt,dn),'pull_details','',callback);
}
cur_frm.cscript.item_code = function(doc,cdt,cdn){
var d = locals[cdt][cdn];
if(d.item_code){
get_server_fields('get_item_details',d.item_code,'entries',doc,cdt,cdn,1);
}
}
cur_frm.cscript.allocated_amount = function(doc,cdt,cdn) {
calc_total_advance(doc, cdt, cdn);
}

View File

@@ -18,28 +18,20 @@ from __future__ import unicode_literals
import webnotes
from webnotes.utils import add_days, cint, cstr, flt, formatdate, get_defaults
from webnotes.model import db_exists
from webnotes.model.doc import Document, make_autoname
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.wrapper import getlist
from webnotes.model.code import get_obj
from webnotes import form, msgprint
from webnotes import msgprint
from setup.utils import get_company_currency
sql = webnotes.conn.sql
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
from controllers.buying_controller import BuyingController
class DocType(BuyingController):
def __init__(self,d,dl):
self.doc, self.doclist = d, dl
self.tname = 'Purchase Invoice Item'
self.fname = 'entries'
# Autoname
# ---------
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+'.####')
# ************************** Trigger Functions ****************************
@@ -106,64 +98,7 @@ class DocType(TransactionBase):
item = webnotes.conn.sql("select purchase_account, cost_center from tabItem where name = '%s'" %(d.item_code), as_dict=1)
d.expense_head = item and item[0]['purchase_account'] or ''
d.cost_center = item and item[0]['cost_center'] or ''
# Get Item Details
# -----------------
def get_item_details(self, arg=None):
if arg:
return self.get_pv_details(arg)
else:
for doc in self.doclist:
if doc.fields.get('item_code'):
ret = self.get_pv_details(doc.item_code)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
def get_pv_details(self, arg):
import json
item_det = sql("select item_name, brand, description, item_group, purchase_account, cost_center, stock_uom from tabItem where name=%s",arg,as_dict=1)
tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg)
t = {}
for x in tax: t[x[0]] = flt(x[1])
ret = {
'item_name': item_det and item_det[0]['item_name'] or '',
'brand': item_det and item_det[0]['brand'] or '',
'description': item_det and item_det[0]['description'] or '',
'item_group': item_det and item_det[0]['item_group'] or '',
'rate': 0.00,
'purchase_ref_rate': 0.00,
'import_ref_rate': 0.00,
'import_rate': 0.00,
'qty': 0.00,
'amount': 0.00,
'discount_rate': 0.00,
'expense_head': item_det and item_det[0]['purchase_account'] or '',
'cost_center': item_det and item_det[0]['cost_center'] or '',
'item_tax_rate': json.dumps(t),
'uom': item_det and item_det[0]['stock_uom'] or ''
}
# get last purchase rate
last_purchase_details, last_purchase_date = get_obj('Purchase Common').get_last_purchase_details(arg, self.doc.name)
if last_purchase_details:
purchase_ref_rate = last_purchase_details['purchase_ref_rate']
purchase_rate = last_purchase_details['purchase_rate']
conversion_rate = self.doc.conversion_rate or 1.0
ret.update({
'purchase_ref_rate': purchase_ref_rate,
'discount_rate': last_purchase_details['discount_rate'],
'rate': purchase_rate,
'import_ref_rate': purchase_ref_rate / conversion_rate,
'import_rate': purchase_rate / conversion_rate,
})
return ret
# Advance Allocation
# -------------------
def get_advances(self):
@@ -225,7 +160,7 @@ class DocType(TransactionBase):
# Check Conversion Rate
# ----------------------
def check_conversion_rate(self):
default_currency = TransactionBase().get_company_currency(self.doc.company)
default_currency = get_company_currency(self.doc.company)
if not default_currency:
msgprint('Message: Please enter default currency in Company Master')
raise Exception
@@ -394,6 +329,8 @@ class DocType(TransactionBase):
# VALIDATE
# ====================================================================================
def validate(self):
super(DocType, self).validate()
self.po_required()
self.pr_required()
self.check_active_purchase_items()
@@ -434,7 +371,7 @@ class DocType(TransactionBase):
pc_obj = get_obj(dt='Purchase Common')
# get total in words
dcc = TransactionBase().get_company_currency(self.doc.company)
dcc = get_company_currency(self.doc.company)
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency,
self.doc.grand_total_import)

View File

@@ -2,14 +2,14 @@
{
"owner": "Administrator",
"docstatus": 0,
"creation": "2012-12-03 17:26:39",
"creation": "2013-01-18 12:46:57",
"modified_by": "Administrator",
"modified": "2012-12-04 17:15:28"
"modified": "2013-01-18 13:25:16"
},
{
"is_submittable": 1,
"autoname": "naming_series:",
"allow_attach": 1,
"is_submittable": 1,
"search_fields": "posting_date, credit_to, fiscal_year, bill_no, grand_total, outstanding_amount",
"module": "Accounts",
"doctype": "DocType",
@@ -48,7 +48,6 @@
"description": "To manage multiple series please go to Setup > Manage Series",
"no_copy": 1,
"oldfieldtype": "Select",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Series",
"oldfieldname": "naming_series",
@@ -67,7 +66,6 @@
"label": "Credit To",
"oldfieldname": "credit_to",
"permlevel": 0,
"trigger": "Client",
"fieldname": "credit_to",
"fieldtype": "Link",
"search_index": 1,
@@ -196,35 +194,83 @@
"permlevel": 0
},
{
"print_hide": 1,
"description": "Will be calculated automatically when you enter the details",
"oldfieldtype": "Currency",
"oldfieldtype": "Button",
"doctype": "DocField",
"label": "Net Total",
"oldfieldname": "net_total",
"fieldname": "net_total",
"fieldtype": "Currency",
"permlevel": 1
"label": "Recalculate",
"fieldname": "recalculate",
"fieldtype": "Button",
"permlevel": 0
},
{
"doctype": "DocField",
"options": "Simple",
"fieldname": "section_break_17",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"description": "Select Items from Purchase Order",
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "Net Total (Import)",
"oldfieldname": "net_total_import",
"fieldname": "net_total_import",
"fieldtype": "Currency",
"permlevel": 1
"label": "Purchase Order",
"oldfieldname": "purchase_order_main",
"options": "Purchase Order",
"fieldname": "purchase_order_main",
"fieldtype": "Link",
"permlevel": 0
},
{
"print_hide": 1,
"description": "Select Items from Purchase Receipt",
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "Purchase Receipt",
"oldfieldname": "purchase_receipt_main",
"options": "Purchase Receipt",
"fieldname": "purchase_receipt_main",
"fieldtype": "Link",
"permlevel": 0
},
{
"oldfieldtype": "Button",
"doctype": "DocField",
"label": "Recalculate",
"trigger": "Client",
"fieldname": "recalculate",
"label": "Get Items",
"options": "pull_details",
"fieldname": "get_items",
"fieldtype": "Button",
"permlevel": 0
},
{
"doctype": "DocField",
"label": "Currency & Price List",
"fieldname": "currency_price_list",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "Currency",
"oldfieldname": "currency",
"options": "link:Currency",
"fieldname": "currency",
"fieldtype": "Select",
"permlevel": 0
},
{
"print_hide": 1,
"description": "The rate at which Bill Currency is converted into company's base currency",
"default": "1",
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Exchange Rate",
"oldfieldname": "conversion_rate",
"fieldname": "conversion_rate",
"fieldtype": "Float",
"permlevel": 0
},
{
"doctype": "DocField",
"fieldname": "column_break2",
@@ -233,70 +279,36 @@
},
{
"print_hide": 1,
"description": "The rate at which Bill Currency is converted into company's base currency",
"default": "1",
"oldfieldtype": "Currency",
"colour": "White:FFF",
"description": "Consider this Price List for fetching rate. (only which have \"For Buying\" as checked)",
"doctype": "DocField",
"label": "Bill Conversion Rate",
"oldfieldname": "conversion_rate",
"fieldname": "conversion_rate",
"label": "Price List",
"options": "Price List",
"fieldname": "price_list_name",
"fieldtype": "Link",
"permlevel": 0
},
{
"print_hide": 1,
"depends_on": "price_list_name",
"doctype": "DocField",
"label": "Price List Currency",
"options": "Currency",
"fieldname": "price_list_currency",
"fieldtype": "Link",
"permlevel": 0
},
{
"print_hide": 1,
"depends_on": "price_list_name",
"doctype": "DocField",
"label": "Price List Exchange Rate",
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "Bill Currency",
"oldfieldname": "currency",
"options": "link:Currency",
"fieldname": "currency",
"fieldtype": "Select",
"permlevel": 0
},
{
"print_hide": 1,
"description": "Select Items from Purchase Order",
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Purchase Order",
"oldfieldname": "purchase_order_main",
"permlevel": 0,
"trigger": "Client",
"fieldname": "purchase_order_main",
"fieldtype": "Link",
"options": "Purchase Order"
},
{
"print_hide": 1,
"description": "Select Items from Purchase Receipt",
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Purchase Receipt",
"oldfieldname": "purchase_receipt_main",
"permlevel": 0,
"trigger": "Client",
"fieldname": "purchase_receipt_main",
"fieldtype": "Link",
"options": "Purchase Receipt"
},
{
"oldfieldtype": "Button",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Get Items",
"options": "pull_details",
"fieldname": "get_items",
"fieldtype": "Button",
"permlevel": 0
},
{
"description": "Add / Edit Taxes and Charges",
"oldfieldtype": "Section Break",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Taxes",
"fieldname": "taxes",
@@ -339,7 +351,6 @@
"oldfieldtype": "Button",
"doctype": "DocField",
"label": "Calculate Tax",
"trigger": "Client",
"fieldname": "calculate_tax",
"fieldtype": "Button",
"permlevel": 0
@@ -373,20 +384,17 @@
{
"print_hide": 1,
"oldfieldtype": "Link",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Supplier",
"oldfieldname": "supplier",
"permlevel": 0,
"trigger": "Client",
"options": "Supplier",
"fieldname": "supplier",
"fieldtype": "Link",
"hidden": 0,
"options": "Supplier"
"permlevel": 0
},
{
"depends_on": "eval:doc.supplier",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Supplier Address",
"options": "Address",
@@ -404,7 +412,6 @@
{
"print_hide": 1,
"depends_on": "eval:doc.supplier",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Contact Person",
"options": "Contact",
@@ -412,206 +419,6 @@
"fieldtype": "Link",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Section Break",
"doctype": "DocField",
"label": "More Info",
"fieldname": "more_info",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Column Break",
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break3",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"print_hide": 1,
"default": "No",
"oldfieldtype": "Select",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Is Opening",
"oldfieldname": "is_opening",
"permlevel": 0,
"trigger": "Client",
"fieldname": "is_opening",
"fieldtype": "Select",
"search_index": 1,
"options": "No\nYes",
"in_filter": 1
},
{
"print_hide": 1,
"oldfieldtype": "Date",
"doctype": "DocField",
"label": "Aging Date",
"oldfieldname": "aging_date",
"fieldname": "aging_date",
"fieldtype": "Date",
"search_index": 0,
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "Amended From",
"oldfieldname": "amended_from",
"options": "Purchase Invoice",
"fieldname": "amended_from",
"fieldtype": "Link",
"permlevel": 1
},
{
"print_hide": 1,
"description": "The date at which current entry is corrected in the system.",
"no_copy": 1,
"oldfieldtype": "Date",
"doctype": "DocField",
"label": "Amendment Date",
"oldfieldname": "amendment_date",
"fieldname": "amendment_date",
"fieldtype": "Date",
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Link",
"colour": "White:FFF",
"allow_on_submit": 1,
"doctype": "DocField",
"label": "Select Print Heading",
"oldfieldname": "select_print_heading",
"permlevel": 0,
"trigger": "Client",
"fieldname": "select_print_heading",
"fieldtype": "Link",
"options": "Print Heading",
"report_hide": 1
},
{
"print_hide": 0,
"no_copy": 0,
"oldfieldtype": "Date",
"doctype": "DocField",
"label": "Due Date",
"oldfieldname": "due_date",
"fieldname": "due_date",
"fieldtype": "Date",
"search_index": 1,
"permlevel": 0,
"in_filter": 1
},
{
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "Mode of Payment",
"oldfieldname": "mode_of_payment",
"options": "link:Mode of Payment",
"fieldname": "mode_of_payment",
"fieldtype": "Select",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Column Break",
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break4",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "Company",
"oldfieldname": "company",
"options": "Company",
"fieldname": "company",
"fieldtype": "Link",
"search_index": 1,
"permlevel": 0,
"in_filter": 1
},
{
"print_hide": 1,
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"options": "link:Fiscal Year",
"fieldname": "fiscal_year",
"fieldtype": "Select",
"search_index": 1,
"permlevel": 0,
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Data",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Cancel Reason",
"oldfieldname": "cancel_reason",
"fieldname": "cancel_reason",
"fieldtype": "Data",
"depends_on": "eval:!doc.__islocal",
"permlevel": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Text",
"doctype": "DocField",
"label": "Remarks",
"oldfieldname": "remarks",
"fieldname": "remarks",
"fieldtype": "Small Text",
"reqd": 0,
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Section Break",
"doctype": "DocField",
"label": "Advances",
"fieldname": "advances",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Button",
"doctype": "DocField",
"label": "Get Advances Paid",
"options": "get_advances",
"fieldname": "get_advances_paid",
"fieldtype": "Button",
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Table",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Purchase Invoice Advances",
"oldfieldname": "advance_allocation_details",
"options": "Purchase Invoice Advance",
"fieldname": "advance_allocation_details",
"fieldtype": "Table",
"permlevel": 0
},
{
"oldfieldtype": "Section Break",
"doctype": "DocField",
@@ -620,22 +427,13 @@
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Column Break",
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break7",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Taxes and Charges Added",
"oldfieldname": "other_charges_added",
"fieldname": "other_charges_added",
"label": "Net Total (Import)",
"oldfieldname": "net_total_import",
"fieldname": "net_total_import",
"fieldtype": "Currency",
"permlevel": 1
},
@@ -643,9 +441,9 @@
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Taxes and Charges Deducted",
"oldfieldname": "other_charges_deducted",
"fieldname": "other_charges_deducted",
"label": "Taxes and Charges Added (Import)",
"oldfieldname": "other_charges_added_import",
"fieldname": "other_charges_added_import",
"fieldtype": "Currency",
"permlevel": 1
},
@@ -653,33 +451,32 @@
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Grand Total",
"oldfieldname": "grand_total",
"fieldname": "grand_total",
"label": "Taxes and Charges Deducted (Import)",
"oldfieldname": "other_charges_deducted_import",
"fieldname": "other_charges_deducted_import",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Grand Total (Import)",
"oldfieldname": "grand_total_import",
"fieldname": "grand_total_import",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"description": "In Words will be visible once you save the Purchase Invoice.",
"oldfieldtype": "Data",
"colour": "White:FFF",
"doctype": "DocField",
"label": "In Words",
"oldfieldname": "in_words",
"fieldname": "in_words",
"label": "In Words (Import)",
"oldfieldname": "in_words_import",
"fieldname": "in_words_import",
"fieldtype": "Data",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Column Break",
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break8",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
@@ -716,6 +513,67 @@
"permlevel": 1,
"in_filter": 1
},
{
"print_hide": 1,
"oldfieldtype": "Column Break",
"doctype": "DocField",
"width": "50%",
"fieldname": "column_break8",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"print_hide": 1,
"description": "Will be calculated automatically when you enter the details",
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Net Total",
"oldfieldname": "net_total",
"fieldname": "net_total",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Taxes and Charges Added",
"oldfieldname": "other_charges_added",
"fieldname": "other_charges_added",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Taxes and Charges Deducted",
"oldfieldname": "other_charges_deducted",
"fieldname": "other_charges_deducted",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Grand Total",
"oldfieldname": "grand_total",
"fieldname": "grand_total",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"description": "In Words will be visible once you save the Purchase Invoice.",
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "In Words",
"oldfieldname": "in_words",
"fieldname": "in_words",
"fieldtype": "Data",
"permlevel": 1
},
{
"print_hide": 1,
"no_copy": 1,
@@ -729,7 +587,6 @@
"print_hide": 1,
"no_copy": 1,
"depends_on": "eval:flt(doc.write_off_amount)!=0",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Write Off Account",
"options": "Account",
@@ -741,7 +598,6 @@
"print_hide": 1,
"no_copy": 1,
"depends_on": "eval:flt(doc.write_off_amount)!=0",
"colour": "White:FFF",
"doctype": "DocField",
"label": "Write Off Cost Center",
"options": "Account",
@@ -749,47 +605,6 @@
"fieldtype": "Link",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Taxes and Charges Added (Import)",
"oldfieldname": "other_charges_added_import",
"fieldname": "other_charges_added_import",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Taxes and Charges Deducted (Import)",
"oldfieldname": "other_charges_deducted_import",
"fieldname": "other_charges_deducted_import",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Currency",
"doctype": "DocField",
"label": "Grand Total (Import)",
"oldfieldname": "grand_total_import",
"fieldname": "grand_total_import",
"fieldtype": "Currency",
"permlevel": 1
},
{
"print_hide": 1,
"oldfieldtype": "Data",
"colour": "White:FFF",
"doctype": "DocField",
"label": "In Words (Import)",
"oldfieldname": "in_words_import",
"fieldname": "in_words_import",
"fieldtype": "Data",
"permlevel": 1
},
{
"print_hide": 1,
"no_copy": 1,
@@ -803,6 +618,176 @@
"permlevel": 0,
"report_hide": 0
},
{
"print_hide": 1,
"oldfieldtype": "Section Break",
"doctype": "DocField",
"label": "Advances",
"fieldname": "advances",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Button",
"doctype": "DocField",
"label": "Get Advances Paid",
"options": "get_advances",
"fieldname": "get_advances_paid",
"fieldtype": "Button",
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Table",
"doctype": "DocField",
"label": "Purchase Invoice Advances",
"oldfieldname": "advance_allocation_details",
"options": "Purchase Invoice Advance",
"fieldname": "advance_allocation_details",
"fieldtype": "Table",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Section Break",
"doctype": "DocField",
"label": "More Info",
"fieldname": "more_info",
"fieldtype": "Section Break",
"permlevel": 0
},
{
"print_hide": 1,
"default": "No",
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "Is Opening",
"oldfieldname": "is_opening",
"permlevel": 0,
"fieldname": "is_opening",
"fieldtype": "Select",
"search_index": 1,
"options": "No\nYes",
"in_filter": 1
},
{
"print_hide": 1,
"oldfieldtype": "Date",
"doctype": "DocField",
"label": "Aging Date",
"oldfieldname": "aging_date",
"fieldname": "aging_date",
"fieldtype": "Date",
"search_index": 0,
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "Amended From",
"oldfieldname": "amended_from",
"options": "Purchase Invoice",
"fieldname": "amended_from",
"fieldtype": "Link",
"permlevel": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Link",
"allow_on_submit": 1,
"doctype": "DocField",
"label": "Select Print Heading",
"oldfieldname": "select_print_heading",
"permlevel": 0,
"fieldname": "select_print_heading",
"fieldtype": "Link",
"options": "Print Heading",
"report_hide": 1
},
{
"print_hide": 0,
"no_copy": 0,
"oldfieldtype": "Date",
"doctype": "DocField",
"label": "Due Date",
"oldfieldname": "due_date",
"fieldname": "due_date",
"fieldtype": "Date",
"search_index": 1,
"permlevel": 0,
"in_filter": 1
},
{
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "Mode of Payment",
"oldfieldname": "mode_of_payment",
"options": "link:Mode of Payment",
"fieldname": "mode_of_payment",
"fieldtype": "Select",
"permlevel": 0
},
{
"doctype": "DocField",
"fieldname": "column_break_63",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"print_hide": 1,
"oldfieldtype": "Link",
"doctype": "DocField",
"label": "Company",
"oldfieldname": "company",
"options": "Company",
"fieldname": "company",
"fieldtype": "Link",
"search_index": 1,
"permlevel": 0,
"in_filter": 1
},
{
"print_hide": 1,
"oldfieldtype": "Select",
"doctype": "DocField",
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"options": "link:Fiscal Year",
"fieldname": "fiscal_year",
"fieldtype": "Select",
"search_index": 1,
"permlevel": 0,
"in_filter": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Data",
"doctype": "DocField",
"label": "Cancel Reason",
"oldfieldname": "cancel_reason",
"fieldname": "cancel_reason",
"fieldtype": "Data",
"depends_on": "eval:!doc.__islocal",
"permlevel": 1
},
{
"print_hide": 1,
"no_copy": 1,
"oldfieldtype": "Text",
"doctype": "DocField",
"label": "Remarks",
"oldfieldname": "remarks",
"fieldname": "remarks",
"fieldtype": "Small Text",
"reqd": 0,
"permlevel": 0
},
{
"print_hide": 1,
"no_copy": 1,
@@ -819,8 +804,8 @@
"doctype": "DocPerm",
"submit": 1,
"write": 1,
"cancel": 1,
"role": "Accounts User",
"cancel": 1,
"permlevel": 0
},
{
@@ -829,8 +814,8 @@
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"cancel": 0,
"role": "Purchase User",
"cancel": 0,
"permlevel": 1
},
{
@@ -839,8 +824,8 @@
"doctype": "DocPerm",
"submit": 0,
"write": 1,
"cancel": 0,
"role": "Purchase User",
"cancel": 0,
"permlevel": 0
},
{
@@ -849,8 +834,8 @@
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"cancel": 0,
"role": "Supplier",
"cancel": 0,
"permlevel": 0,
"match": "supplier"
},
@@ -860,8 +845,8 @@
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"cancel": 0,
"role": "Accounts Manager",
"cancel": 0,
"permlevel": 1
},
{
@@ -870,8 +855,8 @@
"doctype": "DocPerm",
"submit": 1,
"write": 1,
"cancel": 1,
"role": "Accounts Manager",
"cancel": 1,
"permlevel": 0
},
{
@@ -880,8 +865,8 @@
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"cancel": 0,
"role": "Accounts User",
"cancel": 0,
"permlevel": 1
},
{
@@ -890,8 +875,8 @@
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"cancel": 0,
"role": "Auditor",
"cancel": 0,
"permlevel": 1
},
{
@@ -900,8 +885,8 @@
"doctype": "DocPerm",
"submit": 0,
"write": 0,
"cancel": 0,
"role": "Auditor",
"cancel": 0,
"permlevel": 0
}
]

View File

@@ -26,6 +26,7 @@ from webnotes.model.doc import make_autoname
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.code import get_obj
from webnotes import session, form, msgprint
from setup.utils import get_company_currency
session = webnotes.session
@@ -412,7 +413,7 @@ class DocType(TransactionBase):
def set_in_words(self):
dcc = TransactionBase().get_company_currency(self.doc.company)
dcc = get_company_currency(self.doc.company)
self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
@@ -503,7 +504,7 @@ class DocType(TransactionBase):
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
for d in getlist(self.doclist, 'packing_details'):
bin = sql("select actual_qty, projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
bin = webnotes.conn.sql("select actual_qty, projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0