Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-05-29 10:53:58 +05:30
commit 92c2c8f1f6
9 changed files with 78 additions and 27 deletions

View File

@ -421,8 +421,8 @@ class DocType(TransactionBase):
raise Exception
def validate_pos(self):
if not self.doc.cash_bank_account:
msgprint("Cash/Bank Account is mandatory for POS entry")
if not self.doc.cash_bank_account and flt(self.doc.paid_amount):
msgprint("Cash/Bank Account is mandatory for POS, for making payment entry")
raise Exception
if (flt(self.doc.paid_amount) + flt(self.doc.write_off_amount) - round(flt(self.doc.grand_total), 2))>0.001:
msgprint("(Paid amount + Write Off Amount) can not be greater than Grand Total")
@ -676,8 +676,14 @@ class DocType(TransactionBase):
if not d.warehouse:
d.warehouse = cstr(w)
if flt(self.doc.paid_amount) == 0:
webnotes.conn.set(self.doc,'paid_amount',(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
if flt(self.doc.paid_amount) == 0:
if self.doc.cash_bank_account:
webnotes.conn.set(self.doc, 'paid_amount',
(flt(self.doc.grand_total) - flt(self.doc.write_off_amount)))
else:
# show message that the amount is not paid
webnotes.conn.set(self.doc,'paid_amount',0)
webnotes.msgprint("Note: Payment Entry not created since 'Cash/Bank Account' was not specified.")
else:
webnotes.conn.set(self.doc,'paid_amount',0)

View File

@ -407,9 +407,21 @@ class DocType(TransactionBase):
if not default_currency:
msgprint('Message: Please enter default currency in Company Master')
raise Exception
if (obj.doc.currency == default_currency and flt(obj.doc.conversion_rate) != 1.00) or not obj.doc.conversion_rate or (obj.doc.currency != default_currency and flt(obj.doc.conversion_rate) == 1.00):
msgprint("Message: Please Enter Appropriate Conversion Rate.")
raise Exception
if obj.doc.conversion_rate == 0:
msgprint('Conversion Rate cannot be 0', raise_exception=1)
elif not obj.doc.conversion_rate:
msgprint('Please specify Conversion Rate', raise_exception=1)
elif obj.doc.currency == default_currency and \
flt(obj.doc.conversion_rate) != 1.00:
msgprint("""Conversion Rate should be equal to 1.00, \
since the specified Currency and the company's currency \
are same""", raise_exception=1)
elif obj.doc.currency != default_currency and \
flt(obj.doc.conversion_rate) == 1.00:
msgprint("""Conversion Rate should not be equal to 1.00, \
since the specified Currency and the company's currency \
are different""", raise_exception=1)
def validate_doc(self, obj, prevdoc_doctype, prevdoc_docname):
if prevdoc_docname :

View File

@ -0,0 +1,16 @@
def execute():
"""
* Replace EURO with EUR
* Delete EURO from tabCurrency
"""
import webnotes
tables = webnotes.conn.sql("show tables")
for (tab,) in tables:
desc = webnotes.conn.sql("desc `%s`" % tab, as_dict=1)
for d in desc:
if "currency" in d.get('Field'):
field = d.get('Field')
webnotes.conn.sql("""\
update `%s` set `%s`='EUR'
where `%s`='EURO'""" % (tab, field, field))
webnotes.conn.sql("delete from `tabCurrency` where name='EURO'")

View File

@ -402,4 +402,9 @@ patch_list = [
'patch_file': 'profile_perm_patch',
'description': 'Make profile readonly for role All'
},
{
'patch_module': 'patches.may_2012',
'patch_file': 'remove_euro_currency',
'description': 'Remove EURO currency and replace with EUR'
},
]

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:05',
'creation': '2012-05-15 12:14:48',
'docstatus': 0,
'modified': '2012-03-27 14:45:50',
'modified': '2012-05-28 19:03:56',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -23,7 +23,7 @@
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 190
'version': 1
},
# These values are common for all DocField
@ -323,6 +323,7 @@
'fieldname': u'produced_qty',
'fieldtype': u'Currency',
'label': u'Produced Qty',
'no_copy': 1,
'oldfieldname': u'produced_qty',
'oldfieldtype': u'Currency',
'permlevel': 1

View File

@ -207,21 +207,32 @@ class DocType(TransactionBase):
if default: add_cond = 'ifnull(t2.is_default,0) = 1'
else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"'
idx = 0
other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center_other_charges from `tabSales Taxes and Charges` t1, `tabSales Taxes and Charges Master` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1)
other_charge = webnotes.conn.sql("""\
select t1.*
from
`tabSales Taxes and Charges` t1,
`tabSales Taxes and Charges Master` t2
where
t1.parent = t2.name and
t2.company = '%s' and
%s
order by t1.idx""" % (obj.doc.company, add_cond), as_dict=1)
from webnotes.model import default_fields
for other in other_charge:
d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1, obj.doclist)
d.charge_type = other['charge_type']
d.row_id = other['row_id']
d.description = other['description']
d.account_head = other['account_head']
d.cost_center_other_charges = other['cost_center_other_charges']
d.rate = flt(other['rate'])
d.tax_amount = flt(other['tax_amount'])
d.included_in_print_rate = cint(other['included_in_print_rate'])
# remove default fields like parent, parenttype etc.
# from query results
for field in default_fields:
if field in other: del other[field]
d = addchild(obj.doc, 'other_charges', 'Sales Taxes and Charges', 1,
obj.doclist)
d.fields.update(other)
d.rate = flt(d.rate)
d.tax_amount = flt(d.tax_rate)
d.included_in_print_rate = cint(d.included_in_print_rate)
d.idx = idx
idx += 1
# Get TERMS AND CONDITIONS
# =======================================================================================
def get_tc_details(self,obj):

View File

@ -20,17 +20,17 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
var route = wn.get_route();
if(route[1]=='Supplier') {
var supplier = locals.Supplier[route[2]]
var supplier = wn.container.page.frm.doc;
doc.supplier = supplier.name;
doc.supplier_name = supplier.supplier_name;
doc.address_type = 'Office';
} else if(route[1]=='Customer') {
var customer = locals.Customer[route[2]]
var customer = wn.container.page.frm.doc;
doc.customer = customer.name;
doc.customer_name = customer.customer_name;
doc.address_type = 'Office';
} else if(route[1]=='Sales Partner') {
var sp = locals['Sales Partner'][route[2]];
var sp = wn.container.page.frm.doc;
doc.sales_partner = sp.name;
doc.address_type = 'Office';
}

View File

@ -21,18 +21,18 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
var route = wn.get_route();
if(route[1]=='Supplier') {
var supplier = locals.Supplier[route[2]]
var supplier = wn.container.page.frm.doc;
doc.supplier = supplier.name;
doc.supplier_name = supplier.supplier_name;
} else if(route[1]=='Customer') {
var customer = locals.Customer[route[2]];
var customer = wn.container.page.frm.doc;
doc.customer = customer.name;
doc.customer_name = customer.customer_name;
if(customer.customer_type == 'Individual') {
doc.first_name = customer.customer_name;
}
} else if(route[1]=='Sales Partner') {
var sp = locals['Sales Partner'][route[2]];
var sp = wn.container.page.frm.doc;
doc.sales_partner = sp.name;
}
}

Binary file not shown.