Merge branch 'master' into edge
This commit is contained in:
commit
3615123af4
@ -17,16 +17,12 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import flt, getdate
|
from webnotes.utils import flt, getdate
|
||||||
from webnotes.model.doc import make_autoname
|
|
||||||
from webnotes.model.bean import getlist
|
from webnotes.model.bean import getlist
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self,d,dl):
|
def __init__(self,d,dl):
|
||||||
self.doc, self.doclist = d,dl
|
self.doc, self.doclist = d,dl
|
||||||
|
|
||||||
def autoname(self):
|
|
||||||
self.doc.name = make_autoname(self.doc.naming_series + '.#####')
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
"""Validate invoice that c-form is applicable
|
"""Validate invoice that c-form is applicable
|
||||||
and no other c-form is received for that"""
|
and no other c-form is received for that"""
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class DocType(DocTypeNestedSet):
|
|||||||
def autoname(self):
|
def autoname(self):
|
||||||
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
|
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
|
||||||
self.doc.company_name)[0][0]
|
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):
|
def validate_mandatory(self):
|
||||||
if not self.doc.group_or_ledger:
|
if not self.doc.group_or_ledger:
|
||||||
|
|||||||
@ -34,11 +34,6 @@ class DocType(AccountsController):
|
|||||||
self.credit_days_global = -1
|
self.credit_days_global = -1
|
||||||
self.is_approving_authority = -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):
|
def validate(self):
|
||||||
if not self.doc.is_opening:
|
if not self.doc.is_opening:
|
||||||
self.doc.is_opening='No'
|
self.doc.is_opening='No'
|
||||||
|
|||||||
@ -30,7 +30,6 @@ from webnotes import _, msgprint
|
|||||||
|
|
||||||
month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
|
month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
|
||||||
|
|
||||||
|
|
||||||
from controllers.selling_controller import SellingController
|
from controllers.selling_controller import SellingController
|
||||||
|
|
||||||
class DocType(SellingController):
|
class DocType(SellingController):
|
||||||
@ -40,9 +39,6 @@ class DocType(SellingController):
|
|||||||
self.tname = 'Sales Invoice Item'
|
self.tname = 'Sales Invoice Item'
|
||||||
self.fname = 'entries'
|
self.fname = 'entries'
|
||||||
|
|
||||||
def autoname(self):
|
|
||||||
self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
super(DocType, self).validate()
|
super(DocType, self).validate()
|
||||||
self.fetch_missing_values()
|
self.fetch_missing_values()
|
||||||
|
|||||||
@ -17,28 +17,16 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.model import db_exists
|
from webnotes.model.doc import addchild
|
||||||
from webnotes.model.doc import addchild, make_autoname
|
|
||||||
from webnotes.model.bean import copy_doclist
|
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=[]):
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
# Autoname
|
|
||||||
# ---------
|
|
||||||
def autoname(self):
|
|
||||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
|
||||||
|
|
||||||
|
|
||||||
def get_item_specification_details(self):
|
def get_item_specification_details(self):
|
||||||
self.doclist = self.doc.clear_table(self.doclist, 'qa_specification_details')
|
self.doclist = self.doc.clear_table(self.doclist, 'qa_specification_details')
|
||||||
specification = sql("select specification, value from `tabItem Quality Inspection Parameter` \
|
specification = webnotes.conn.sql("select specification, value from `tabItem Quality Inspection Parameter` \
|
||||||
where parent = '%s' order by idx" % (self.doc.item_code))
|
where parent = '%s' order by idx" % (self.doc.item_code))
|
||||||
for d in specification:
|
for d in specification:
|
||||||
child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', self.doclist)
|
child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', self.doclist)
|
||||||
@ -48,13 +36,13 @@ class DocType:
|
|||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
if self.doc.purchase_receipt_no:
|
if self.doc.purchase_receipt_no:
|
||||||
sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '%s', t2.modified = '%s' \
|
webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '%s', t2.modified = '%s' \
|
||||||
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
|
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
|
||||||
% (self.doc.name, self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
|
% (self.doc.name, self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
|
||||||
|
|
||||||
|
|
||||||
def on_cancel(self):
|
def on_cancel(self):
|
||||||
if self.doc.purchase_receipt_no:
|
if self.doc.purchase_receipt_no:
|
||||||
sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
|
webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
|
||||||
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
|
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
|
||||||
% (self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
|
% (self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:11",
|
"creation": "2013-04-30 13:13:03",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-22 14:57:21",
|
"modified": "2013-05-09 14:34:10",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"autoname": "QAI/.######",
|
"autoname": "naming_series:",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
|
|||||||
@ -18,7 +18,6 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import getdate, nowdate
|
from webnotes.utils import getdate, nowdate
|
||||||
from webnotes.model.doc import make_autoname
|
|
||||||
from webnotes import msgprint, _
|
from webnotes import msgprint, _
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
@ -28,9 +27,6 @@ class DocType:
|
|||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doclist = doclist
|
self.doclist = doclist
|
||||||
|
|
||||||
def autoname(self):
|
|
||||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
|
||||||
|
|
||||||
def get_emp_name(self):
|
def get_emp_name(self):
|
||||||
return {
|
return {
|
||||||
"employee_name": webnotes.conn.get_value("Employee",
|
"employee_name": webnotes.conn.get_value("Employee",
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class DocType:
|
|||||||
if ret[0][0]=='Naming Series':
|
if ret[0][0]=='Naming Series':
|
||||||
self.doc.name = make_autoname(self.doc.naming_series + '.####')
|
self.doc.name = make_autoname(self.doc.naming_series + '.####')
|
||||||
elif ret[0][0]=='Employee Number':
|
elif ret[0][0]=='Employee Number':
|
||||||
self.doc.name = make_autoname(self.doc.employee_number)
|
self.doc.name = self.doc.employee_number
|
||||||
|
|
||||||
self.doc.employee = self.doc.name
|
self.doc.employee = self.doc.name
|
||||||
|
|
||||||
|
|||||||
@ -18,9 +18,6 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, flt, now, nowdate
|
from webnotes.utils import cstr, flt, now, nowdate
|
||||||
from webnotes.model import db_exists
|
|
||||||
from webnotes.model.doc import make_autoname
|
|
||||||
from webnotes.model.bean import copy_doclist
|
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
|
||||||
|
|||||||
@ -18,9 +18,7 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, getdate
|
from webnotes.utils import cstr, getdate
|
||||||
from webnotes.model import db_exists
|
from webnotes.model.bean import getlist
|
||||||
from webnotes.model.doc import make_autoname
|
|
||||||
from webnotes.model.bean import getlist, copy_doclist
|
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
from stock.utils import get_valid_serial_nos
|
from stock.utils import get_valid_serial_nos
|
||||||
@ -37,9 +35,6 @@ class DocType(TransactionBase):
|
|||||||
self.tname = 'Installation Note Item'
|
self.tname = 'Installation Note Item'
|
||||||
self.fname = 'installed_item_details'
|
self.fname = 'installed_item_details'
|
||||||
|
|
||||||
def autoname(self):
|
|
||||||
self.doc.name = make_autoname(self.doc.naming_series+'.#####')
|
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_fiscal_year()
|
self.validate_fiscal_year()
|
||||||
self.validate_installation_date()
|
self.validate_installation_date()
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-10 16:34:18",
|
"creation": "2013-04-30 13:13:06",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-01-22 14:56:02",
|
"modified": "2013-05-09 14:43:28",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"autoname": "IN/.####",
|
"autoname": "naming_series:",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"module": "Selling",
|
"module": "Selling",
|
||||||
@ -33,6 +33,7 @@
|
|||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"read": 1,
|
"read": 1,
|
||||||
"report": 1,
|
"report": 1,
|
||||||
|
"role": "Sales User",
|
||||||
"submit": 1,
|
"submit": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
@ -302,15 +303,6 @@
|
|||||||
"options": "Installation Note Item"
|
"options": "Installation Note Item"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm"
|
||||||
"role": "System Manager"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"role": "Sales User"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocPerm",
|
|
||||||
"role": "Sales Manager"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -57,6 +57,7 @@ class DocType(StockController):
|
|||||||
self.validate_return_reference_doc()
|
self.validate_return_reference_doc()
|
||||||
self.validate_with_material_request()
|
self.validate_with_material_request()
|
||||||
self.validate_fiscal_year()
|
self.validate_fiscal_year()
|
||||||
|
self.set_total_amount()
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.update_serial_no(1)
|
self.update_serial_no(1)
|
||||||
@ -174,6 +175,9 @@ class DocType(StockController):
|
|||||||
elif self.doc.purpose != "Material Transfer":
|
elif self.doc.purpose != "Material Transfer":
|
||||||
self.doc.production_order = None
|
self.doc.production_order = None
|
||||||
|
|
||||||
|
def set_total_amount(self):
|
||||||
|
self.doc.total_amount = sum([flt(item.amount) for item in self.doclist.get({"parentfield": "mtn_details"})])
|
||||||
|
|
||||||
def make_gl_entries(self):
|
def make_gl_entries(self):
|
||||||
if not cint(webnotes.defaults.get_global_default("auto_inventory_accounting")):
|
if not cint(webnotes.defaults.get_global_default("auto_inventory_accounting")):
|
||||||
return
|
return
|
||||||
@ -220,7 +224,7 @@ class DocType(StockController):
|
|||||||
if not flt(d.incoming_rate):
|
if not flt(d.incoming_rate):
|
||||||
d.incoming_rate = self.get_incoming_rate(args)
|
d.incoming_rate = self.get_incoming_rate(args)
|
||||||
|
|
||||||
d.amount = flt(d.qty) * flt(d.incoming_rate)
|
d.amount = flt(d.transfer_qty) * flt(d.incoming_rate)
|
||||||
|
|
||||||
def get_incoming_rate(self, args):
|
def get_incoming_rate(self, args):
|
||||||
incoming_rate = 0
|
incoming_rate = 0
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-03-28 15:56:40",
|
"creation": "2013-04-09 11:43:55",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-03-29 15:31:42",
|
"modified": "2013-05-09 13:31:00",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -518,6 +518,14 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"width": "50%"
|
"width": "50%"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "total_amount",
|
||||||
|
"fieldtype": "Currency",
|
||||||
|
"label": "Total Amount",
|
||||||
|
"options": "Company:company:default_currency",
|
||||||
|
"read_only": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "project_name",
|
"fieldname": "project_name",
|
||||||
@ -558,6 +566,14 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "col5",
|
||||||
|
"fieldtype": "Column Break",
|
||||||
|
"print_width": "50%",
|
||||||
|
"read_only": 0,
|
||||||
|
"width": "50%"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -576,14 +592,6 @@
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0
|
"search_index": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"doctype": "DocField",
|
|
||||||
"fieldname": "col5",
|
|
||||||
"fieldtype": "Column Break",
|
|
||||||
"print_width": "50%",
|
|
||||||
"read_only": 0,
|
|
||||||
"width": "50%"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
|||||||
@ -18,6 +18,7 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
from webnotes.utils import cstr
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=[]):
|
||||||
@ -29,7 +30,7 @@ class DocType:
|
|||||||
self.doc.address_title = self.doc.customer or self.doc.supplier or self.doc.sales_partner
|
self.doc.address_title = self.doc.customer or self.doc.supplier or self.doc.sales_partner
|
||||||
|
|
||||||
if self.doc.address_title:
|
if self.doc.address_title:
|
||||||
self.doc.name = self.doc.address_title + "-" + self.doc.address_type
|
self.doc.name = cstr(self.doc.address_title).strip() + "-" + cstr(self.doc.address_type).strip()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
webnotes.msgprint("""Address Title is mandatory.""", raise_exception=True)
|
webnotes.msgprint("""Address Title is mandatory.""", raise_exception=True)
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
from webnotes.utils import cstr
|
||||||
|
|
||||||
from utilities.transaction_base import TransactionBase
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
@ -32,14 +32,15 @@ class DocType(TransactionBase):
|
|||||||
webnotes.conn.set(self.doc, 'status', 'Replied')
|
webnotes.conn.set(self.doc, 'status', 'Replied')
|
||||||
|
|
||||||
def autoname(self):
|
def autoname(self):
|
||||||
if self.doc.customer:
|
# concat first and last name
|
||||||
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.customer
|
self.doc.name = " ".join(filter(None,
|
||||||
elif self.doc.supplier:
|
[cstr(self.doc.fields.get(f)).strip() for f in ["first_name", "last_name"]]))
|
||||||
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.supplier
|
|
||||||
elif self.doc.sales_partner:
|
# concat party name if reqd
|
||||||
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.sales_partner
|
for fieldname in ("customer", "supplier", "sales_partner"):
|
||||||
else:
|
if self.doc.fields.get(fieldname):
|
||||||
self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '')
|
self.doc.name = self.doc.name + "-" + cstr(self.doc.fields.get(fieldname)).strip()
|
||||||
|
break
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.validate_primary_contact()
|
self.validate_primary_contact()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user