Merge branch 'edge' of github.com:webnotes/erpnext into webshop

Conflicts:
	stock/doctype/item/item.txt
This commit is contained in:
Anand Doshi
2013-05-10 18:12:24 +05:30
65 changed files with 529 additions and 184 deletions

View File

@@ -187,7 +187,7 @@ class DocType:
sql("""delete from `tabGL Entry` where account = %s and
ifnull(is_cancelled, 'No') = 'Yes'""", self.doc.name)
def on_rename(self, new, old):
def on_rename(self, new, old, merge=False):
company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
parts = new.split(" - ")

View File

@@ -66,6 +66,6 @@ class DocType:
vouchers.append(d.voucher_id)
if vouchers:
msgprint("Clearance Date updated in %s" % vouchers)
msgprint("Clearance Date updated in %s" % ", ".join(vouchers))
else:
msgprint("Clearance Date not mentioned")

View File

@@ -17,16 +17,12 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt, getdate
from webnotes.model.doc import make_autoname
from webnotes.model.bean import getlist
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series + '.#####')
def validate(self):
"""Validate invoice that c-form is applicable
and no other c-form is received for that"""

View File

@@ -29,7 +29,7 @@ class DocType(DocTypeNestedSet):
def autoname(self):
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
self.doc.company_name)[0][0]
self.doc.name = self.doc.cost_center_name + ' - ' + company_abbr
self.doc.name = self.doc.cost_center_name.strip() + ' - ' + company_abbr
def validate_mandatory(self):
if not self.doc.group_or_ledger:
@@ -87,7 +87,7 @@ class DocType(DocTypeNestedSet):
self.validate_mandatory()
self.validate_budget_details()
def on_rename(self, new, old):
def on_rename(self, new, old, merge=False):
company_abbr = webnotes.conn.get_value("Company", self.doc.company_name, "abbr")
parts = new.split(" - ")

View File

@@ -34,15 +34,12 @@ class DocType(AccountsController):
self.credit_days_global = -1
self.is_approving_authority = -1
def autoname(self):
if not self.doc.naming_series:
webnotes.msgprint("""Naming Series is mandatory""", raise_exception=1)
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
def validate(self):
if not self.doc.is_opening:
self.doc.is_opening='No'
self.doc.clearance_date = None
self.validate_debit_credit()
self.validate_cheque_info()
self.validate_entries_for_advance()

View File

@@ -464,15 +464,17 @@ class DocType(BuyingController):
# if auto inventory accounting enabled and stock item,
# then do stock related gl entries
# expense will be booked in sales invoice
stock_item_and_auto_inventory_accounting = True
valuation_amt = (flt(item.amount, self.precision.item.amount) +
flt(item.item_tax_amount, self.precision.item.item_tax_amount) +
flt(item.rm_supp_cost, self.precision.item.rm_supp_cost))
gl_entries.append(
self.get_gl_dict({
"account": stock_account,
"against": self.doc.credit_to,
"debit": flt(item.valuation_rate) * flt(item.conversion_factor) \
* flt(item.qty),
"debit": valuation_amt,
"remarks": self.doc.remarks or "Accounting Entry for Stock"
})
)

View File

@@ -1,8 +1,8 @@
[
{
"creation": "2013-03-26 06:51:12",
"creation": "2013-04-19 11:00:06",
"docstatus": 0,
"modified": "2013-04-17 14:05:19",
"modified": "2013-05-07 11:23:56",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -35,6 +35,7 @@
"oldfieldname": "category",
"oldfieldtype": "Select",
"options": "Valuation and Total\nValuation\nTotal",
"read_only": 0,
"reqd": 1
},
{
@@ -45,6 +46,7 @@
"oldfieldname": "charge_type",
"oldfieldtype": "Select",
"options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total",
"read_only": 0,
"reqd": 1
},
{
@@ -55,6 +57,7 @@
"oldfieldname": "account_head",
"oldfieldtype": "Link",
"options": "Account",
"read_only": 0,
"reqd": 1
},
{
@@ -65,7 +68,8 @@
"label": "Cost Center",
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
"options": "Cost Center"
"options": "Cost Center",
"read_only": 0
},
{
"doctype": "DocField",
@@ -75,17 +79,18 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
"read_only": 0,
"reqd": 1,
"width": "300px"
},
{
"doctype": "DocField",
"fieldname": "rate",
"fieldtype": "Currency",
"fieldtype": "Float",
"label": "Rate",
"oldfieldname": "rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"read_only": 0,
"reqd": 0
},
{
@@ -96,6 +101,7 @@
"oldfieldname": "tax_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"read_only": 0,
"reqd": 0
},
{
@@ -115,7 +121,8 @@
"hidden": 0,
"label": "Enter Row",
"oldfieldname": "row_id",
"oldfieldtype": "Data"
"oldfieldtype": "Data",
"read_only": 0
},
{
"default": "Add",
@@ -126,6 +133,7 @@
"oldfieldname": "add_deduct_tax",
"oldfieldtype": "Select",
"options": "Add\nDeduct",
"read_only": 0,
"reqd": 1
},
{
@@ -149,6 +157,7 @@
"oldfieldname": "parenttype",
"oldfieldtype": "Data",
"print_hide": 1,
"read_only": 0,
"search_index": 0
},
{
@@ -163,6 +172,7 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"read_only": 0,
"report_hide": 1
},
{
@@ -177,6 +187,7 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"read_only": 0,
"report_hide": 1
}
]

View File

@@ -30,7 +30,6 @@ from webnotes import _, msgprint
month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
from controllers.selling_controller import SellingController
class DocType(SellingController):
@@ -40,9 +39,6 @@ class DocType(SellingController):
self.tname = 'Sales Invoice Item'
self.fname = 'entries'
def autoname(self):
self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
def validate(self):
super(DocType, self).validate()
self.fetch_missing_values()
@@ -195,11 +191,11 @@ class DocType(SellingController):
self.doc.fields[fieldname] = pos.get(fieldname)
# set pos values in items
for doc in self.doclist.get({"parentfield": "entries"}):
if doc.fields.get('item_code'):
for fieldname, val in self.apply_pos_settings(doc.fields).items():
if (not for_validate) or (for_validate and not self.doc.fields.get(fieldname)):
doc.fields[fieldname] = val
for item in self.doclist.get({"parentfield": "entries"}):
if item.fields.get('item_code'):
for fieldname, val in self.apply_pos_settings(item.fields).items():
if (not for_validate) or (for_validate and not item.fields.get(fieldname)):
item.fields[fieldname] = val
# fetch terms
if self.doc.tc_name and not self.doc.terms: