Merge branch 'develop' into assessment

This commit is contained in:
Neil Trini Lasrado 2017-01-16 12:23:51 +05:30 committed by GitHub
commit 38bd62d82d
107 changed files with 1041 additions and 3602 deletions

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
__version__ = '7.2.7'
__version__ = '7.2.11'
def get_default_company(user=None):
'''Get default company for user'''

View File

@ -63,7 +63,7 @@ def validate_expense_against_budget(args):
and frappe.db.get_value("Account", {"name": args.account, "root_type": "Expense"}):
if args.project:
condition = "and exists(select name from `tabProject` where name=b.project)"
condition = "and b.project='%s'" % frappe.db.escape(args.project)
args.budget_against_field = "Project"
elif args.cost_center:
@ -88,12 +88,13 @@ def validate_expense_against_budget(args):
""".format(condition=condition,
budget_against_field=frappe.scrub(args.get("budget_against_field"))),
(args.fiscal_year, args.account), as_dict=True)
validate_budget_records(args, budget_records)
if budget_records:
validate_budget_records(args, budget_records)
def validate_budget_records(args, budget_records):
for budget in budget_records:
if budget.budget_amount:
if flt(budget.budget_amount):
yearly_action = budget.action_if_annual_budget_exceeded
monthly_action = budget.action_if_accumulated_monthly_budget_exceeded

View File

@ -35,7 +35,7 @@ def create_or_update_cheque_print_format(template_name):
</span>
<span style="top:%(date_dist_from_top_edge)s cm; left:%(date_dist_from_left_edge)scm;
position: absolute;">
{{doc.reference_date or '' }}
{{ frappe.utils.formatdate(doc.reference_date) or '' }}
</span>
<span style="top:%(acc_no_dist_from_top_edge)scm;left:%(acc_no_dist_from_left_edge)scm;
position: absolute;">

View File

@ -43,11 +43,13 @@ class FiscalYear(Document):
def on_update(self):
check_duplicate_fiscal_year(self)
frappe.cache().delete_value("fiscal_years")
def on_trash(self):
global_defaults = frappe.get_doc("Global Defaults")
if global_defaults.current_fiscal_year == self.name:
frappe.throw(_("You cannot delete Fiscal Year {0}. Fiscal Year {0} is set as default in Global Settings").format(self.name))
frappe.cache().delete_value("fiscal_years")
def validate_overlap(self):
existing_fiscal_years = frappe.db.sql("""select name from `tabFiscal Year`

View File

@ -18,22 +18,27 @@ class GLEntry(Document):
def validate(self):
self.flags.ignore_submit_comment = True
self.check_mandatory()
self.pl_must_have_cost_center()
self.check_pl_account()
self.validate_cost_center()
self.validate_party()
self.validate_currency()
self.validate_and_set_fiscal_year()
if not self.flags.from_repost:
self.pl_must_have_cost_center()
self.check_pl_account()
self.validate_cost_center()
self.validate_party()
self.validate_currency()
def on_update_with_args(self, adv_adj, update_outstanding = 'Yes'):
self.validate_account_details(adv_adj)
def on_update_with_args(self, adv_adj, update_outstanding = 'Yes', from_repost=False):
if not from_repost:
self.validate_account_details(adv_adj)
check_freezing_date(self.posting_date, adv_adj)
validate_frozen_account(self.account, adv_adj)
check_freezing_date(self.posting_date, adv_adj)
validate_balance_type(self.account, adv_adj)
# Update outstanding amt on against voucher
if self.against_voucher_type in ['Journal Entry', 'Sales Invoice', 'Purchase Invoice'] \
and self.against_voucher and update_outstanding == 'Yes':
and self.against_voucher and update_outstanding == 'Yes' and not from_repost:
update_outstanding_amt(self.account, self.party_type, self.party, self.against_voucher_type,
self.against_voucher)

View File

@ -35,9 +35,9 @@ class PeriodClosingVoucher(AccountsController):
def validate_posting_date(self):
from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year, label=_("Posting Date"), doc=self)
validate_fiscal_year(self.posting_date, self.fiscal_year, self.company, label=_("Posting Date"), doc=self)
self.year_start_date = get_fiscal_year(self.posting_date, self.fiscal_year)[1]
self.year_start_date = get_fiscal_year(self.posting_date, self.fiscal_year, company=self.company)[1]
pce = frappe.db.sql("""select name from `tabPeriod Closing Voucher`
where posting_date > %s and fiscal_year = %s and docstatus = 1""",

View File

@ -11,7 +11,7 @@ from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journ
class TestPeriodClosingVoucher(unittest.TestCase):
def test_closing_entry(self):
year_start_date = get_fiscal_year(today())[1]
year_start_date = get_fiscal_year(today(), company="_Test Company")[1]
make_journal_entry("_Test Bank - _TC", "Sales - _TC", 400,
"_Test Cost Center - _TC", posting_date=now(), submit=True)
@ -70,7 +70,7 @@ class TestPeriodClosingVoucher(unittest.TestCase):
"doctype": "Period Closing Voucher",
"closing_account_head": "_Test Account Reserves and Surplus - _TC",
"company": "_Test Company",
"fiscal_year": get_fiscal_year(today())[0],
"fiscal_year": get_fiscal_year(today(), company="_Test Company")[0],
"posting_date": today(),
"remarks": "test"
})

View File

@ -8,7 +8,7 @@ frappe.provide("erpnext.accounts");
erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
onload: function() {
this._super();
if(!this.frm.doc.__islocal) {
// show credit_to in print format
if(!this.frm.doc.supplier && this.frm.doc.credit_to) {
@ -32,7 +32,7 @@ erpnext.accounts.PurchaseInvoice = erpnext.buying.BuyingController.extend({
if(doc.update_stock==1 && doc.docstatus==1) {
this.show_stock_ledger();
}
if(!doc.is_return && doc.docstatus==1) {
if(doc.outstanding_amount != 0) {
this.frm.add_custom_button(__('Payment'), this.make_payment_entry, __("Make"));
@ -218,18 +218,6 @@ cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
}
}
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
return{
filters:{'supplier': doc.supplier}
}
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return{
filters:{'supplier': doc.supplier}
}
}
cur_frm.fields_dict['items'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
return {
query: "erpnext.controllers.queries.item_query",

View File

@ -302,11 +302,11 @@ class PurchaseInvoice(BuyingController):
asset.flags.ignore_validate_update_after_submit = True
asset.save()
def make_gl_entries(self, repost_future_gle=True):
def make_gl_entries(self, gl_entries=None, repost_future_gle=True, from_repost=False):
if not self.grand_total:
return
gl_entries = self.get_gl_entries()
if not gl_entries:
gl_entries = self.get_gl_entries()
if gl_entries:
update_outstanding = "No" if (cint(self.is_paid) or self.write_off_account) else "Yes"

View File

@ -39,14 +39,17 @@ def get_pos_data():
'pricing_rules': get_pricing_rule_data(doc),
'print_template': print_template,
'pos_profile': pos_profile,
'meta': {
'invoice': frappe.get_meta('Sales Invoice'),
'customer': frappe.get_meta('Customer'),
'items': frappe.get_meta('Sales Invoice Item'),
'taxes': frappe.get_meta('Sales Taxes and Charges')
}
'meta': get_meta()
}
def get_meta():
doctype_meta = {'customer': frappe.get_meta('Customer')}
for row in frappe.get_all('DocField', fields = ['fieldname', 'options'],
filters = {'parent': 'Sales Invoice', 'fieldtype': 'Table'}):
doctype_meta[row.fieldname] = frappe.get_meta(row.options)
return doctype_meta
def get_company_data(company):
return frappe.get_all('Company', fields = ["*"], filters= {'name': company})[0]
@ -63,10 +66,10 @@ def update_pos_profile_data(doc, pos_profile, company_data):
doc.currency = pos_profile.get('currency') or company_data.default_currency
doc.conversion_rate = 1.0
if doc.currency != company_data.default_currency:
doc.conversion_rate = get_exchange_rate(doc.currency, company_data.default_currency, doc.posting_date)
doc.selling_price_list = pos_profile.get('selling_price_list') or \
frappe.db.get_value('Selling Settings', None, 'selling_price_list')
doc.naming_series = pos_profile.get('naming_series') or 'SINV-'
@ -75,6 +78,8 @@ def update_pos_profile_data(doc, pos_profile, company_data):
doc.apply_discount_on = pos_profile.get('apply_discount_on') if pos_profile.get('apply_discount') else ''
doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group')
doc.territory = pos_profile.get('territory') or get_root('Territory')
if pos_profile.get('tc_name'):
doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms')
def get_root(table):
root = frappe.db.sql(""" select name from `tab%(table)s` having

View File

@ -532,10 +532,12 @@ class SalesInvoice(SellingController):
if d.delivery_note and frappe.db.get_value("Delivery Note", d.delivery_note, "docstatus") != 1:
throw(_("Delivery Note {0} is not submitted").format(d.delivery_note))
def make_gl_entries(self, repost_future_gle=True):
def make_gl_entries(self, gl_entries=None, repost_future_gle=True, from_repost=False):
if not self.grand_total:
return
gl_entries = self.get_gl_entries()
if not gl_entries:
gl_entries = self.get_gl_entries()
if gl_entries:
from erpnext.accounts.general_ledger import make_gl_entries
@ -651,32 +653,34 @@ class SalesInvoice(SellingController):
def make_pos_gl_entries(self, gl_entries):
if cint(self.is_pos):
for payment_mode in self.payments:
# POS, make payment entries
gl_entries.append(
self.get_gl_dict({
"account": self.debit_to,
"party_type": "Customer",
"party": self.customer,
"against": payment_mode.account,
"credit": payment_mode.base_amount,
"credit_in_account_currency": payment_mode.base_amount \
if self.party_account_currency==self.company_currency \
else payment_mode.amount,
"against_voucher": self.return_against if cint(self.is_return) else self.name,
"against_voucher_type": self.doctype,
}, self.party_account_currency)
)
if payment_mode.amount:
# POS, make payment entries
gl_entries.append(
self.get_gl_dict({
"account": self.debit_to,
"party_type": "Customer",
"party": self.customer,
"against": payment_mode.account,
"credit": payment_mode.base_amount,
"credit_in_account_currency": payment_mode.base_amount \
if self.party_account_currency==self.company_currency \
else payment_mode.amount,
"against_voucher": self.return_against if cint(self.is_return) else self.name,
"against_voucher_type": self.doctype,
}, self.party_account_currency)
)
payment_mode_account_currency = get_account_currency(payment_mode.account)
gl_entries.append(
self.get_gl_dict({
"account": payment_mode.account,
"against": self.customer,
"debit": payment_mode.base_amount,
"debit_in_account_currency": payment_mode.base_amount \
if payment_mode_account_currency==self.company_currency else payment_mode.amount
}, payment_mode_account_currency)
)
payment_mode_account_currency = get_account_currency(payment_mode.account)
gl_entries.append(
self.get_gl_dict({
"account": payment_mode.account,
"against": self.customer,
"debit": payment_mode.base_amount,
"debit_in_account_currency": payment_mode.base_amount \
if payment_mode_account_currency==self.company_currency \
else payment_mode.amount
}, payment_mode_account_currency)
)
def make_gle_for_change_amount(self, gl_entries):
if cint(self.is_pos) and self.change_amount:

View File

@ -7,6 +7,7 @@ import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import cstr, cint
from frappe.geo.doctype.address.address import get_default_address
class IncorrectCustomerGroup(frappe.ValidationError): pass
class IncorrectSupplierType(frappe.ValidationError): pass
@ -96,27 +97,31 @@ class TaxRule(Document):
@frappe.whitelist()
def get_party_details(party, party_type, args=None):
out = {}
billing_address, shipping_address = None, None
if args:
billing_filters= {"name": args.get("billing_address")}
shipping_filters= {"name": args.get("shipping_address")}
if args.get('billing_address'):
billing_address = frappe.get_doc('Address', args.get('billing_address'))
if args.get('shipping_address'):
shipping_address = frappe.get_doc('Address', args.get('shipping_address'))
else:
billing_filters= {party_type: party, "is_primary_address": 1}
shipping_filters= {party_type:party, "is_shipping_address": 1}
billing_address= frappe.get_all("Address", fields=["city", "county", "state", "country"], filters= billing_filters)
shipping_address= frappe.get_all("Address", fields=["city", "county", "state", "country"], filters= shipping_filters)
billing_address_name = get_default_address(party_type, party)
shipping_address_name = get_default_address(party_type, party, 'is_shipping_address')
if billing_address_name:
billing_address = frappe.get_doc('Address', billing_address_name)
if shipping_address_name:
shipping_address = frappe.get_doc('Address', shipping_address_name)
if billing_address:
out["billing_city"]= billing_address[0].city
out["billing_county"]= billing_address[0].county
out["billing_state"]= billing_address[0].state
out["billing_country"]= billing_address[0].country
out["billing_city"]= billing_address.city
out["billing_county"]= billing_address.county
out["billing_state"]= billing_address.state
out["billing_country"]= billing_address.country
if shipping_address:
out["shipping_city"]= shipping_address[0].city
out["shipping_county"]= shipping_address[0].county
out["shipping_state"]= shipping_address[0].state
out["shipping_country"]= shipping_address[0].country
out["shipping_city"]= shipping_address.city
out["shipping_county"]= shipping_address.county
out["shipping_state"]= shipping_address.state
out["shipping_country"]= shipping_address.country
return out

View File

@ -11,12 +11,12 @@ from erpnext.accounts.doctype.budget.budget import validate_expense_against_budg
class StockAccountInvalidTransaction(frappe.ValidationError): pass
def make_gl_entries(gl_map, cancel=False, adv_adj=False, merge_entries=True, update_outstanding='Yes'):
def make_gl_entries(gl_map, cancel=False, adv_adj=False, merge_entries=True, update_outstanding='Yes', from_repost=False):
if gl_map:
if not cancel:
gl_map = process_gl_map(gl_map, merge_entries)
if gl_map and len(gl_map) > 1:
save_entries(gl_map, adv_adj, update_outstanding)
save_entries(gl_map, adv_adj, update_outstanding, from_repost)
else:
frappe.throw(_("Incorrect number of General Ledger Entries found. You might have selected a wrong Account in the transaction."))
else:
@ -78,21 +78,26 @@ def check_if_in_list(gle, gl_map):
and cstr(e.get('project')) == cstr(gle.get('project')):
return e
def save_entries(gl_map, adv_adj, update_outstanding):
validate_account_for_auto_accounting_for_stock(gl_map)
def save_entries(gl_map, adv_adj, update_outstanding, from_repost=False):
if not from_repost:
validate_account_for_auto_accounting_for_stock(gl_map)
round_off_debit_credit(gl_map)
for entry in gl_map:
make_entry(entry, adv_adj, update_outstanding)
make_entry(entry, adv_adj, update_outstanding, from_repost)
# check against budget
validate_expense_against_budget(entry)
if not from_repost:
validate_expense_against_budget(entry)
def make_entry(args, adv_adj, update_outstanding):
def make_entry(args, adv_adj, update_outstanding, from_repost=False):
args.update({"doctype": "GL Entry"})
gle = frappe.get_doc(args)
gle.flags.ignore_permissions = 1
gle.flags.from_repost = from_repost
gle.insert()
gle.run_method("on_update_with_args", adv_adj, update_outstanding)
gle.run_method("on_update_with_args", adv_adj, update_outstanding, from_repost)
gle.submit()
def validate_account_for_auto_accounting_for_stock(gl_map):

View File

@ -8,8 +8,8 @@ import datetime
from frappe import _, msgprint, scrub
from frappe.defaults import get_user_permissions
from frappe.utils import add_days, getdate, formatdate, get_first_day, date_diff, add_years
from erpnext.utilities.doctype.address.address import get_address_display
from erpnext.utilities.doctype.contact.contact import get_contact_details
from frappe.geo.doctype.address.address import get_address_display, get_default_address
from frappe.email.doctype.contact.contact import get_contact_details, get_default_contact
from erpnext.exceptions import PartyFrozen, InvalidCurrency, PartyDisabled, InvalidAccountCurrency
class DuplicatePartyAccountError(frappe.ValidationError): pass
@ -60,21 +60,18 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
def set_address_details(out, party, party_type):
billing_address_field = "customer_address" if party_type == "Lead" \
else party_type.lower() + "_address"
out[billing_address_field] = frappe.db.get_value("Address",
{party_type.lower(): party.name, "is_primary_address":1}, "name")
out[billing_address_field] = get_default_address(party_type, party.name)
# address display
out.address_display = get_address_display(out[billing_address_field])
# shipping address
if party_type in ["Customer", "Lead"]:
out.shipping_address_name = frappe.db.get_value("Address",
{party_type.lower(): party.name, "is_shipping_address":1}, "name")
out.shipping_address_name = get_default_address(party_type, party.name, 'is_shipping_address')
out.shipping_address = get_address_display(out["shipping_address_name"])
def set_contact_details(out, party, party_type):
out.contact_person = frappe.db.get_value("Contact",
{party_type.lower(): party.name, "is_primary_contact":1}, "name")
out.contact_person = get_default_contact(party_type, party.name)
if not out.contact_person:
out.update({
@ -184,7 +181,7 @@ def get_party_account(party_type, party, company):
default_account_name = "default_receivable_account" \
if party_type=="Customer" else "default_payable_account"
account = frappe.db.get_value("Company", company, default_account_name)
existing_gle_currency = get_party_gle_currency(party_type, party, company)
if existing_gle_currency:
if account:
@ -211,7 +208,7 @@ def get_party_gle_currency(party_type, party, company):
return frappe.local_cache("party_gle_currency", (party_type, party, company), generator,
regenerate_if_none=True)
def get_party_gle_account(party_type, party, company):
def generator():
existing_gle_account = frappe.db.sql("""select account from `tabGL Entry`

View File

@ -7,10 +7,10 @@
"docstatus": 0,
"doctype": "Print Format",
"font": "Default",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ company }}<br>\n\t{{ __(\"POS No : \") }}{{offline_pos_name}}<br>\n</p>\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ __(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{% for item in items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ format_number(item.qty, precision(\"difference\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(paid_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>",
"html": "<style>\n\t.print-format table, .print-format tr, \n\t.print-format td, .print-format div, .print-format p {\n\t\tfont-family: Monospace;\n\t\tline-height: 200%;\n\t\tvertical-align: middle;\n\t}\n\t@media screen {\n\t\t.print-format {\n\t\t\twidth: 4in;\n\t\t\tpadding: 0.25in;\n\t\t\tmin-height: 8in;\n\t\t}\n\t}\n</style>\n\n<p class=\"text-center\">\n\t{{ company }}<br>\n\t{{ __(\"POS No : \") }}{{offline_pos_name}}<br>\n</p>\n<p>\n\t<b>{{ __(\"Date\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\n</p>\n\n<hr>\n<table class=\"table table-condensed cart no-border\">\n\t<thead>\n\t\t<tr>\n\t\t\t<th width=\"50%\">{{ __(\"Item\") }}</b></th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Qty\") }}</th>\n\t\t\t<th width=\"25%\" class=\"text-right\">{{ __(\"Amount\") }}</th>\n\t\t</tr>\n\t</thead>\n\t<tbody>\n\t\t{% for item in items %}\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\t{{ item.item_name }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">{{ format_number(item.qty, precision(\"difference\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\n\t\t\t<td class=\"text-right\">{{ format_currency(item.amount, currency) }}</td>\n\t\t</tr>\n\t\t{% endfor %}\n\t</tbody>\n</table>\n\n<table class=\"table table-condensed no-border\">\n\t<tbody>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ __(\"Net Total\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% for row in taxes %}\n\t\t{% if not row.included_in_print_rate %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 70%\">\n\t\t\t\t{{ row.description }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(row.tax_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t{% endfor %}\n\t\t{% if discount_amount %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t{{ __(\"Discount\") }}\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(discount_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t{% endif %}\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Grand Total\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(grand_total, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=\"text-right\" style=\"width: 75%\">\n\t\t\t\t<b>{{ __(\"Paid Amount\") }}</b>\n\t\t\t</td>\n\t\t\t<td class=\"text-right\">\n\t\t\t\t{{ format_currency(paid_amount, currency) }}\n\t\t\t</td>\n\t\t</tr>\n\t</tbody>\n</table>\n\n\n<hr>\n<p>{{ terms }}</p>\n<p class=\"text-center\">{{ __(\"Thank you, please visit again.\") }}</p>",
"idx": 0,
"line_breaks": 0,
"modified": "2016-12-27 17:22:17.391673",
"modified": "2017-01-12 14:56:12.571032",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Point of Sale",

View File

@ -10,7 +10,8 @@ from erpnext.accounts.utils import get_fiscal_year
def execute(filters=None):
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year, filters.periodicity)
period_list = get_period_list(filters.from_fiscal_year, filters.to_fiscal_year,
filters.periodicity)
operation_accounts = {
"section_name": "Operations",
@ -103,7 +104,7 @@ def get_account_type_based_data(company, account_type, period_list, accumulated_
data = {}
total = 0
for period in period_list:
start_date = get_start_date(period, accumulated_values)
start_date = get_start_date(period, accumulated_values, company)
gl_sum = frappe.db.sql_list("""
select sum(credit) - sum(debit)
from `tabGL Entry`
@ -126,10 +127,10 @@ def get_account_type_based_data(company, account_type, period_list, accumulated_
data["total"] = total
return data
def get_start_date(period, accumulated_values):
def get_start_date(period, accumulated_values, company):
start_date = period["year_start_date"]
if accumulated_values:
start_date = get_fiscal_year(period.to_date)[1]
start_date = get_fiscal_year(period.to_date, company=company)[1]
return start_date

View File

@ -3,10 +3,8 @@
from __future__ import unicode_literals
import frappe
import math
from frappe import _
from frappe.utils import (flt, getdate, get_first_day, get_last_day, date_diff,
add_months, add_days, formatdate, cint)
from frappe.utils import flt, getdate, get_first_day, add_months, add_days, formatdate
def get_period_list(from_fiscal_year, to_fiscal_year, periodicity):
"""Get a list of dict {"from_date": from_date, "to_date": to_date, "key": key, "label": label}
@ -149,7 +147,6 @@ def calculate_values(accounts_by_name, gl_entries_by_account, period_list, accum
def get_date_fiscal_year(date):
from erpnext.accounts.utils import get_fiscal_year
return get_fiscal_year(date)[0]
def accumulate_values_into_parents(accounts, accounts_by_name, period_list, accumulated_values):

View File

@ -20,32 +20,63 @@ def get_fiscal_year(date=None, fiscal_year=None, label="Date", verbose=1, compan
return get_fiscal_years(date, fiscal_year, label, verbose, company, as_dict=as_dict)[0]
def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verbose=1, company=None, as_dict=False):
# if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate)
cond = " disabled = 0"
if fiscal_year:
cond += " and fy.name = %(fiscal_year)s"
else:
cond += " and %(transaction_date)s >= fy.year_start_date and %(transaction_date)s <= fy.year_end_date"
fiscal_years = frappe.cache().hget("fiscal_years", company) or []
if not fiscal_years:
# if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate)
cond = ""
if fiscal_year:
cond += " and fy.name = {0}".format(frappe.db.escape(fiscal_year))
if company:
cond += """
and (not exists (select name
from `tabFiscal Year Company` fyc
where fyc.parent = fy.name)
or exists(select company
from `tabFiscal Year Company` fyc
where fyc.parent = fy.name
and fyc.company=%(company)s)
)
"""
if company:
cond += """ and (not exists(select name from `tabFiscal Year Company` fyc where fyc.parent = fy.name)
or exists(select company from `tabFiscal Year Company` fyc where fyc.parent = fy.name and fyc.company=%(company)s ))"""
fiscal_years = frappe.db.sql("""
select
fy.name, fy.year_start_date, fy.year_end_date
from
`tabFiscal Year` fy
where
disabled = 0 {0}
order by
fy.year_start_date desc""".format(cond), {
"company": company
}, as_dict=True)
frappe.cache().hset("fiscal_years", company, fiscal_years)
fy = frappe.db.sql("""select fy.name, fy.year_start_date, fy.year_end_date from `tabFiscal Year` fy
where %s order by fy.year_start_date desc""" % cond, {
"fiscal_year": fiscal_year,
"transaction_date": transaction_date,
"company": company
}, as_dict=as_dict)
if transaction_date:
transaction_date = getdate(transaction_date)
if not fy:
error_msg = _("""{0} {1} not in any active Fiscal Year. For more details check {2}.""").format(label, formatdate(transaction_date), "https://frappe.github.io/erpnext/user/manual/en/accounts/articles/fiscal-year-error")
if verbose==1: frappe.msgprint(error_msg)
raise FiscalYearError, error_msg
return fy
for fy in fiscal_years:
matched = False
if fiscal_year and fy.name == fiscal_year:
matched = True
def validate_fiscal_year(date, fiscal_year, label=_("Date"), doc=None):
years = [f[0] for f in get_fiscal_years(date, label=label)]
if (transaction_date and getdate(fy.year_start_date) <= transaction_date
and getdate(fy.year_end_date) >= transaction_date):
matched = True
if matched:
if as_dict:
return (fy,)
else:
return ((fy.name, fy.year_start_date, fy.year_end_date),)
error_msg = _("""{0} {1} not in any active Fiscal Year.""").format(label, formatdate(transaction_date))
if verbose==1: frappe.msgprint(error_msg)
raise FiscalYearError, error_msg
def validate_fiscal_year(date, fiscal_year, company, label=_("Date"), doc=None):
years = [f[0] for f in get_fiscal_years(date, label=label, company=company)]
if fiscal_year not in years:
if doc:
doc.fiscal_year = years[0]
@ -206,9 +237,12 @@ def get_count_on(account, fieldname, date):
@frappe.whitelist()
def add_ac(args=None):
from frappe.desk.treeview import make_tree_args
if not args:
args = frappe.local.form_dict
args.pop("cmd")
args = make_tree_args(**args)
ac = frappe.new_doc("Account")
@ -233,9 +267,12 @@ def add_ac(args=None):
@frappe.whitelist()
def add_cc(args=None):
from frappe.desk.treeview import make_tree_args
if not args:
args = frappe.local.form_dict
args.pop("cmd")
args = make_tree_args(**args)
cc = frappe.new_doc("Cost Center")
cc.update(args)

View File

@ -50,13 +50,9 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
});
}
$.each([["supplier", "supplier"],
["contact_person", "supplier_filter"],
["supplier_address", "supplier_filter"]],
function(i, opts) {
if(me.frm.fields_dict[opts[0]])
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
});
me.frm.set_query('supplier', erpnext.queries.supplier);
me.frm.set_query('contact_person', erpnext.queries.contact_query);
me.frm.set_query('supplier_address', erpnext.queries.address_query);
if(this.frm.fields_dict.supplier) {
this.frm.set_query("supplier", function() {
@ -79,6 +75,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
},
refresh: function(doc) {
frappe.contact_link = {doc: this.frm.doc, fieldname: 'supplier', doctype: 'Supplier'};
this.frm.toggle_display("supplier_name",
(this.frm.doc.supplier_name && this.frm.doc.supplier_name!==this.frm.doc.supplier));

View File

@ -226,18 +226,6 @@ cur_frm.cscript.update_status= function(label, status){
})
}
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
return {
filters: {'supplier': doc.supplier}
}
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return {
filters: {'supplier': doc.supplier}
}
}
cur_frm.fields_dict['items'].grid.get_field('project').get_query = function(doc, cdt, cdn) {
return {
filters:[

View File

@ -16,6 +16,8 @@ frappe.ui.form.on("Supplier", {
});
},
refresh: function(frm) {
frappe.contact_link = {doc: frm.doc, fieldname: 'name', doctype: 'Supplier'}
if(frappe.defaults.get_default("supp_master_name")!="Naming Series") {
frm.toggle_display("naming_series", false);
} else {

View File

@ -6,7 +6,9 @@ import frappe
import frappe.defaults
from frappe import msgprint, _
from frappe.model.naming import make_autoname
from erpnext.utilities.address_and_contact import load_address_and_contact
from erpnext.utilities.address_and_contact import (load_address_and_contact,
delete_contact_and_address)
from erpnext.utilities.transaction_base import TransactionBase
from erpnext.accounts.party import validate_party_accounts, get_timeline_data # keep this
from erpnext.accounts.party_status import get_party_status
@ -46,21 +48,10 @@ class Supplier(TransactionBase):
else:
self.name = make_autoname(self.naming_series + '.#####')
def update_address(self):
frappe.db.sql("""update `tabAddress` set supplier_name=%s, modified=NOW()
where supplier=%s""", (self.supplier_name, self.name))
def update_contact(self):
frappe.db.sql("""update `tabContact` set supplier_name=%s, modified=NOW()
where supplier=%s""", (self.supplier_name, self.name))
def on_update(self):
if not self.naming_series:
self.naming_series = ''
self.update_address()
self.update_contact()
def validate(self):
#validation for Naming Series mandatory field...
if frappe.defaults.get_global_default('supp_master_name') == 'Naming Series':
@ -78,28 +69,9 @@ class Supplier(TransactionBase):
else:
return ''
def delete_supplier_address(self):
for rec in frappe.db.sql("select * from `tabAddress` where supplier=%s", (self.name,), as_dict=1):
frappe.db.sql("delete from `tabAddress` where name=%s",(rec['name']))
def delete_supplier_contact(self):
for contact in frappe.db.sql_list("""select name from `tabContact`
where supplier=%s""", self.name):
frappe.delete_doc("Contact", contact)
def on_trash(self):
self.delete_supplier_address()
self.delete_supplier_contact()
delete_contact_and_address('Supplier', self.name)
def after_rename(self, olddn, newdn, merge=False):
set_field = ''
if frappe.defaults.get_global_default('supp_master_name') == 'Supplier Name':
frappe.db.set(self, "supplier_name", newdn)
self.update_contact()
set_field = ", supplier_name=%(newdn)s"
self.update_supplier_address(newdn, set_field)
def update_supplier_address(self, newdn, set_field):
frappe.db.sql("""update `tabAddress` set address_title=%(newdn)s
{set_field} where supplier=%(newdn)s"""\
.format(set_field=set_field), ({"newdn": newdn}))

View File

@ -59,15 +59,3 @@ cur_frm.fields_dict['items'].grid.get_field('project').get_query =
]
}
}
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
return {
filters:{'supplier': doc.supplier}
}
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return {
filters:{'supplier': doc.supplier}
}
}

View File

@ -232,7 +232,7 @@ def get_data():
{
"type": "report",
"is_query_report": True,
"name": "Monthly Salary Register",
"name": "Salary Register",
"doctype": "Salary Slip"
},
{

View File

@ -113,7 +113,7 @@ class AccountsController(TransactionBase):
date_field = "transaction_date"
if date_field and self.get(date_field):
validate_fiscal_year(self.get(date_field), self.fiscal_year,
validate_fiscal_year(self.get(date_field), self.fiscal_year, self.company,
self.meta.get_label(date_field), self)
def validate_due_date(self):

View File

@ -1,61 +0,0 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.add_fetch('customer', 'customer_name', 'customer_name');
cur_frm.add_fetch('supplier', 'supplier_name', 'supplier_name');
cur_frm.fields_dict.customer.get_query = erpnext.queries.customer;
cur_frm.fields_dict.supplier.get_query = erpnext.queries.supplier;
if(cur_frm.fields_dict.lead) {
cur_frm.fields_dict.lead.get_query = erpnext.queries.lead;
cur_frm.add_fetch('lead', 'lead_name', 'lead_name');
}
if(doc.__islocal) {
var last_route = frappe.route_history.slice(-2, -1)[0];
if(last_route && last_route[0]==="Form") {
var doctype = last_route[1],
docname = last_route.slice(2).join("/");
if(["Customer", "Quotation", "Sales Order", "Sales Invoice", "Delivery Note",
"Installation Note", "Opportunity", "Warranty Claim", "Maintenance Visit",
"Maintenance Schedule"]
.indexOf(doctype)!==-1) {
var refdoc = frappe.get_doc(doctype, docname);
if((refdoc.doctype == "Quotation" && refdoc.quotation_to=="Customer") ||
(refdoc.doctype == "Opportunity" && refdoc.enquiry_from=="Customer") ||
!in_list(["Opportunity", "Quotation"], doctype)) {
cur_frm.set_value("customer", refdoc.customer || refdoc.name);
cur_frm.set_value("customer_name", refdoc.customer_name);
if(cur_frm.doc.doctype==="Address")
cur_frm.set_value("address_title", cur_frm.doc.customer_name);
}
}
else if(["Supplier", "Supplier Quotation", "Purchase Order", "Purchase Invoice", "Purchase Receipt"]
.indexOf(doctype)!==-1) {
var refdoc = frappe.get_doc(doctype, docname);
cur_frm.set_value("supplier", refdoc.supplier || refdoc.name);
cur_frm.set_value("supplier_name", refdoc.supplier_name);
if(cur_frm.doc.doctype==="Address")
cur_frm.set_value("address_title", cur_frm.doc.supplier_name);
}
else if(["Lead", "Opportunity", "Quotation"]
.indexOf(doctype)!==-1) {
var refdoc = frappe.get_doc(doctype, docname);
if((refdoc.doctype == "Quotation" && refdoc.quotation_to=="Lead") ||
(refdoc.doctype == "Opportunity" && refdoc.enquiry_from=="Lead") || (doctype=="Lead")) {
cur_frm.set_value("lead", refdoc.lead || refdoc.name);
cur_frm.set_value("lead_name", refdoc.customer_name || refdoc.company_name || refdoc.lead_name);
if(cur_frm.doc.doctype==="Address")
cur_frm.set_value("address_title", cur_frm.doc.lead_name);
}
}
else if(doctype == "Sales Partner") {
cur_frm.set_value("sales_partner", docname);
}
}
}
}

View File

@ -3,32 +3,9 @@
from __future__ import unicode_literals
import frappe
from frappe.desk.reportview import get_match_cond
from frappe.model.db_query import DatabaseQuery
from frappe.desk.reportview import get_match_cond, get_filters_cond
from frappe.utils import nowdate
def get_filters_cond(doctype, filters, conditions):
if filters:
flt = filters
if isinstance(filters, dict):
filters = filters.items()
flt = []
for f in filters:
if isinstance(f[1], basestring) and f[1][0] == '!':
flt.append([doctype, f[0], '!=', f[1][1:]])
else:
value = frappe.db.escape(f[1]) if isinstance(f[1], basestring) else f[1]
flt.append([doctype, f[0], '=', value])
query = DatabaseQuery(doctype)
query.filters = flt
query.conditions = conditions
query.build_filter_conditions(flt, conditions)
cond = ' and ' + ' and '.join(query.conditions)
else:
cond = ''
return cond
# searches for active employees
def employee_query(doctype, txt, searchfield, start, page_len, filters):
@ -88,7 +65,7 @@ def customer_query(doctype, txt, searchfield, start, page_len, filters):
fields = ["name", "customer_group", "territory"]
else:
fields = ["name", "customer_name", "customer_group", "territory"]
meta = frappe.get_meta("Customer")
fields = fields + [f for f in meta.get_search_fields() if not f in fields]

View File

@ -103,6 +103,8 @@ class StatusUpdater(Document):
def set_status(self, update=False, status=None, update_modified=True):
if self.is_new():
if self.get('amended_from'):
self.status = 'Draft'
return
if self.doctype in status_map:

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, flt, cstr
from frappe.utils import cint, flt, cstr, now
from frappe import msgprint, _
import frappe.defaults
from erpnext.accounts.utils import get_fiscal_year
@ -15,7 +15,7 @@ class StockController(AccountsController):
super(StockController, self).validate()
self.validate_inspection()
def make_gl_entries(self, repost_future_gle=True):
def make_gl_entries(self, gl_entries=None, repost_future_gle=True, from_repost=False):
if self.docstatus == 2:
delete_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
@ -23,8 +23,9 @@ class StockController(AccountsController):
warehouse_account = get_warehouse_account()
if self.docstatus==1:
gl_entries = self.get_gl_entries(warehouse_account)
make_gl_entries(gl_entries)
if not gl_entries:
gl_entries = self.get_gl_entries(warehouse_account)
make_gl_entries(gl_entries, from_repost=from_repost)
if repost_future_gle:
items, warehouses = self.get_items_and_warehouses()
@ -224,7 +225,7 @@ class StockController(AccountsController):
def make_gl_entries_on_cancel(self, repost_future_gle=True):
if frappe.db.sql("""select name from `tabGL Entry` where voucher_type=%s
and voucher_no=%s""", (self.doctype, self.name)):
self.make_gl_entries(repost_future_gle)
self.make_gl_entries(repost_future_gle=repost_future_gle)
def get_serialized_items(self):
serialized_items = []
@ -308,7 +309,7 @@ def update_gl_entries_after(posting_date, posting_time, for_warehouses=None, for
if expected_gle:
if not existing_gle or not compare_existing_and_expected_gle(existing_gle, expected_gle):
_delete_gl_entries(voucher_type, voucher_no)
voucher_obj.make_gl_entries(repost_future_gle=False)
voucher_obj.make_gl_entries(gl_entries=expected_gle, repost_future_gle=False, from_repost=True)
else:
_delete_gl_entries(voucher_type, voucher_no)
@ -363,10 +364,14 @@ def get_voucherwise_gl_entries(future_stock_vouchers, posting_date):
return gl_entries
def get_warehouse_account():
warehouse_account = frappe._dict()
if not frappe.flags.warehouse_account_map:
warehouse_account = frappe._dict()
for d in frappe.db.sql("""select warehouse, name, account_currency from tabAccount
where account_type = 'Stock' and (warehouse is not null and warehouse != ''
and is_group != 1) and is_group=0 """, as_dict=1):
warehouse_account.setdefault(d.warehouse, d)
return warehouse_account
for d in frappe.db.sql("""select warehouse, name, account_currency from tabAccount
where account_type = 'Stock' and (warehouse is not null and warehouse != ''
and is_group != 1) and is_group=0 """, as_dict=1):
warehouse_account.setdefault(d.warehouse, d)
frappe.flags.warehouse_account_map = warehouse_account
return frappe.flags.warehouse_account_map

View File

@ -6,9 +6,14 @@ frappe.provide("erpnext.crm");
cur_frm.email_field = "contact_email";
frappe.ui.form.on("Opportunity", {
customer: function(frm) {
frm.trigger('set_contact_link');
erpnext.utils.get_party_details(frm);
},
lead: function(frm) {
frm.trigger('set_contact_link');
},
customer_address: function(frm, cdt, cdn) {
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display', false);
},
@ -23,6 +28,8 @@ frappe.ui.form.on("Opportunity", {
refresh: function(frm) {
var doc = frm.doc;
frm.events.enquiry_from(frm);
frm.trigger('set_contact_link');
if(doc.status!=="Lost") {
if(doc.with_items){
frm.add_custom_button(__('Supplier Quotation'),
@ -35,7 +42,7 @@ frappe.ui.form.on("Opportunity", {
cur_frm.cscript.create_quotation, __("Make"));
frm.page.set_inner_btn_group_as_primary(__("Make"));
if(doc.status!=="Quotation") {
frm.add_custom_button(__('Lost'),
cur_frm.cscript['Declare Opportunity Lost']);
@ -43,6 +50,14 @@ frappe.ui.form.on("Opportunity", {
}
},
set_contact_link: function(frm) {
if(frm.doc.customer) {
frappe.contact_link = {doc: frm.doc, fieldname: 'customer', doctype: 'Customer'}
} else if(frm.doc.lead) {
frappe.contact_link = {doc: frm.doc, fieldname: 'lead', doctype: 'Lead'}
}
},
make_supplier_quotation: function(frm) {
frappe.model.open_mapped_doc({
method: "erpnext.crm.doctype.opportunity.opportunity.make_supplier_quotation",
@ -62,7 +77,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
if(!this.frm.doc.status)
set_multiple(this.frm.doc.doctype, this.frm.doc.name, { status:'Open' });
if(!this.frm.doc.company && frappe.defaults.get_user_default("Company"))
set_multiple(this.frm.doc.doctype, this.frm.doc.name,
set_multiple(this.frm.doc.doctype, this.frm.doc.name,
{ company:frappe.defaults.get_user_default("Company") });
this.setup_queries();
@ -75,10 +90,7 @@ erpnext.crm.Opportunity = frappe.ui.form.Controller.extend({
this.frm.set_query("contact_by", erpnext.queries.user);
}
this.frm.set_query("customer_address", function() {
if(me.frm.doc.lead) return {filters: { lead: me.frm.doc.lead } };
else if(me.frm.doc.customer) return {filters: { customer: me.frm.doc.customer } };
});
me.frm.set_query('customer_address', erpnext.queries.address_query);
this.frm.set_query("item_code", "items", function() {
return {

View File

@ -1,245 +1,218 @@
[
{
"address_line1": "254 Theotokopoulou Str.",
"address_type": "Office",
"city": "Larnaka",
"country": "Cyprus",
"customer": "Adaptas",
"phone": "23566775757",
"supplier": null
},
"address_line1": "254 Theotokopoulou Str.",
"address_type": "Office",
"city": "Larnaka",
"country": "Cyprus",
"links": [{"link_doctype": "Customer", "link_name": "Adaptas"}],
"phone": "23566775757"
},
{
"address_line1": "R Patr\u00e3o Caramelho 116",
"address_type": "Office",
"city": "Fajozes",
"country": "Portugal",
"customer": "Asian Fusion",
"phone": "23566775757",
"supplier": null
},
"address_line1": "R Patr\u00e3o Caramelho 116",
"address_type": "Office",
"city": "Fajozes",
"country": "Portugal",
"links": [{"link_doctype": "Customer", "link_name": "Asian Fusion"}],
"phone": "23566775757"
},
{
"address_line1": "30 Fulford Road",
"address_type": "Office",
"city": "PENTRE-PIOD",
"country": "United Kingdom",
"customer": "Asian Junction",
"phone": "23566775757",
"supplier": null
},
"address_line1": "30 Fulford Road",
"address_type": "Office",
"city": "PENTRE-PIOD",
"country": "United Kingdom",
"links": [{"link_doctype": "Customer", "link_name": "Asian Junction"}],
"phone": "23566775757"
},
{
"address_line1": "Schoenebergerstrasse 13",
"address_type": "Office",
"city": "Raschau",
"country": "Germany",
"customer": "Big D Supermarkets",
"phone": "23566775757",
"supplier": null
},
"address_line1": "Schoenebergerstrasse 13",
"address_type": "Office",
"city": "Raschau",
"country": "Germany",
"links": [{"link_doctype": "Customer", "link_name": "Big D Supermarkets"}],
"phone": "23566775757"
},
{
"address_line1": "Hoheluftchaussee 43",
"address_type": "Office",
"city": "Kieritzsch",
"country": "Germany",
"customer": "Buttrey Food & Drug",
"phone": "23566775757",
"supplier": null
},
"address_line1": "Hoheluftchaussee 43",
"address_type": "Office",
"city": "Kieritzsch",
"country": "Germany",
"links": [{"link_doctype": "Customer", "link_name": "Buttrey Food & Drug"}],
"phone": "23566775757"
},
{
"address_line1": "R Cimo Vila 6",
"address_type": "Office",
"city": "Rebordosa",
"country": "Portugal",
"customer": "Chi-Chis",
"phone": "23566775757",
"supplier": null
},
"address_line1": "R Cimo Vila 6",
"address_type": "Office",
"city": "Rebordosa",
"country": "Portugal",
"links": [{"link_doctype": "Customer", "link_name": "Chi-Chis"}],
"phone": "23566775757"
},
{
"address_line1": "R 5 Outubro 9",
"address_type": "Office",
"city": "Quinta Nova S\u00e3o Domingos",
"country": "Portugal",
"customer": "Choices",
"phone": "23566775757",
"supplier": null
},
"address_line1": "R 5 Outubro 9",
"address_type": "Office",
"city": "Quinta Nova S\u00e3o Domingos",
"country": "Portugal",
"links": [{"link_doctype": "Customer", "link_name": "Choices"}],
"phone": "23566775757"
},
{
"address_line1": "Avenida Macambira 953",
"address_type": "Office",
"city": "Goi\u00e2nia",
"country": "Brazil",
"customer": "Consumers and Consumers Express",
"phone": "23566775757",
"supplier": null
},
"address_line1": "Avenida Macambira 953",
"address_type": "Office",
"city": "Goi\u00e2nia",
"country": "Brazil",
"links": [{"link_doctype": "Customer", "link_name": "Consumers and Consumers Express"}],
"phone": "23566775757"
},
{
"address_line1": "2342 Goyeau Ave",
"address_type": "Office",
"city": "Windsor",
"country": "Canada",
"customer": "Crafts Canada",
"phone": "23566775757",
"supplier": null
},
"address_line1": "2342 Goyeau Ave",
"address_type": "Office",
"city": "Windsor",
"country": "Canada",
"links": [{"link_doctype": "Customer", "link_name": "Crafts Canada"}],
"phone": "23566775757"
},
{
"address_line1": "Laukaantie 82",
"address_type": "Office",
"city": "KOKKOLA",
"country": "Finland",
"customer": "Endicott Shoes",
"phone": "23566775757",
"supplier": null
},
"address_line1": "Laukaantie 82",
"address_type": "Office",
"city": "KOKKOLA",
"country": "Finland",
"links": [{"link_doctype": "Customer", "link_name": "Endicott Shoes"}],
"phone": "23566775757"
},
{
"address_line1": "9 Brown Street",
"address_type": "Office",
"city": "PETERSHAM",
"country": "Australia",
"customer": "Fayva",
"phone": "23566775757",
"supplier": null
},
"address_line1": "9 Brown Street",
"address_type": "Office",
"city": "PETERSHAM",
"country": "Australia",
"links": [{"link_doctype": "Customer", "link_name": "Fayva"}],
"phone": "23566775757"
},
{
"address_line1": "Via Donnalbina 41",
"address_type": "Office",
"city": "Cala Gonone",
"country": "Italy",
"customer": "Intelacard",
"phone": "23566775757",
"supplier": null
},
"address_line1": "Via Donnalbina 41",
"address_type": "Office",
"city": "Cala Gonone",
"country": "Italy",
"links": [{"link_doctype": "Customer", "link_name": "Intelacard"}],
"phone": "23566775757"
},
{
"address_line1": "Liljerum Grenadj\u00e4rtorpet 69",
"address_type": "Office",
"city": "TOMTEBODA",
"country": "Sweden",
"customer": "Landskip Yard Care",
"phone": "23566775757",
"supplier": null
},
"address_line1": "Liljerum Grenadj\u00e4rtorpet 69",
"address_type": "Office",
"city": "TOMTEBODA",
"country": "Sweden",
"links": [{"link_doctype": "Customer", "link_name": "Landskip Yard Care"}],
"phone": "23566775757"
},
{
"address_line1": "72 Bishopgate Street",
"address_type": "Office",
"city": "SEAHAM",
"country": "United Kingdom",
"customer": "Life Plan Counselling",
"phone": "23566775757",
"supplier": null
},
"address_line1": "72 Bishopgate Street",
"address_type": "Office",
"city": "SEAHAM",
"country": "United Kingdom",
"links": [{"link_doctype": "Customer", "link_name": "Life Plan Counselling"}],
"phone": "23566775757"
},
{
"address_line1": "\u03a3\u03ba\u03b1\u03c6\u03af\u03b4\u03b9\u03b1 105",
"address_type": "Office",
"city": "\u03a0\u0391\u03a1\u0395\u039a\u039a\u039b\u0397\u03a3\u0399\u0391",
"country": "Cyprus",
"customer": "Mr Fables",
"phone": "23566775757",
"supplier": null
},
"address_line1": "\u03a3\u03ba\u03b1\u03c6\u03af\u03b4\u03b9\u03b1 105",
"address_type": "Office",
"city": "\u03a0\u0391\u03a1\u0395\u039a\u039a\u039b\u0397\u03a3\u0399\u0391",
"country": "Cyprus",
"links": [{"link_doctype": "Customer", "link_name": "Mr Fables"}],
"phone": "23566775757"
},
{
"address_line1": "Mellemvej 7",
"address_type": "Office",
"city": "Aabybro",
"country": "Denmark",
"customer": "Nelson Brothers",
"phone": "23566775757",
"supplier": null
},
"address_line1": "Mellemvej 7",
"address_type": "Office",
"city": "Aabybro",
"country": "Denmark",
"links": [{"link_doctype": "Customer", "link_name": "Nelson Brothers"}],
"phone": "23566775757"
},
{
"address_line1": "Plougg\u00e5rdsvej 98",
"address_type": "Office",
"city": "Karby",
"country": "Denmark",
"customer": "Netobill",
"phone": "23566775757",
"supplier": null
},
"address_line1": "Plougg\u00e5rdsvej 98",
"address_type": "Office",
"city": "Karby",
"country": "Denmark",
"links": [{"link_doctype": "Customer", "link_name": "Netobill"}],
"phone": "23566775757"
},
{
"address_line1": "176 Michalakopoulou Street",
"address_type": "Office",
"city": "Agio Georgoudi",
"country": "Cyprus",
"customer": null,
"phone": "23566775757",
"supplier": "Helios Air"
},
"address_line1": "176 Michalakopoulou Street",
"address_type": "Office",
"city": "Agio Georgoudi",
"country": "Cyprus",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "Helios Air"}]
},
{
"address_line1": "Fibichova 1102",
"address_type": "Office",
"city": "Kokor\u00edn",
"country": "Czech Republic",
"customer": null,
"phone": "23566775757",
"supplier": "Ks Merchandise"
},
"address_line1": "Fibichova 1102",
"address_type": "Office",
"city": "Kokor\u00edn",
"country": "Czech Republic",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "Ks Merchandise"}]
},
{
"address_line1": "Zahradn\u00ed 888",
"address_type": "Office",
"city": "Cecht\u00edn",
"country": "Czech Republic",
"customer": null,
"phone": "23566775757",
"supplier": "HomeBase"
},
"address_line1": "Zahradn\u00ed 888",
"address_type": "Office",
"city": "Cecht\u00edn",
"country": "Czech Republic",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "HomeBase"}]
},
{
"address_line1": "ul. Grochowska 94",
"address_type": "Office",
"city": "Warszawa",
"country": "Poland",
"customer": null,
"phone": "23566775757",
"supplier": "Scott Ties"
},
"address_line1": "ul. Grochowska 94",
"address_type": "Office",
"city": "Warszawa",
"country": "Poland",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "Scott Ties"}]
},
{
"address_line1": "Norra Esplanaden 87",
"address_type": "Office",
"city": "HELSINKI",
"country": "Finland",
"customer": null,
"phone": "23566775757",
"supplier": "Reliable Investments"
},
"address_line1": "Norra Esplanaden 87",
"address_type": "Office",
"city": "HELSINKI",
"country": "Finland",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "Reliable Investments"}]
},
{
"address_line1": "2038 Fallon Drive",
"address_type": "Office",
"city": "Dresden",
"country": "Canada",
"customer": null,
"phone": "23566775757",
"supplier": "Nan Duskin"
},
"address_line1": "2038 Fallon Drive",
"address_type": "Office",
"city": "Dresden",
"country": "Canada",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "Nan Duskin"}]
},
{
"address_line1": "77 cours Franklin Roosevelt",
"address_type": "Office",
"city": "MARSEILLE",
"country": "France",
"customer": null,
"phone": "23566775757",
"supplier": "Rainbow Records"
},
"address_line1": "77 cours Franklin Roosevelt",
"address_type": "Office",
"city": "MARSEILLE",
"country": "France",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "Rainbow Records"}]
},
{
"address_line1": "ul. Tuwima Juliana 85",
"address_type": "Office",
"city": "\u0141\u00f3d\u017a",
"country": "Poland",
"customer": null,
"phone": "23566775757",
"supplier": "New World Realty"
},
"address_line1": "ul. Tuwima Juliana 85",
"address_type": "Office",
"city": "\u0141\u00f3d\u017a",
"country": "Poland",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "New World Realty"}]
},
{
"address_line1": "Gl. Sygehusvej 41",
"address_type": "Office",
"city": "Narsaq",
"country": "Greenland",
"customer": null,
"phone": "23566775757",
"supplier": "Asiatic Solutions"
},
"address_line1": "Gl. Sygehusvej 41",
"address_type": "Office",
"city": "Narsaq",
"country": "Greenland",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "Asiatic Solutions"}]
},
{
"address_line1": "Gosposka ulica 50",
"address_type": "Office",
"city": "Nova Gorica",
"country": "Slovenia",
"customer": null,
"phone": "23566775757",
"supplier": "Eagle Hardware"
"address_line1": "Gosposka ulica 50",
"address_type": "Office",
"city": "Nova Gorica",
"country": "Slovenia",
"phone": "23566775757",
"links": [{"link_doctype": "Supplier", "link_name": "Eagle Hardware"}]
}
]

View File

@ -1,191 +1,164 @@
[
{
"customer": "Adaptas",
"email_id": "JanVaclavik@example.com",
"first_name": "January",
"last_name": "V\u00e1clav\u00edk",
"supplier": null
},
"email_id": "JanVaclavik@example.com",
"first_name": "January",
"last_name": "V\u00e1clav\u00edk",
"links": [{"link_doctype": "Customer", "link_name": "Adaptas"}]
},
{
"customer": "Asian Fusion",
"email_id": "ChidumagaTobeolisa@example.com",
"first_name": "Chidumaga",
"last_name": "Tobeolisa",
"supplier": null
},
"email_id": "ChidumagaTobeolisa@example.com",
"first_name": "Chidumaga",
"last_name": "Tobeolisa",
"links": [{"link_doctype": "Customer", "link_name": "Asian Fusion"}]
},
{
"customer": "Asian Junction",
"email_id": "JanaKubanova@example.com",
"first_name": "Jana",
"last_name": "Kub\u00e1\u0148ov\u00e1",
"supplier": null
},
"email_id": "JanaKubanova@example.com",
"first_name": "Jana",
"last_name": "Kub\u00e1\u0148ov\u00e1",
"links": [{"link_doctype": "Customer", "link_name": "Asian Junction"}]
},
{
"customer": "Big D Supermarkets",
"email_id": "XuChaoXuan@example.com",
"first_name": "\u7d39\u8431",
"last_name": "\u4e8e",
"supplier": null
},
"email_id": "XuChaoXuan@example.com",
"first_name": "\u7d39\u8431",
"last_name": "\u4e8e",
"links": [{"link_doctype": "Customer", "link_name": "Big D Supermarkets"}]
},
{
"customer": "Buttrey Food & Drug",
"email_id": "OzlemVerwijmeren@example.com",
"first_name": "\u00d6zlem",
"last_name": "Verwijmeren",
"supplier": null
},
"email_id": "OzlemVerwijmeren@example.com",
"first_name": "\u00d6zlem",
"last_name": "Verwijmeren",
"links": [{"link_doctype": "Customer", "link_name": "Buttrey Food & Drug"}]
},
{
"customer": "Chi-Chis",
"email_id": "HansRasmussen@example.com",
"first_name": "Hans",
"last_name": "Rasmussen",
"supplier": null
},
"email_id": "HansRasmussen@example.com",
"first_name": "Hans",
"last_name": "Rasmussen",
"links": [{"link_doctype": "Customer", "link_name": "Chi-Chis"}]
},
{
"customer": "Choices",
"email_id": "SatomiShigeki@example.com",
"first_name": "Satomi",
"last_name": "Shigeki",
"supplier": null
},
"email_id": "SatomiShigeki@example.com",
"first_name": "Satomi",
"last_name": "Shigeki",
"links": [{"link_doctype": "Customer", "link_name": "Choices"}]
},
{
"customer": "Consumers and Consumers Express",
"email_id": "SimonVJessen@example.com",
"first_name": "Simon",
"last_name": "Jessen",
"supplier": null
},
"email_id": "SimonVJessen@example.com",
"first_name": "Simon",
"last_name": "Jessen",
"links": [{"link_doctype": "Customer", "link_name": "Consumers and Consumers Express"}]
},
{
"customer": "Crafts Canada",
"email_id": "NeguaranShahsaah@example.com",
"first_name": "\u0646\u06af\u0627\u0631\u06cc\u0646",
"last_name": "\u0634\u0627\u0647 \u0633\u06cc\u0627\u0647",
"supplier": null
},
"email_id": "NeguaranShahsaah@example.com",
"first_name": "\u0646\u06af\u0627\u0631\u06cc\u0646",
"last_name": "\u0634\u0627\u0647 \u0633\u06cc\u0627\u0647",
"links": [{"link_doctype": "Customer", "link_name": "Crafts Canada"}]
},
{
"customer": "Endicott Shoes",
"email_id": "Lom-AliBataev@example.com",
"first_name": "Lom-Ali",
"last_name": "Bataev",
"supplier": null
},
"email_id": "Lom-AliBataev@example.com",
"first_name": "Lom-Ali",
"last_name": "Bataev",
"links": [{"link_doctype": "Customer", "link_name": "Endicott Shoes"}]
},
{
"customer": "Fayva",
"email_id": "VanNgocTien@example.com",
"first_name": "Ti\u00ean",
"last_name": "V\u0103n",
"supplier": null
},
"email_id": "VanNgocTien@example.com",
"first_name": "Ti\u00ean",
"last_name": "V\u0103n",
"links": [{"link_doctype": "Customer", "link_name": "Fayva"}]
},
{
"customer": "Intelacard",
"email_id": "QuimeyOsorioRuelas@example.com",
"first_name": "Quimey",
"last_name": "Osorio",
"supplier": null
},
"email_id": "QuimeyOsorioRuelas@example.com",
"first_name": "Quimey",
"last_name": "Osorio",
"links": [{"link_doctype": "Customer", "link_name": "Intelacard"}]
},
{
"customer": "Landskip Yard Care",
"email_id": "EdgardaSalcedoRaya@example.com",
"first_name": "Edgarda",
"last_name": "Salcedo",
"supplier": null
},
"email_id": "EdgardaSalcedoRaya@example.com",
"first_name": "Edgarda",
"last_name": "Salcedo",
"links": [{"link_doctype": "Customer", "link_name": "Landskip Yard Care"}]
},
{
"customer": "Life Plan Counselling",
"email_id": "HafsteinnBjarnarsonar@example.com",
"first_name": "Hafsteinn",
"last_name": "Bjarnarsonar",
"supplier": null
},
"email_id": "HafsteinnBjarnarsonar@example.com",
"first_name": "Hafsteinn",
"last_name": "Bjarnarsonar",
"links": [{"link_doctype": "Customer", "link_name": "Life Plan Counselling"}]
},
{
"customer": "Mr Fables",
"email_id": "\u0434\u0430\u043d\u0438\u0438\u043b@example.com",
"first_name": "\u0414\u0430\u043d\u0438\u0438\u043b",
"last_name": "\u041a\u043e\u043d\u043e\u0432\u0430\u043b\u043e\u0432",
"supplier": null
},
"email_id": "\u0434\u0430\u043d\u0438\u0438\u043b@example.com",
"first_name": "\u0414\u0430\u043d\u0438\u0438\u043b",
"last_name": "\u041a\u043e\u043d\u043e\u0432\u0430\u043b\u043e\u0432",
"links": [{"link_doctype": "Customer", "link_name": "Mr Fables"}]
},
{
"customer": "Nelson Brothers",
"email_id": "SelmaMAndersen@example.com",
"first_name": "Selma",
"last_name": "Andersen",
"supplier": null
},
"email_id": "SelmaMAndersen@example.com",
"first_name": "Selma",
"last_name": "Andersen",
"links": [{"link_doctype": "Customer", "link_name": "Nelson Brothers"}]
},
{
"customer": "Netobill",
"email_id": "LadislavKolaja@example.com",
"first_name": "Ladislav",
"last_name": "Kolaja",
"supplier": null
},
"email_id": "LadislavKolaja@example.com",
"first_name": "Ladislav",
"last_name": "Kolaja",
"links": [{"link_doctype": "Customer", "link_name": "Netobill"}]
},
{
"customer": null,
"email_id": "TewoldeAbaalom@example.com",
"first_name": "Tewolde",
"last_name": "Abaalom",
"supplier": "Helios Air"
},
"links": [{"link_doctype": "Supplier", "link_name": "Helios Air"}],
"email_id": "TewoldeAbaalom@example.com",
"first_name": "Tewolde",
"last_name": "Abaalom"
},
{
"customer": null,
"email_id": "LeilaFernandesRodrigues@example.com",
"first_name": "Leila",
"last_name": "Rodrigues",
"supplier": "Ks Merchandise"
},
"links": [{"link_doctype": "Supplier", "link_name": "Ks Merchandise"}],
"email_id": "LeilaFernandesRodrigues@example.com",
"first_name": "Leila",
"last_name": "Rodrigues"
},
{
"customer": null,
"email_id": "DmitryBulgakov@example.com",
"first_name": "Dmitry",
"last_name": "Bulgakov",
"supplier": "HomeBase"
},
"links": [{"link_doctype": "Supplier", "link_name": "HomeBase"}],
"email_id": "DmitryBulgakov@example.com",
"first_name": "Dmitry",
"last_name": "Bulgakov"
},
{
"customer": null,
"email_id": "HaiducWhitfoot@example.com",
"first_name": "Haiduc",
"last_name": "Whitfoot",
"supplier": "Scott Ties"
},
"links": [{"link_doctype": "Supplier", "link_name": "Scott Ties"}],
"email_id": "HaiducWhitfoot@example.com",
"first_name": "Haiduc",
"last_name": "Whitfoot"
},
{
"customer": null,
"email_id": "SesseljaPetursdottir@example.com",
"first_name": "Sesselja",
"last_name": "P\u00e9tursd\u00f3ttir",
"supplier": "Reliable Investments"
},
"links": [{"link_doctype": "Supplier", "link_name": "Reliable Investments"}],
"email_id": "SesseljaPetursdottir@example.com",
"first_name": "Sesselja",
"last_name": "P\u00e9tursd\u00f3ttir"
},
{
"customer": null,
"email_id": "HajdarPignar@example.com",
"first_name": "Hajdar",
"last_name": "Pignar",
"supplier": "Nan Duskin"
},
"links": [{"link_doctype": "Supplier", "link_name": "Nan Duskin"}],
"email_id": "HajdarPignar@example.com",
"first_name": "Hajdar",
"last_name": "Pignar"
},
{
"customer": null,
"email_id": "GustavaLorenzo@example.com",
"first_name": "Gustava",
"last_name": "Lorenzo",
"supplier": "Rainbow Records"
},
"links": [{"link_doctype": "Supplier", "link_name": "Rainbow Records"}],
"email_id": "GustavaLorenzo@example.com",
"first_name": "Gustava",
"last_name": "Lorenzo"
},
{
"customer": null,
"email_id": "BethanyWood@example.com",
"first_name": "Bethany",
"last_name": "Wood",
"supplier": "New World Realty"
},
"links": [{"link_doctype": "Supplier", "link_name": "New World Realty"}],
"email_id": "BethanyWood@example.com",
"first_name": "Bethany",
"last_name": "Wood"
},
{
"customer": null,
"email_id": "GlorianaBrownlock@example.com",
"first_name": "Gloriana",
"last_name": "Brownlock",
"supplier": "Asiatic Solutions"
},
"links": [{"link_doctype": "Supplier", "link_name": "Asiatic Solutions"}],
"email_id": "GlorianaBrownlock@example.com",
"first_name": "Gloriana",
"last_name": "Brownlock"
},
{
"customer": null,
"email_id": "JensonFraser@gustr.com",
"first_name": "Jenson",
"last_name": "Fraser",
"supplier": "Eagle Hardware"
"links": [{"link_doctype": "Supplier", "link_name": "Eagle Hardware"}],
"email_id": "JensonFraser@gustr.com",
"first_name": "Jenson",
"last_name": "Fraser"
}
]

View File

@ -32,7 +32,7 @@ def setup(domain):
import_json('Contact')
import_json('Lead')
setup_currency_exchange()
setup_mode_of_payment()
#setup_mode_of_payment()
setup_account_to_expense_type()
setup_budget()
setup_pos_profile()

View File

@ -15,7 +15,7 @@ def execute(filters=None):
columns=get_columns()
data=get_log_data(filters)
chart=get_chart_data(data,period_list)
return columns,data,None,chart
return columns, data, None, chart
def get_columns():
columns = [_("License") + ":Link/Vehicle:100", _("Make") + ":data:50",

View File

@ -48,7 +48,7 @@ website_generators = ["Item Group", "Item", "Sales Partner", "Job Opening", "Stu
website_context = {
"favicon": "/assets/erpnext/images/favicon.png",
"splash_image": "/assets/erpnext/images/splash.png"
"splash_image": "/assets/erpnext/images/erp-icon.svg"
}
website_route_rules = [
@ -112,10 +112,8 @@ portal_menu_items = [
]
default_roles = [
{'role': 'Customer', 'doctype':'Contact', 'email_field': 'email_id',
'filters': {'ifnull(customer, "")': ('!=', '')}},
{'role': 'Supplier', 'doctype':'Contact', 'email_field': 'email_id',
'filters': {'ifnull(supplier, "")': ('!=', '')}},
{'role': 'Customer', 'doctype':'Contact', 'email_field': 'email_id'},
{'role': 'Supplier', 'doctype':'Contact', 'email_field': 'email_id'},
{'role': 'Student', 'doctype':'Student', 'email_field': 'student_email_id'}
]
@ -125,7 +123,6 @@ has_website_permission = {
"Supplier Quotation": "erpnext.controllers.website_list_for_contact.has_website_permission",
"Delivery Note": "erpnext.controllers.website_list_for_contact.has_website_permission",
"Issue": "erpnext.support.doctype.issue.issue.has_website_permission",
"Address": "erpnext.utilities.doctype.address.address.has_website_permission",
"Discussion": "erpnext.schools.web_form.discussion.discussion.has_website_permission"
}
@ -153,16 +150,14 @@ doc_events = {
"on_cancel": "erpnext.stock.doctype.material_request.material_request.update_completed_and_requested_qty"
},
"User": {
"after_insert": "frappe.email.doctype.contact.contact.update_contact",
"validate": "erpnext.hr.doctype.employee.employee.validate_employee_role",
"on_update": "erpnext.hr.doctype.employee.employee.update_user_permissions",
"on_update": "erpnext.utilities.doctype.contact.contact.update_contact"
"on_update": "erpnext.utilities.address_and_contact.set_default_role"
},
("Sales Taxes and Charges Template", 'Price List'): {
"on_update": "erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings.validate_cart_settings"
},
"Address": {
"validate": "erpnext.shopping_cart.cart.set_customer_in_address"
},
# bubble transaction notification on master
('Opportunity', 'Quotation', 'Sales Order', 'Delivery Note', 'Sales Invoice',

View File

@ -7,6 +7,7 @@ frappe.ui.form.on("Process Payroll", {
frm.doc.start_date = '';
frm.doc.end_date = '';
frm.doc.payroll_frequency = '';
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
},
refresh: function(frm) {
@ -25,6 +26,10 @@ frappe.ui.form.on("Process Payroll", {
frm.trigger("set_start_end_dates");
},
salary_slip_based_on_timesheet: function(frm) {
frm.toggle_reqd(['payroll_frequency'], !frm.doc.salary_slip_based_on_timesheet);
},
payment_account: function(frm) {
frm.toggle_display(['make_bank_entry'], (frm.doc.payment_account!="" && frm.doc.payment_account!="undefined"));
},

View File

@ -68,7 +68,7 @@ class ProcessPayroll(Document):
def check_mandatory(self):
for fieldname in ['company', 'payroll_frequency', 'start_date', 'end_date']:
for fieldname in ['company', 'start_date', 'end_date']:
if not self.get(fieldname):
frappe.throw(_("Please set {0}").format(self.meta.get_label(fieldname)))
@ -296,17 +296,18 @@ class ProcessPayroll(Document):
frappe.db.set_value("Salary Slip", ss_obj.name, "journal_entry", jv_name)
def set_start_end_dates(self):
self.update(get_start_end_dates(self.payroll_frequency, self.start_date or self.posting_date))
self.update(get_start_end_dates(self.payroll_frequency,
self.start_date or self.posting_date, self.company))
@frappe.whitelist()
def get_start_end_dates(payroll_frequency, start_date=None):
def get_start_end_dates(payroll_frequency, start_date=None, company=None):
'''Returns dict of start and end dates for given payroll frequency based on start_date'''
if not payroll_frequency:
frappe.throw(_("Please set Payroll Frequency first"))
if payroll_frequency == "Monthly" or payroll_frequency == "Bimonthly":
fiscal_year = get_fiscal_year(start_date)[0]
fiscal_year = get_fiscal_year(start_date, company=company)[0]
month = "%02d" % getdate(start_date).month
m = get_month_details(fiscal_year, month)
if payroll_frequency == "Bimonthly":

View File

@ -134,7 +134,7 @@ class TestSalarySlip(unittest.TestCase):
self.assertTrue(email_queue)
def test_payroll_frequency(self):
fiscal_year = get_fiscal_year(nowdate())[0]
fiscal_year = get_fiscal_year(nowdate(), company="_Test Company")[0]
month = "%02d" % getdate(nowdate()).month
m = get_month_details(fiscal_year, month)
@ -185,7 +185,7 @@ class TestSalarySlip(unittest.TestCase):
}).insert()
def make_holiday_list(self):
fiscal_year = get_fiscal_year(nowdate())
fiscal_year = get_fiscal_year(nowdate(), company="_Test Company")
if not frappe.db.get_value("Holiday List", "Salary Slip Test Holiday List"):
holiday_list = frappe.get_doc({
"doctype": "Holiday List",

View File

@ -1,7 +1,7 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 0,
"allow_rename": 1,
"autoname": "Prompt",
"beta": 0,
"creation": "2013-03-07 18:50:29",
@ -894,7 +894,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-12-14 02:02:10.848614",
"modified": "2017-01-11 02:02:10.848614",
"modified_by": "Administrator",
"module": "HR",
"name": "Salary Structure",
@ -951,4 +951,4 @@
"timeline_field": "",
"title_field": "",
"track_seen": 0
}
}

View File

@ -1,34 +0,0 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
frappe.query_reports["Monthly Salary Register"] = {
"filters": [
{
"fieldname":"from_date",
"label": __("From"),
"fieldtype": "Date",
"default": frappe.datetime.add_months(frappe.datetime.get_today(), -1),
"reqd": 1
},
{
"fieldname":"to_date",
"label": __("To"),
"fieldtype": "Date",
"default": frappe.datetime.get_today(),
"reqd": 1
},
{
"fieldname":"employee",
"label": __("Employee"),
"fieldtype": "Link",
"options": "Employee"
},
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company")
}
]
}

View File

@ -2,8 +2,7 @@
{%= frappe.boot.letter_heads[filters.letter_head || frappe.defaults.get_default("letter_head")] %}
</div>
<h2 class="text-center">{%= __(report.report_name) %}</h2>
<h5 class="text-center">Fiscal Year: {%= filters.fiscal_year %}</h5>
<h5 class="text-center">Month: {%= filters.month %}</h5>
<h5 class="text-center">From {%= filters.date_range[0] %} to {%= filters.date_range[1] %}</h5>
<hr>
<table class="table table-bordered">
<thead>
@ -36,4 +35,3 @@
</tbody>
</table>
<p class="text-right text-muted">Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>

View File

@ -0,0 +1,27 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.query_reports["Salary Register"] = {
"filters": [
{
"fieldname":"date_range",
"label": __("Date Range"),
"fieldtype": "DateRange",
"default": [frappe.datetime.add_months(get_today(),-1), frappe.datetime.get_today()],
"reqd": 1
},
{
"fieldname":"employee",
"label": __("Employee"),
"fieldtype": "Link",
"options": "Employee"
},
{
"fieldname":"company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"default": frappe.defaults.get_user_default("Company")
}
]
}

View File

@ -1,17 +1,18 @@
{
"add_total_row": 1,
"apply_user_permissions": 1,
"creation": "2013-05-07 18:09:42",
"creation": "2017-01-10 17:36:58.153863",
"disabled": 0,
"docstatus": 0,
"doctype": "Report",
"idx": 1,
"idx": 0,
"is_standard": "Yes",
"modified": "2014-06-03 07:18:17.187018",
"modified": "2017-01-10 17:38:00.832224",
"modified_by": "Administrator",
"module": "HR",
"name": "Monthly Salary Register",
"name": "Salary Register",
"owner": "Administrator",
"ref_doctype": "Salary Slip",
"report_name": "Monthly Salary Register",
"report_name": "Salary Register",
"report_type": "Script Report"
}

View File

@ -3,12 +3,11 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, cstr
from frappe import msgprint, _
from frappe.utils import flt
from frappe import _
def execute(filters=None):
if not filters: filters = {}
salary_slips = get_salary_slips(filters)
columns, earning_types, ded_types = get_columns(salary_slips)
ss_earning_map = get_ss_earning_map(salary_slips)
@ -58,6 +57,7 @@ def get_columns(salary_slips):
return columns, salary_components[_("Earning")], salary_components[_("Deduction")]
def get_salary_slips(filters):
filters.update({"from_date": filters.get("date_range")[0], "to_date":filters.get("date_range")[1]})
conditions, filters = get_conditions(filters)
salary_slips = frappe.db.sql("""select * from `tabSalary Slip` where docstatus = 1 %s
order by employee""" % conditions, filters, as_dict=1)
@ -65,13 +65,12 @@ def get_salary_slips(filters):
if not salary_slips:
frappe.throw(_("No salary slip found between {0} and {1}").format(
filters.get("from_date"), filters.get("to_date")))
return salary_slips
def get_conditions(filters):
conditions = ""
if filters.get("from_date"): conditions += " and start_date >= %(from_date)s"
if filters.get("to_date"): conditions += " and end_date <= %(to_date)s"
if filters.get("date_range"): conditions += " and start_date >= %(from_date)s"
if filters.get("date_range"): conditions += " and end_date <= %(to_date)s"
if filters.get("company"): conditions += " and company = %(company)s"
if filters.get("employee"): conditions += " and employee = %(employee)s"

View File

@ -3,18 +3,28 @@
frappe.provide("erpnext.maintenance");
frappe.ui.form.on_change("Maintenance Schedule", "customer", function(frm) {
erpnext.utils.get_party_details(frm) });
frappe.ui.form.on_change("Maintenance Schedule", "customer_address", function(){
erpnext.utils.get_address_display(cur_frm, 'customer_address', 'address_display');
});
frappe.ui.form.on_change("Maintenance Schedule", "contact_person", function(){
erpnext.utils.get_contact_details(cur_frm);
});
frappe.ui.form.on('Maintenance Schedule', {
setup: function(frm) {
frm.set_query('contact_person', erpnext.queries.contact_query);
frm.set_query('customer_address', erpnext.queries.address_query);
},
customer: function(frm) {
erpnext.utils.get_party_details(frm)
},
customer_address: function(frm) {
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display');
},
contact_person: function(frm) {
erpnext.utils.get_contact_details(frm);
}
})
// TODO commonify this code
erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
refresh: function() {
frappe.contact_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
var me = this;
if (this.frm.doc.docstatus === 0) {
@ -94,18 +104,6 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
}
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
return {
filters:{ 'customer': doc.customer }
}
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return {
filters:{ 'customer': doc.customer }
}
}
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
if (!doc.__islocal) {
return $c('runserverobj', args={'method':'generate_schedule', 'docs':doc},

View File

@ -10,11 +10,13 @@
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 1,
"engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "item_code",
"fieldtype": "Link",
"hidden": 0,
@ -32,6 +34,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
@ -42,6 +45,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "item_name",
"fieldtype": "Data",
"hidden": 0,
@ -58,6 +62,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -68,8 +73,9 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "description",
"fieldtype": "Data",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@ -85,6 +91,7 @@
"print_hide_if_no_value": 0,
"print_width": "300px",
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -96,6 +103,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "schedule_details",
"fieldtype": "Section Break",
"hidden": 0,
@ -110,6 +118,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -120,6 +129,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "start_date",
"fieldtype": "Date",
"hidden": 0,
@ -136,6 +146,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
@ -146,6 +157,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "end_date",
"fieldtype": "Date",
"hidden": 0,
@ -162,6 +174,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
@ -172,6 +185,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "periodicity",
"fieldtype": "Select",
"hidden": 0,
@ -189,6 +203,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -199,6 +214,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "no_of_visits",
"fieldtype": "Int",
"hidden": 0,
@ -215,6 +231,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@ -225,6 +242,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "sales_person",
"fieldtype": "Link",
"hidden": 0,
@ -242,6 +260,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
@ -252,6 +271,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "reference",
"fieldtype": "Section Break",
"hidden": 0,
@ -266,6 +286,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -276,6 +297,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "serial_no",
"fieldtype": "Small Text",
"hidden": 0,
@ -292,6 +314,7 @@
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@ -302,6 +325,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "sales_order",
"fieldtype": "Link",
"hidden": 0,
@ -320,6 +344,7 @@
"print_hide_if_no_value": 0,
"print_width": "150px",
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
@ -338,7 +363,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:28:02.260189",
"modified": "2017-01-11 12:02:38.449129",
"modified_by": "Administrator",
"module": "Maintenance",
"name": "Maintenance Schedule Item",

View File

@ -2,20 +2,31 @@
// License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.maintenance");
me.frm.set_query('contact_person', erpnext.queries.contact_query);
frappe.ui.form.on_change("Maintenance Visit", "customer", function(frm) {
erpnext.utils.get_party_details(frm) });
frappe.ui.form.on_change("Maintenance Visit", "customer_address", function(frm){
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display')
});
frappe.ui.form.on_change("Maintenance Visit", "contact_person", function(frm){
erpnext.utils.get_contact_details(frm)
});
frappe.ui.form.on('Maintenance Visit', {
setup: function(frm) {
frm.set_query('contact_person', erpnext.queries.contact_query);
frm.set_query('customer_address', erpnext.queries.address_query);
},
customer: function(frm) {
erpnext.utils.get_party_details(frm)
},
customer_address: function(frm) {
erpnext.utils.get_address_display(frm, 'customer_address', 'address_display');
},
contact_person: function(frm) {
erpnext.utils.get_contact_details(frm);
}
})
// TODO commonify this code
erpnext.maintenance.MaintenanceVisit = frappe.ui.form.Controller.extend({
refresh: function() {
frappe.contact_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(__('Maintenance Schedule'),
function() {
@ -69,18 +80,6 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
cur_frm.add_fetch('item_code', 'description', 'description');
}
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
return{
filters:{'customer': doc.customer}
}
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return{
filters:{'customer': doc.customer}
}
}
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
return {query: "erpnext.controllers.queries.customer_query" }
}

View File

@ -361,4 +361,5 @@ erpnext.patches.v7_1.repost_stock_for_deleted_bins_for_merging_items
execute:frappe.delete_doc('Desktop Icon', {'module_name': 'Profit and Loss Statment'})
erpnext.patches.v7_2.update_website_for_variant
erpnext.patches.v7_2.update_assessment_modules
erpnext.patches.v7_2.update_doctype_status
erpnext.patches.v7_2.update_salary_slips

View File

@ -0,0 +1,24 @@
import frappe
def execute():
frappe.reload_doctype('Contact')
frappe.reload_doctype('Address')
map_fields = (
('Customer', 'customer'),
('Supplier', 'supplier'),
('Load', 'lead'),
('Sales Partner', 'sales_partner')
)
for doctype in ('Contact', 'Address'):
if frappe.db.has_column(doctype, 'customer'):
for doc in frappe.get_all(doctype, fields='*'):
doc.doctype = doctype
doc = frappe.get_doc(doc)
dirty = False
for field in map_fields:
if doc.get(field[1]):
doc.append('links', dict(link_doctype=field[0], link_name=doc.get(field[1])))
dirty = True
if dirty:
doc.save()

View File

@ -0,0 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
doctypes = ["Opportunity", "Quotation", "Sales Order", "Sales Invoice", "Purchase Invoice", "Purchase Order", "Delivery Note", "Purchase Receipt"]
for doctype in doctypes:
frappe.db.sql(""" update `tab{doctype}` set status = 'Draft'
where status = 'Cancelled' and docstatus = 0 """.format(doctype = doctype))

View File

@ -0,0 +1,19 @@
import frappe
from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details
def execute():
frappe.reload_doctype('Salary Slip')
if not frappe.db.has_column('Salary Slip', 'fiscal_year'):
return
salary_slips = frappe.db.sql("""select month, name from `tabSalary Slip`
where (month is not null and month != '') and
(start_date is null or start_date = '') and
(end_date is null or end_date = '') and docstatus != 2""", as_dict=True)
for salary_slip in salary_slips:
get_start_end_date = get_month_details(salary_slip.fiscal_year, salary_slip.month)
start_date = get_start_end_date['month_start_date']
end_date = get_start_end_date['month_end_date']
frappe.db.sql("""update `tabSalary Slip` set start_date = %s, end_date = %s where name = %s""",
(start_date, end_date, salary_slip.name))

View File

@ -10,6 +10,7 @@
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
@ -24,7 +25,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Project Name",
"length": 0,
"no_copy": 0,
@ -53,7 +53,6 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 1,
"label": "Status",
"length": 0,
"no_copy": 1,
@ -83,7 +82,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 1,
"label": "Project Type",
"length": 0,
"no_copy": 0,
@ -113,7 +111,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 1,
"label": "Is Active",
"length": 0,
"no_copy": 0,
@ -144,7 +141,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "% Complete Method",
"length": 0,
"no_copy": 0,
@ -173,7 +169,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -200,7 +195,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 1,
"label": "Priority",
"length": 0,
"no_copy": 0,
@ -230,7 +224,6 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Expected Start Date",
"length": 0,
"no_copy": 0,
@ -259,7 +252,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Expected End Date",
"length": 0,
"no_copy": 0,
@ -288,7 +280,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "% Completed",
"length": 0,
"no_copy": 1,
@ -315,7 +306,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer Details",
"length": 0,
"no_copy": 0,
@ -344,7 +334,6 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer",
"length": 0,
"no_copy": 0,
@ -374,7 +363,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -401,7 +389,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Sales Order",
"length": 0,
"no_copy": 0,
@ -430,7 +417,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Users",
"length": 0,
"no_copy": 0,
@ -459,7 +445,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Users",
"length": 0,
"no_copy": 0,
@ -488,7 +473,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Tasks",
"length": 0,
"no_copy": 0,
@ -517,7 +501,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Tasks",
"length": 0,
"no_copy": 0,
@ -546,7 +529,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Notes",
"length": 0,
"no_copy": 0,
@ -575,7 +557,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Notes",
"length": 0,
"no_copy": 0,
@ -604,7 +585,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Start and End Dates",
"length": 0,
"no_copy": 0,
@ -632,7 +612,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Actual Start Date",
"length": 0,
"no_copy": 0,
@ -660,7 +639,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Actual Time (in Hours)",
"length": 0,
"no_copy": 0,
@ -688,7 +666,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -715,7 +692,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Actual End Date",
"length": 0,
"no_copy": 0,
@ -744,7 +720,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Costing and Billing",
"length": 0,
"no_copy": 0,
@ -773,7 +748,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Estimated Cost",
"length": 0,
"no_copy": 0,
@ -804,7 +778,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total Costing Amount (via Time Logs)",
"length": 0,
"no_copy": 0,
@ -833,7 +806,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total Expense Claim (via Expense Claims)",
"length": 0,
"no_copy": 0,
@ -861,7 +833,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Company",
"length": 0,
"no_copy": 0,
@ -889,7 +860,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Cost Center",
"length": 0,
"no_copy": 0,
@ -917,7 +887,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -945,7 +914,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total Billing Amount (via Time Logs)",
"length": 0,
"no_copy": 0,
@ -973,7 +941,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total Purchase Cost (via Purchase Invoice)",
"length": 0,
"no_copy": 0,
@ -1001,7 +968,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Margin",
"length": 0,
"no_copy": 0,
@ -1030,7 +996,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Gross Margin",
"length": 0,
"no_copy": 0,
@ -1060,7 +1025,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -1087,7 +1051,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Gross Margin %",
"length": 0,
"no_copy": 0,
@ -1117,7 +1080,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 4,
"modified": "2016-11-07 05:55:56.179455",
"modified": "2017-01-10 16:33:54.691885",
"modified_by": "Administrator",
"module": "Projects",
"name": "Project",
@ -1164,6 +1127,27 @@
"share": 0,
"submit": 0,
"write": 0
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Projects Manager",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 1,

View File

@ -30,7 +30,7 @@ class Project(Document):
"""Load `tasks` from the database"""
self.tasks = []
for task in self.get_tasks():
self.append("tasks", {
task_map = {
"title": task.subject,
"status": task.status,
"start_date": task.exp_start_date,
@ -38,7 +38,11 @@ class Project(Document):
"description": task.description,
"task_id": task.name,
"task_weight": task.task_weight
})
}
self.map_custom_fields(task, task_map)
self.append("tasks", task_map)
def get_tasks(self):
return frappe.get_all("Task", "*", {"project": self.name}, order_by="exp_start_date asc")
@ -66,7 +70,6 @@ class Project(Document):
def sync_tasks(self):
"""sync tasks and remove table"""
if self.flags.dont_sync_tasks: return
task_names = []
for t in self.tasks:
if t.task_id:
@ -83,6 +86,8 @@ class Project(Document):
"task_weight": t.task_weight
})
self.map_custom_fields(t, task)
task.flags.ignore_links = True
task.flags.from_project = True
task.flags.ignore_feed = True
@ -96,6 +101,14 @@ class Project(Document):
self.update_percent_complete()
self.update_costing()
def map_custom_fields(self, source, target):
project_task_custom_fields = frappe.get_all("Custom Field", {"dt": "Project Task"}, "fieldname")
for field in project_task_custom_fields:
target.update({
field.fieldname: source.get(field.fieldname)
})
def update_project(self):
self.update_percent_complete()
self.update_costing()

View File

@ -199,13 +199,22 @@ class Timesheet(Document):
(%(to_time)s > tsd.from_time and %(to_time)s < tsd.to_time) or
(%(from_time)s <= tsd.from_time and %(to_time)s >= tsd.to_time))
and tsd.name!=%(name)s
and ts.name!=%(parent)s
and ts.docstatus < 2""".format(cond),
{
"val": value,
"from_time": args.from_time,
"to_time": args.to_time,
"name": args.name or "No Name"
"name": args.name or "No Name",
"parent": args.parent or "No Name"
}, as_dict=True)
# check internal overlap
for time_log in self.time_logs:
if (fieldname != 'workstation' or args.get(fieldname) == time_log.get(fieldname)) and \
args.idx != time_log.idx and ((args.from_time > time_log.from_time and args.from_time < time_log.to_time) or
(args.to_time > time_log.from_time and args.to_time < time_log.to_time) or
(args.from_time <= time_log.from_time and args.to_time >= time_log.to_time)):
return self
return existing[0] if existing else None

View File

@ -4,12 +4,16 @@
frappe.query_reports["Daily Timesheet Summary"] = {
"filters": [
{
"fieldname":"date",
"label": __("Date"),
"fieldtype": "DateRange",
"start_with_value": true,
"default_from":frappe.datetime.get_today(),
"default_to":frappe.datetime.get_today(),
"fieldname":"from_date",
"label": __("From Date"),
"fieldtype": "Date",
"default": frappe.datetime.get_today()
},
{
"fieldname":"to_date",
"label": __("To Date"),
"fieldtype": "Date",
"default": frappe.datetime.get_today()
},
]
}

View File

@ -9,9 +9,7 @@ from frappe.desk.reportview import build_match_conditions
def execute(filters=None):
if not filters:
filters = {}
elif filters.get("date") :
filters["from_date"] = filters["date"][0]
filters["to_date"] = filters["date"][1]
elif filters.get("from_date") or filters.get("to_date"):
filters["from_time"] = "00:00:00"
filters["to_time"] = "24:00:00"

View File

@ -78,7 +78,6 @@
font-weight: inherit;
color: #8D99A6;
}
.transaction-list-item .items-preview,
.transaction-list-item .transaction-time {
margin-top: 5px;
}

View File

@ -2,7 +2,7 @@
<div class="col-xs-5"><h6>{%= item_code || "" %}{%= item_name || "" %}</h6></div>
<div class="col-xs-4">
<div class="row pos-qty-row">
<div class="col-xs-2 text-center pos-qty-btn" data-action="decrease-qty"><i class="fa fa-minus-sign text-muted"></i></div>
<div class="col-xs-2 text-center pos-qty-btn" data-action="decrease-qty"><i class="fa fa-minus text-muted" style="font-size:12px"></i></div>
<div class="col-xs-8">
<div>
<input type="text" value="{%= qty %}" class="form-control input-sm pos-item-qty text-right">
@ -13,7 +13,7 @@
</div>
{% } %}
</div>
<div class="col-xs-2 text-center pos-qty-btn" data-action="increase-qty"><i class="fa fa-plus-sign text-muted"></i></div>
<div class="col-xs-2 text-center pos-qty-btn" data-action="increase-qty"><i class="fa fa-plus text-muted" style="font-size:12px"></i></div>
</div>
</div>
<div class="col-xs-3 text-right">

View File

@ -36,17 +36,41 @@ $.extend(erpnext.queries, {
customer_filter: function(doc) {
if(!doc.customer) {
frappe.throw(__("Please specify a") + " " +
__(frappe.meta.get_label(doc.doctype, "customer", doc.name)));
frappe.throw(__("Please set {0}", __(frappe.meta.get_label(doc.doctype, "customer", doc.name))));
}
return { filters: { customer: doc.customer } };
},
contact_query: function(doc) {
if(frappe.contact_link) {
if(!doc[frappe.contact_link.fieldname]) {
frappe.throw(__("Please set {0}", __(frappe.meta.get_label(doc.doctype,
frappe.contact_link.fieldname, doc.name))));
}
return {
query: 'frappe.email.doctype.contact.contact.contact_query',
filters: { link_doctype: frappe.contact_link.doctype, link_name: doc[frappe.contact_link.fieldname] } };
}
},
address_query: function(doc) {
if(frappe.contact_link) {
if(!doc[frappe.contact_link.fieldname]) {
frappe.throw(__("Please set {0}", __(frappe.meta.get_label(doc.doctype,
frappe.contact_link.fieldname, doc.name))));
}
return {
query: 'frappe.email.doctype.address.address_query',
filters: { link_doctype: frappe.contact_link.doctype, link_name: doc[frappe.contact_link.fieldname] } };
}
},
supplier_filter: function(doc) {
if(!doc.supplier) {
frappe.throw(__("Please specify a") + " " +
__(frappe.meta.get_label(doc.doctype, "supplier", doc.name)));
frappe.throw(__("Please set {0}", __(frappe.meta.get_label(doc.doctype, "supplier", doc.name))));
}
return { filters: { supplier: doc.supplier } };
@ -74,7 +98,7 @@ $.extend(erpnext.queries, {
filters: [
["Warehouse", "company", "in", ["", cstr(doc.company)]],
["Warehouse", "is_group", "=",0]
]
}
}

View File

@ -2,7 +2,7 @@
<div class="clearfix"></div>
{% for(var i=0, l=addr_list.length; i<l; i++) { %}
<p class="h6">
{%= i+1 %}. {%= addr_list[i].address_type %}
{%= i+1 %}. {%= addr_list[i].address_type!="Other" ? addr_list[i].address_type : addr_list[i].address_title %}
{% if(addr_list[i].is_primary_address) { %}
<span class="text-muted">({%= __("Primary") %})</span>{% } %}
{% if(addr_list[i].is_shipping_address) { %}

View File

@ -8,7 +8,9 @@
{% if(contact_list[i].is_primary_contact) { %}
<span class="text-muted">({%= __("Primary") %})</span>
{% } %}
{% if(contact_list[i].designation){ %}
<span class="text-muted">&ndash; {%= contact_list[i].designation %}</span>
{% } %}
<a href="#Form/Contact/{%= encodeURIComponent(contact_list[i].name) %}"
class="btn btn-xs btn-default pull-right">
{%= __("Edit") %}</a>

View File

@ -65,7 +65,7 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field,
if(!display_field) display_field = "address_display";
if(frm.doc[address_field]) {
frappe.call({
method: "erpnext.utilities.doctype.address.address.get_address_display",
method: "frappe.geo.doctype.address.address.get_address_display",
args: {"address_dict": frm.doc[address_field] },
callback: function(r) {
if(r.message) {
@ -151,7 +151,7 @@ erpnext.utils.validate_mandatory = function(frm, label, value, trigger_on) {
erpnext.utils.get_shipping_address = function(frm, callback){
frappe.call({
method: "erpnext.utilities.doctype.address.address.get_shipping_address",
method: "frappe.geo.doctype.address.address.get_shipping_address",
args: {company: frm.doc.company},
callback: function(r){
if(r.message){

View File

@ -93,14 +93,10 @@
color: @text-muted;
}
.transaction-time {
// margin-left: 15px;
}
.items-preview,
.transaction-time {
margin-top: 5px;
}
}
// order.html

View File

@ -32,6 +32,8 @@ frappe.ui.form.on("Customer", {
erpnext.toggle_naming_series();
}
frappe.contact_link = {doc: frm.doc, fieldname: 'name', doctype: 'Customer'}
frm.toggle_display(['address_html','contact_html'], !frm.doc.__islocal);
if(!frm.doc.__islocal) {

View File

@ -9,7 +9,7 @@ import frappe.defaults
from frappe.utils import flt, cint, cstr
from frappe.desk.reportview import build_match_conditions
from erpnext.utilities.transaction_base import TransactionBase
from erpnext.utilities.address_and_contact import load_address_and_contact
from erpnext.utilities.address_and_contact import load_address_and_contact, delete_contact_and_address
from erpnext.accounts.party import validate_party_accounts, get_timeline_data # keep this
from erpnext.accounts.party_status import get_party_status
from erpnext import get_default_currency
@ -79,9 +79,6 @@ class Customer(TransactionBase):
if self.flags.old_lead != self.lead_name:
self.update_lead_status()
self.update_address()
self.update_contact()
if self.flags.is_new_doc:
self.create_lead_address_contact()
@ -95,30 +92,26 @@ class Customer(TransactionBase):
for d in frappe.get_all(doctype, {'lead': self.lead_name}):
frappe.db.set_value(doctype, d.name, 'customer', self.name, update_modified=False)
def update_address(self):
frappe.db.sql("""update `tabAddress` set customer_name=%s, modified=NOW()
where customer=%s""", (self.customer_name, self.name))
def update_contact(self):
frappe.db.sql("""update `tabContact` set customer_name=%s, modified=NOW()
where customer=%s""", (self.customer_name, self.name))
def create_lead_address_contact(self):
if self.lead_name:
if not frappe.db.get_value("Address", {"lead": self.lead_name, "customer": self.name}):
frappe.db.sql("""update `tabAddress` set customer=%s, customer_name=%s where lead=%s""",
(self.name, self.customer_name, self.lead_name))
# assign lead address to customer (if already not set)
address_name = frappe.get_value('Dynamic Link', dict(parenttype='Address', link_doctype='Lead', link_name=self.name))
if address_name:
address = frappe.get_doc('Address', address_name)
if not address.has_link('Customer', self.name):
address.append('links', dict(link_doctype='Customer', link_name=self.name))
address.save()
lead = frappe.db.get_value("Lead", self.lead_name, ["lead_name", "email_id", "phone", "mobile_no"], as_dict=True)
# create contact from lead
c = frappe.new_doc('Contact')
c.first_name = lead.lead_name
c.email_id = lead.email_id
c.phone = lead.phone
c.mobile_no = lead.mobile_no
c.customer = self.name
c.customer_name = self.customer_name
c.is_primary_contact = 1
c.append('links', dict(link_doctype='Customer', link_name=self.name))
c.flags.ignore_permissions = self.flags.ignore_permissions
c.autoname()
if not frappe.db.exists("Contact", c.name):
@ -137,40 +130,14 @@ class Customer(TransactionBase):
if flt(self.credit_limit) < outstanding_amt:
frappe.throw(_("""New credit limit is less than current outstanding amount for the customer. Credit limit has to be atleast {0}""").format(outstanding_amt))
def delete_customer_address(self):
addresses = frappe.db.sql("""select name, lead from `tabAddress`
where customer=%s""", (self.name,))
for name, lead in addresses:
if lead:
frappe.db.sql("""update `tabAddress` set customer=null, customer_name=null
where name=%s""", name)
else:
frappe.db.sql("""delete from `tabAddress` where name=%s""", name)
def delete_customer_contact(self):
for contact in frappe.db.sql_list("""select name from `tabContact`
where customer=%s""", self.name):
frappe.delete_doc("Contact", contact)
def on_trash(self):
self.delete_customer_address()
self.delete_customer_contact()
delete_contact_and_address('Customer', self.name)
if self.lead_name:
frappe.db.sql("update `tabLead` set status='Interested' where name=%s",self.lead_name)
def after_rename(self, olddn, newdn, merge=False):
set_field = ''
if frappe.defaults.get_global_default('cust_master_name') == 'Customer Name':
frappe.db.set(self, "customer_name", newdn)
self.update_contact()
set_field = ", customer_name=%(newdn)s"
self.update_customer_address(newdn, set_field)
def update_customer_address(self, newdn, set_field):
frappe.db.sql("""update `tabAddress` set address_title=%(newdn)s
{set_field} where customer=%(newdn)s"""\
.format(set_field=set_field), ({"newdn": newdn}))
def get_customer_list(doctype, txt, searchfield, start, page_len, filters):

View File

@ -32,11 +32,7 @@ erpnext.selling.InstallationNote = frappe.ui.form.Controller.extend({
}
});
this.frm.set_query("contact_person", function() {
return {
filters: {'customer': me.frm.doc.customer }
}
});
this.frm.set_query('contact_person', erpnext.queries.contact_query);
this.frm.set_query("customer", function() {
return {

View File

@ -16,6 +16,7 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
},
refresh: function(doc, dt, dn) {
this._super(doc, dt, dn);
if(doc.docstatus == 1 && doc.status!=='Lost') {
cur_frm.add_custom_button(__('Make Sales Order'),
cur_frm.cscript['Make Sales Order']);

View File

@ -203,13 +203,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));
cur_frm.cscript.new_contact = function(){
tn = frappe.model.make_new_doc_and_get_name('Contact');
locals['Contact'][tn].is_customer = 1;
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
frappe.set_route('Form', 'Contact', tn);
}
cur_frm.fields_dict['project'].get_query = function(doc, cdt, cdn) {
return {
query: "erpnext.controllers.queries.get_project_name",

View File

@ -26,16 +26,17 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
this.frm.add_fetch("sales_partner", "commission_rate", "commission_rate");
$.each([["customer_address", "customer_filter"],
["shipping_address_name", "customer_filter"],
["contact_person", "customer_filter"],
["customer", "customer"],
$.each([["customer", "customer"],
["lead", "lead"]],
function(i, opts) {
if(me.frm.fields_dict[opts[0]])
me.frm.set_query(opts[0], erpnext.queries[opts[1]]);
});
me.frm.set_query('contact_person', erpnext.queries.contact_query);
me.frm.set_query('customer_address', erpnext.queries.address_query);
me.frm.set_query('shipping_address_name', erpnext.queries.address_query);
if(this.frm.fields_dict.taxes_and_charges) {
this.frm.set_query("taxes_and_charges", function() {
return {
@ -104,6 +105,9 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
refresh: function() {
this._super();
frappe.contact_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
this.frm.toggle_display("customer_name",
(this.frm.doc.customer_name && this.frm.doc.customer_name!==this.frm.doc.customer));
if(this.frm.fields_dict.packed_items) {

View File

@ -1,14 +1,17 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
cur_frm.cscript.refresh = function(doc,dt,dn){
frappe.ui.form.on('Sales Partner', {
refresh: function(frm) {
frappe.contact_link = {doc: frm.doc, fieldname: 'name', doctype: 'Sales Person'}
if(doc.__islocal){
hide_field(['address_html', 'contact_html']);
erpnext.utils.clear_address_and_contact(cur_frm);
if(doc.__islocal){
hide_field(['address_html', 'contact_html']);
erpnext.utils.clear_address_and_contact(frm);
}
else{
unhide_field(['address_html', 'contact_html']);
erpnext.utils.render_address_and_contact(frm);
}
}
else{
unhide_field(['address_html', 'contact_html']);
erpnext.utils.render_address_and_contact(cur_frm);
}
}
});

View File

@ -407,7 +407,7 @@ def create_customers(args):
if args.get("customer_contact_" + str(i)):
create_contact(args.get("customer_contact_" + str(i)),
"customer", doc.name)
"Customer", doc.name)
except frappe.NameError:
pass
@ -425,7 +425,7 @@ def create_suppliers(args):
if args.get("supplier_contact_" + str(i)):
create_contact(args.get("supplier_contact_" + str(i)),
"supplier", doc.name)
"Supplier", doc.name)
except frappe.NameError:
pass
@ -433,12 +433,13 @@ def create_contact(contact, party_type, party):
"""Create contact based on given contact name"""
contact = contact.strip().split(" ")
frappe.get_doc({
contact = frappe.get_doc({
"doctype":"Contact",
party_type: party,
"first_name":contact[0],
"last_name": len(contact) > 1 and contact[1] or ""
}).insert()
})
contact.append('links', dict(link_doctype=party_type, link_name=party))
contact.insert()
def create_letter_head(args):
if args.get("attach_letterhead"):

View File

@ -6,7 +6,7 @@ import frappe
from frappe import throw, _
import frappe.defaults
from frappe.utils import cint, flt, get_fullname, cstr
from erpnext.utilities.doctype.address.address import get_address_display
from frappe.geo.doctype.address.address import get_address_display
from erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings import get_shopping_cart_settings
from frappe.utils.nestedset import get_root_of
from erpnext.accounts.utils import get_account_name
@ -182,8 +182,7 @@ def _get_cart_quotation(party=None):
(party.doctype.lower()): party.name
})
qdoc.contact_person = frappe.db.get_value("Contact", {"email_id": frappe.session.user,
"customer": party.name})
qdoc.contact_person = frappe.db.get_value("Contact", {"email_id": frappe.session.user})
qdoc.contact_email = frappe.session.user
qdoc.flags.ignore_permissions = True
@ -198,8 +197,7 @@ def update_party(fullname, company_name=None, mobile_no=None, phone=None):
party.customer_name = company_name or fullname
party.customer_type == "Company" if company_name else "Individual"
contact_name = frappe.db.get_value("Contact", {"email_id": frappe.session.user,
"customer": party.name})
contact_name = frappe.db.get_value("Contact", {"email_id": frappe.session.user})
contact = frappe.get_doc("Contact", contact_name)
contact.first_name = fullname
contact.last_name = None
@ -291,10 +289,14 @@ def get_party(user=None):
if not user:
user = frappe.session.user
party = frappe.db.get_value("Contact", {"email_id": user}, ["customer", "supplier"], as_dict=1)
if party:
party_doctype = 'Customer' if party.customer else 'Supplier'
party = party.customer or party.supplier
contact_name = frappe.db.get_value("Contact", {"email_id": user})
party = None
if contact_name:
contact = frappe.get_doc('Contact', contact_name)
if contact.links:
party_doctype = contact.links[0].link_doctype
party = contact.links[0].link_name
cart_settings = frappe.get_doc("Shopping Cart Settings")
@ -331,10 +333,10 @@ def get_party(user=None):
contact = frappe.new_doc("Contact")
contact.update({
"customer": customer.name,
"first_name": fullname,
"email_id": user
})
contact.append('links', dict(link_doctype='Customer', link_name=customer.name))
contact.flags.ignore_mandatory = True
contact.insert(ignore_permissions=True)
@ -383,17 +385,6 @@ def get_address_docs(doctype=None, txt=None, filters=None, limit_start=0, limit_
return address_docs
def set_customer_in_address(doc, method=None):
if doc.flags.linked:
return
doc.check_if_linked()
if not doc.flags.linked and (frappe.db.get_value("User", frappe.session.user, "user_type") == "Website User"):
# creates a customer if one does not exist
get_party()
doc.link_address()
@frappe.whitelist()
def apply_shipping_rule(shipping_rule):
quotation = _get_cart_quotation()

View File

@ -25,8 +25,8 @@ class TestShoppingCart(unittest.TestCase):
# test if lead is created and quotation with new lead is fetched
quotation = _get_cart_quotation()
self.assertEquals(quotation.quotation_to, "Customer")
self.assertEquals(frappe.db.get_value("Contact", {"customer": quotation.customer}, "email_id"),
"test_cart_user@example.com")
self.assertEquals(frappe.db.get_value("Contact", dict(contact_person="test_cart_user@example.com")),
quotation.contact_name)
self.assertEquals(quotation.lead, None)
self.assertEquals(quotation.contact_email, frappe.session.user)
@ -101,7 +101,7 @@ class TestShoppingCart(unittest.TestCase):
quotation = self.create_quotation()
from erpnext.accounts.party import set_taxes
tax_rule_master = set_taxes(quotation.customer, "Customer", \
quotation.transaction_date, quotation.company, None, None, \
quotation.customer_address, quotation.shipping_address_name, 1)

View File

@ -31,12 +31,11 @@ def update_website_context(context):
def check_customer_or_supplier():
if frappe.session.user:
contacts = frappe.get_all("Contact", fields=["customer", "supplier", "email_id"],
filters={"email_id": frappe.session.user})
contact_name = frappe.get_value("Contact", {"email_id": frappe.session.user})
if contact_name:
contact = frappe.get_doc('Contact', contact_name)
for link in contact.links:
if link.link_doctype in ('Customer', 'Supplier'):
return link.link_doctype, link.link_name
customer = [d.customer for d in contacts if d.customer] or None
supplier = [d.supplier for d in contacts if d.supplier] or None
if customer: return 'Customer', customer
if supplier : return 'Supplier', supplier
return 'Customer', None

View File

@ -137,13 +137,6 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
// for backward compatibility: combine new and previous states
$.extend(cur_frm.cscript, new erpnext.stock.DeliveryNoteController({frm: cur_frm}));
cur_frm.cscript.new_contact = function(){
tn = frappe.model.make_new_doc_and_get_name('Contact');
locals['Contact'][tn].is_customer = 1;
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
frappe.set_route('Form', 'Contact', tn);
}
cur_frm.cscript.update_status = function(status) {
frappe.ui.form.is_saving = true;

View File

@ -26,7 +26,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "",
"length": 0,
"no_copy": 0,
@ -55,7 +54,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Series",
"length": 0,
"no_copy": 0,
@ -84,7 +82,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Code",
"length": 0,
"no_copy": 1,
@ -115,7 +112,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 1,
"label": "Variant Of",
"length": 0,
"no_copy": 0,
@ -144,7 +140,6 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Name",
"length": 0,
"no_copy": 0,
@ -173,7 +168,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Barcode",
"length": 0,
"no_copy": 1,
@ -201,7 +195,6 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Item Group",
"length": 0,
"no_copy": 0,
@ -232,7 +225,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Unit of Measure",
"length": 0,
"no_copy": 0,
@ -262,7 +254,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -288,7 +279,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Disabled",
"length": 0,
"no_copy": 0,
@ -318,7 +308,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Maintain Stock",
"length": 0,
"no_copy": 0,
@ -349,7 +338,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Opening Stock",
"length": 0,
"no_copy": 0,
@ -365,40 +353,39 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(doc.__islocal && doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no && doc.opening_stock)",
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Valuation Rate",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:(doc.__islocal && doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no && doc.opening_stock)",
"fieldname": "valuation_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Valuation Rate",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "standard_rate",
"fieldtype": "Currency",
"hidden": 0,
@ -406,7 +393,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Standard Selling Rate",
"length": 0,
"no_copy": 0,
@ -434,7 +420,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Fixed Asset",
"length": 0,
"no_copy": 0,
@ -463,7 +448,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Asset Category",
"length": 0,
"no_copy": 0,
@ -492,7 +476,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image",
"length": 0,
"no_copy": 0,
@ -521,7 +504,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@ -549,7 +531,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Brand",
"length": 0,
"no_copy": 0,
@ -579,7 +560,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@ -610,7 +590,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Inventory",
"length": 0,
"no_copy": 0,
@ -641,7 +620,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Warehouse",
"length": 0,
"no_copy": 0,
@ -673,7 +651,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "End of Life",
"length": 0,
"no_copy": 0,
@ -704,7 +681,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Has Batch No",
"length": 0,
"no_copy": 0,
@ -737,7 +713,6 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Has Serial No",
"length": 0,
"no_copy": 0,
@ -769,7 +744,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Serial Number Series",
"length": 0,
"no_copy": 0,
@ -797,7 +771,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Material Request Type",
"length": 0,
"no_copy": 0,
@ -827,7 +800,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"oldfieldtype": "Column Break",
@ -857,7 +829,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow over delivery or receipt upto this percent",
"length": 0,
"no_copy": 0,
@ -887,7 +858,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Valuation Method",
"length": 0,
"no_copy": 0,
@ -916,7 +886,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Warranty Period (in days)",
"length": 0,
"no_copy": 0,
@ -947,7 +916,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Net Weight",
"length": 0,
"no_copy": 0,
@ -975,7 +943,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Weight UOM",
"length": 0,
"no_copy": 0,
@ -1005,7 +972,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Auto re-order",
"length": 0,
"no_copy": 0,
@ -1035,7 +1001,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Reorder level based on Warehouse",
"length": 0,
"no_copy": 0,
@ -1126,7 +1091,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Variants",
"length": 0,
"no_copy": 0,
@ -1157,7 +1121,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Has Variants",
"length": 0,
"no_copy": 1,
@ -1187,7 +1150,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Attributes",
"length": 0,
"no_copy": 1,
@ -1216,7 +1178,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Purchase Details",
"length": 0,
"no_copy": 0,
@ -1246,7 +1207,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Purchase Item",
"length": 0,
"no_copy": 0,
@ -1277,7 +1237,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Minimum Order Qty",
"length": 0,
"no_copy": 0,
@ -1306,7 +1265,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Safety Stock",
"length": 0,
"no_copy": 0,
@ -1336,7 +1294,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Lead Time in days",
"length": 0,
"no_copy": 0,
@ -1367,7 +1324,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Buying Cost Center",
"length": 0,
"no_copy": 0,
@ -1399,7 +1355,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Expense Account",
"length": 0,
"no_copy": 0,
@ -1430,7 +1385,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Last Purchase Rate",
"length": 0,
"no_copy": 1,
@ -1460,7 +1414,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier Details",
"length": 0,
"no_copy": 0,
@ -1489,7 +1442,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Supplier",
"length": 0,
"no_copy": 0,
@ -1517,7 +1469,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Delivered by Supplier (Drop Ship)",
"length": 0,
"no_copy": 0,
@ -1546,7 +1497,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Manufacturer",
"length": 0,
"no_copy": 0,
@ -1575,7 +1525,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Manufacturer Part Number",
"length": 0,
"no_copy": 0,
@ -1603,7 +1552,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Code for Suppliers",
"length": 0,
"no_copy": 0,
@ -1633,7 +1581,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier Items",
"length": 0,
"no_copy": 0,
@ -1661,7 +1608,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Sales Details",
"length": 0,
"no_copy": 0,
@ -1691,7 +1637,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Sales Item",
"length": 0,
"no_copy": 0,
@ -1721,7 +1666,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Publish in Hub",
"length": 0,
"no_copy": 0,
@ -1750,7 +1694,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Synced With Hub",
"length": 0,
"no_copy": 0,
@ -1779,7 +1722,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Income Account",
"length": 0,
"no_copy": 0,
@ -1808,7 +1750,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default Selling Cost Center",
"length": 0,
"no_copy": 0,
@ -1837,7 +1778,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer Item Codes",
"length": 0,
"no_copy": 0,
@ -1868,7 +1808,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer Items",
"length": 0,
"no_copy": 0,
@ -1897,7 +1836,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Max Discount (%)",
"length": 0,
"no_copy": 0,
@ -1926,7 +1864,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Item Tax",
"length": 0,
"no_copy": 0,
@ -1956,7 +1893,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Taxes",
"length": 0,
"no_copy": 0,
@ -1986,7 +1922,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Inspection Criteria",
"length": 0,
"no_copy": 0,
@ -2016,7 +1951,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Inspection Required before Purchase",
"length": 0,
"no_copy": 0,
@ -2046,7 +1980,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Inspection Required before Delivery",
"length": 0,
"no_copy": 0,
@ -2076,7 +2009,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Quality Parameters",
"length": 0,
"no_copy": 0,
@ -2107,7 +2039,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Manufacturing",
"length": 0,
"no_copy": 0,
@ -2137,7 +2068,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Default BOM",
"length": 0,
"no_copy": 1,
@ -2169,7 +2099,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supply Raw Materials for Purchase",
"length": 0,
"no_copy": 0,
@ -2199,7 +2128,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -2226,7 +2154,6 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer Code",
"length": 0,
"no_copy": 1,
@ -2253,7 +2180,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website",
"length": 0,
"no_copy": 0,
@ -2282,7 +2208,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show in Website",
"length": 0,
"no_copy": 0,
@ -2310,7 +2235,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Show in Website (Variant)",
"length": 0,
"no_copy": 0,
@ -2339,7 +2263,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Route",
"length": 0,
"no_copy": 0,
@ -2369,7 +2292,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Weightage",
"length": 0,
"no_copy": 0,
@ -2398,7 +2320,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Slideshow",
"length": 0,
"no_copy": 0,
@ -2428,7 +2349,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Image",
"length": 0,
"no_copy": 0,
@ -2456,7 +2376,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Thumbnail",
"length": 0,
"no_copy": 0,
@ -2484,7 +2403,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@ -2512,7 +2430,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Warehouse",
"length": 0,
"no_copy": 0,
@ -2542,7 +2459,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Item Groups",
"length": 0,
"no_copy": 0,
@ -2572,7 +2488,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Specifications",
"length": 0,
"no_copy": 0,
@ -2600,7 +2515,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Copy From Item Group",
"length": 0,
"no_copy": 0,
@ -2628,7 +2542,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Specifications",
"length": 0,
"no_copy": 0,
@ -2657,7 +2570,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Website Description",
"length": 0,
"no_copy": 0,
@ -2684,7 +2596,6 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Total Projected Qty",
"length": 0,
"no_copy": 0,
@ -2713,7 +2624,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
"modified": "2016-12-27 12:17:44.227302",
"modified": "2017-01-10 12:02:51.807965",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",

View File

@ -26,7 +26,7 @@ frappe.ui.form.on("Purchase Receipt", {
]
}
});
}
});
@ -122,26 +122,6 @@ cur_frm.cscript.update_status = function(status) {
})
}
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
return {
filters: { 'supplier': doc.supplier}
}
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return {
filters: { 'supplier': doc.supplier }
}
}
cur_frm.cscript.new_contact = function() {
tn = frappe.model.make_new_doc_and_get_name('Contact');
locals['Contact'][tn].is_supplier = 1;
if(doc.supplier)
locals['Contact'][tn].supplier = doc.supplier;
frappe.set_route('Form', 'Contact', tn);
}
cur_frm.fields_dict['items'].grid.get_field('project').get_query = function(doc, cdt, cdn) {
return {
filters: [

View File

@ -27,9 +27,6 @@ class StockLedgerEntry(Document):
self.validate_and_set_fiscal_year()
self.block_transactions_against_group_warehouse()
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year, self.meta.get_label("posting_date"), self)
def on_submit(self):
self.check_stock_frozen_date()
self.actual_amt_check()
@ -117,6 +114,10 @@ class StockLedgerEntry(Document):
def validate_and_set_fiscal_year(self):
if not self.fiscal_year:
self.fiscal_year = get_fiscal_year(self.posting_date, company=self.company)[0]
else:
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.posting_date, self.fiscal_year, self.company,
self.meta.get_label("posting_date"), self)
def block_transactions_against_group_warehouse(self):
from erpnext.stock.utils import is_group_warehouse

View File

@ -269,26 +269,13 @@ def get_children():
@frappe.whitelist()
def add_node():
doctype = frappe.form_dict.get('doctype')
company = frappe.form_dict.get('company')
parent_field = 'parent_' + doctype.lower().replace(' ', '_')
name_field = doctype.lower().replace(' ', '_') + '_name'
from frappe.desk.treeview import make_tree_args
args = make_tree_args(**frappe.form_dict)
doc = frappe.new_doc(doctype)
if cint(args.is_root):
args.parent_warehouse = None
parent = frappe.form_dict['parent']
if cint(frappe.form_dict['is_root']):
parent = None
doc.update({
name_field: frappe.form_dict['warehouse_name'],
parent_field: parent,
"is_group": frappe.form_dict['is_group'],
"company": company
})
doc.save()
frappe.get_doc(args).insert()
@frappe.whitelist()
def convert_to_group_or_ledger():

View File

@ -42,9 +42,6 @@ def get_item_details(args):
get_party_item_code(args, item_doc, out)
if out.get("warehouse"):
out.update(get_bin_details(args.item_code, out.warehouse))
if frappe.db.exists("Product Bundle", args.item_code):
valuation_rate = 0.0
bundled_items = frappe.get_doc("Product Bundle", args.item_code)
@ -65,6 +62,9 @@ def get_item_details(args):
if args.customer and cint(args.is_pos):
out.update(get_pos_profile_item_details(args.company, args))
if out.get("warehouse"):
out.update(get_bin_details(args.item_code, out.warehouse))
# update args with out, if key or value not exists
for key, value in out.iteritems():

View File

@ -102,7 +102,7 @@ def get_item_warehouse_map(filters):
"in_qty": 0.0, "in_val": 0.0,
"out_qty": 0.0, "out_val": 0.0,
"bal_qty": 0.0, "bal_val": 0.0,
"val_rate": 0.0, "uom": None
"val_rate": 0.0
})
qty_dict = iwb_map[(d.company, d.item_code, d.warehouse)]
@ -129,6 +129,24 @@ def get_item_warehouse_map(filters):
qty_dict.val_rate = d.valuation_rate
qty_dict.bal_qty += qty_diff
qty_dict.bal_val += value_diff
iwb_map = filter_items_with_no_transactions(iwb_map)
return iwb_map
def filter_items_with_no_transactions(iwb_map):
for (company, item, warehouse) in sorted(iwb_map):
qty_dict = iwb_map[(company, item, warehouse)]
no_transactions = True
for key, val in qty_dict.items():
val = flt(val, 3)
qty_dict[key] = val
if key != "val_rate" and val:
no_transactions = False
if no_transactions:
iwb_map.pop((company, item, warehouse))
return iwb_map

View File

@ -33,11 +33,11 @@ class Issue(Document):
if not self.lead:
self.lead = frappe.db.get_value("Lead", {"email_id": email_id})
if not self.contact:
values = frappe.db.get_value("Contact",
{"email_id": email_id}, ("name", "customer"))
self.contact = frappe.db.get_value("Contact", {"email_id": email_id})
if values:
self.contact, self.customer = values
if self.contact:
contact = frappe.get_doc('Contact', self.contact)
self.customer = contact.get_link_for('Customer')
if not self.company:
self.company = frappe.db.get_value("Lead", self.lead, "company") or \

View File

@ -4,6 +4,10 @@
frappe.provide("erpnext.support");
frappe.ui.form.on("Warranty Claim", {
setup: function(frm) {
frm.set_query('contact_person', erpnext.queries.contact_query);
frm.set_query('customer_address', erpnext.queries.address_query);
},
customer: function(frm) {
erpnext.utils.get_party_details(frm);
},
@ -17,6 +21,8 @@ frappe.ui.form.on("Warranty Claim", {
erpnext.support.WarrantyClaim = frappe.ui.form.Controller.extend({
refresh: function() {
frappe.contact_link = {doc: this.frm.doc, fieldname: 'customer', doctype: 'Customer'}
if(!cur_frm.doc.__islocal &&
(cur_frm.doc.status=='Open' || cur_frm.doc.status == 'Work In Progress')) {
cur_frm.add_custom_button(__('Maintenance Visit'),
@ -40,18 +46,6 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
set_multiple(cdt,cdn,{status:'Open'});
}
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
return{
filters:{ 'customer': doc.customer}
}
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return{
filters:{ 'customer': doc.customer}
}
}
cur_frm.fields_dict['serial_no'].get_query = function(doc, cdt, cdn) {
var cond = [];
var filter = [

View File

@ -48,23 +48,23 @@ $(document).ready(function() {
{% endblock %}
{% block page_content %}
<div class='page-card'>
<!-- no-header -->
<div class="page-hero text-center">
<img src="/assets/erpnext/images/erp-icon.svg" style="max-width: 100px; max-height: 100px;">
<h1>ERPNext Demo</h1>
<p style="margin-top: 60px;">
<input id="lead-email" type="email"
class="form-control" placeholder="Your Email Address (optional)"
style="width: 75%; max-width: 400px; margin: auto;">
</p>
<button type="submit" id="login_btn" class="btn btn-default">Launch Demo</button>
<hr style="margin: 60px 0px;">
<p class="text-muted small">Some functionality is disabled for the demo app. The demo data will be cleared regulary.
<br class="hidden-xs">
To start your free ERPNext account, <a href="https://erpnext.com/signup?plan=Free-Solo">click here</a></p>
<div class='page-card-head'>
<span class='indicator blue'>
{{ _("ERPNext Demo") }}</span>
</div>
<!-- <img src="/assets/erpnext/images/erp-icon.svg" style="max-width: 40px; max-height: 40px;"> -->
<p>Some functionality is disabled for the demo and the data will be cleared regulary.</p>
<div><button type="submit" id="login_btn" class="btn btn-primary btn-sm">Launch Demo</button></div>
</div>
<p class='text-muted text-center small' style='margin-top: -20px;'><a href="https://erpnext.com/signup?plan=Free-Solo">Sign up for a Free ERPNext.com account here</a>
</p>
<style>
html, body {
background-color: #f5f7fa;
}
</style>
{% endblock %}

View File

@ -34,6 +34,8 @@ def send_message(subject="Website Query", message="", sender="", status="Open"):
if customer:
opportunity.customer = customer
elif lead:
opportunity.lead = lead
else:
opportunity.lead = new_lead.name

View File

@ -6,17 +6,46 @@ import frappe
def load_address_and_contact(doc, key):
"""Loads address list and contact list in `__onload`"""
from erpnext.utilities.doctype.address.address import get_address_display
from frappe.geo.doctype.address.address import get_address_display
doc.get("__onload")["addr_list"] = [a.update({"display": get_address_display(a)}) \
for a in frappe.get_all("Address",
fields="*", filters={key: doc.name},
order_by="is_primary_address desc, modified desc")]
address_list = [frappe.get_value('Address', a.parent, '*')
for a in frappe.get_all('Dynamic Link', fields='parent',
filters=dict(parenttype='Address', link_doctype=doc.doctype, link_name=doc.name))]
address_list = [a.update({"display": get_address_display(a)})
for a in address_list]
address_list = sorted(address_list,
lambda a, b:
(int(a.is_primary_address - b.is_primary_address)) or
(1 if a.modified - b.modified else 0))
doc.set_onload('addr_list', address_list)
if doc.doctype != "Lead":
doc.get("__onload")["contact_list"] = frappe.get_all("Contact",
fields="*", filters={key: doc.name},
order_by="is_primary_contact desc, modified desc")
contact_list = [frappe.get_value('Contact', a.parent, '*')
for a in frappe.get_all('Dynamic Link', fields='parent',
filters=dict(parenttype='Contact', link_doctype=doc.doctype, link_name=doc.name))]
contact_list = sorted(contact_list,
lambda a, b:
(int(a.is_primary_contact - b.is_primary_contact)) or
(1 if a.modified - b.modified else 0))
doc.set_onload('contact_list', contact_list)
def set_default_role(doc, method):
'''Set customer, supplier, student based on email'''
contact_name = frappe.get_value('Contact', dict(email_id=doc.email))
if contact_name:
contact = frappe.get_doc('Contact', contact_name)
for link in contact.links:
if link.link_doctype=='Customer':
doc.add_roles('Customer')
elif link.link_doctype=='Supplier':
doc.add_roles('Supplier')
elif frappe.get_value('Student', dict(student_email_id=doc.email)):
doc.add_roles('Student')
def has_permission(doc, ptype, user):
links = get_permitted_and_not_permitted_links(doc.doctype)
@ -50,15 +79,15 @@ def get_permission_query_conditions(doctype):
if not links.get("not_permitted_links"):
# when everything is permitted, don't add additional condition
return ""
elif not links.get("permitted_links"):
conditions = []
# when everything is not permitted
for df in links.get("not_permitted_links"):
# like ifnull(customer, '')='' and ifnull(supplier, '')=''
conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')=''".format(doctype=doctype, fieldname=df.fieldname))
return "( " + " and ".join(conditions) + " )"
else:
@ -66,7 +95,7 @@ def get_permission_query_conditions(doctype):
for df in links.get("permitted_links"):
# like ifnull(customer, '')!='' or ifnull(supplier, '')!=''
conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')!=''".format(doctype=doctype, fieldname=df.fieldname))
conditions.append("ifnull(`tab{doctype}`.`{fieldname}`, '')!=''".format(doctype=doctype, fieldname=df.fieldname))
return "( " + " or ".join(conditions) + " )"
@ -89,3 +118,14 @@ def get_permitted_and_not_permitted_links(doctype):
"permitted_links": permitted_links,
"not_permitted_links": not_permitted_links
}
def delete_contact_and_address(doctype, name):
for parenttype in ('Contact', 'Address'):
items = frappe.db.sql("""select parent from `tabDynamic Link`
where parenttype=%s and link_type=%s and link_name=%s""",
(parenttype, doctype, name))
for name in items:
doc = frappe.get_doc(parenttype, name)
if len(doc.links)==1:
doc.delete()

View File

@ -1 +0,0 @@
Address belonging to a Customer or Supplier.

View File

@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@ -1,13 +0,0 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
{% include 'erpnext/controllers/js/contact_address_common.js' %};
frappe.ui.form.on("Address", "validate", function(frm) {
// clear linked customer / supplier / sales partner on saving...
$.each(["Customer", "Supplier", "Sales Partner", "Lead"], function(i, doctype) {
var name = frm.doc[doctype.toLowerCase().replace(/ /g, "_")];
if(name && locals[doctype] && locals[doctype][name])
frappe.model.remove_from_locals(doctype, name);
});
});

View File

@ -1,851 +0,0 @@
{
"allow_copy": 0,
"allow_import": 1,
"allow_rename": 1,
"beta": 0,
"creation": "2013-01-10 16:34:32",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "address_details",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "",
"length": 0,
"no_copy": 0,
"options": "fa fa-map-marker",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "Name of person or organization that this address belongs to.",
"fieldname": "address_title",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Address Title",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "address_type",
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Address Type",
"length": 0,
"no_copy": 0,
"options": "Billing\nShipping\nOffice\nPersonal\nPlant\nPostal\nShop\nSubsidiary\nWarehouse\nOther",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "address_line1",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Address Line 1",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "address_line2",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Address Line 2",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "city",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "City/Town",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "county",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "County",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "state",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "State",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "country",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 1,
"label": "Country",
"length": 0,
"no_copy": 0,
"options": "Country",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "pincode",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Postal Code",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "50%"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "email_id",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Email Address",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "phone",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Phone",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "fax",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Fax",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"description": "",
"fieldname": "is_primary_address",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Preferred Billing Address",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"description": "",
"fieldname": "is_shipping_address",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Preferred Shipping Address",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "linked_with",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Reference",
"length": 0,
"no_copy": 0,
"options": "fa fa-pushpin",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "0",
"fieldname": "is_your_company_address",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Is Your Company Address",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.is_your_company_address",
"fieldname": "company",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Company",
"length": 0,
"no_copy": 0,
"options": "Company",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.is_your_company_address",
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer",
"length": 0,
"no_copy": 0,
"options": "Customer",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.is_your_company_address",
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Customer Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.is_your_company_address",
"fieldname": "supplier",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier",
"length": 0,
"no_copy": 0,
"options": "Supplier",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 1,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.is_your_company_address",
"fieldname": "supplier_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Supplier Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval: !doc.is_your_company_address",
"fieldname": "sales_partner",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Sales Partner",
"length": 0,
"no_copy": 0,
"options": "Sales Partner",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.supplier && !doc.sales_partner && !doc.is_your_company_address",
"fieldname": "lead",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Lead",
"length": 0,
"no_copy": 0,
"options": "Lead",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:!doc.supplier && !doc.sales_partner && !doc.is_your_company_address",
"fieldname": "lead_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Lead Name",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 1,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "fa fa-map-marker",
"idx": 5,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-11-07 05:47:06.911933",
"modified_by": "Administrator",
"module": "Utilities",
"name": "Address",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Sales User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Purchase User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Maintenance User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
},
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 0,
"email": 1,
"export": 0,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "customer, supplier, sales_partner, country, state",
"sort_field": "modified",
"sort_order": "DESC",
"track_seen": 0
}

View File

@ -1,181 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import throw, _
from frappe.utils import cstr
from frappe.model.document import Document
from jinja2 import TemplateSyntaxError
from frappe.utils.user import is_website_user
from frappe.model.naming import make_autoname
class Address(Document):
def __setup__(self):
self.flags.linked = False
def autoname(self):
if not self.address_title:
self.address_title = self.customer \
or self.supplier or self.sales_partner or self.lead
if self.address_title:
self.name = (cstr(self.address_title).strip() + "-" + cstr(self.address_type).strip())
if frappe.db.exists("Address", self.name):
self.name = make_autoname(cstr(self.address_title).strip() + "-" +
cstr(self.address_type).strip() + "-.#")
else:
throw(_("Address Title is mandatory."))
def validate(self):
self.link_fields = ("customer", "supplier", "sales_partner", "lead")
self.link_address()
self.validate_primary_address()
self.validate_shipping_address()
self.validate_reference()
def validate_primary_address(self):
"""Validate that there can only be one primary address for particular customer, supplier"""
if self.is_primary_address == 1:
self._unset_other("is_primary_address")
elif self.is_shipping_address != 1:
for fieldname in self.link_fields:
if self.get(fieldname):
if not frappe.db.sql("""select name from `tabAddress` where is_primary_address=1
and `%s`=%s and name!=%s""" % (frappe.db.escape(fieldname), "%s", "%s"),
(self.get(fieldname), self.name)):
self.is_primary_address = 1
break
def link_address(self):
"""Link address based on owner"""
if not self.flags.linked:
self.check_if_linked()
if not self.flags.linked and not self.is_your_company_address:
contact = frappe.db.get_value("Contact", {"email_id": self.owner},
("name", "customer", "supplier"), as_dict = True)
if contact:
self.customer = contact.customer
self.supplier = contact.supplier
self.lead = frappe.db.get_value("Lead", {"email_id": self.owner})
def check_if_linked(self):
for fieldname in self.link_fields:
if self.get(fieldname):
self.flags.linked = True
break
def validate_shipping_address(self):
"""Validate that there can only be one shipping address for particular customer, supplier"""
if self.is_shipping_address == 1:
self._unset_other("is_shipping_address")
def validate_reference(self):
if self.is_your_company_address:
if not self.company:
frappe.throw(_("Company is mandatory, as it is your company address"))
if self.customer or self.supplier or self.sales_partner or self.lead:
frappe.throw(_("Remove reference of customer, supplier, sales partner and lead, as it is your company address"))
def _unset_other(self, is_address_type):
for fieldname in ["customer", "supplier", "sales_partner", "lead"]:
if self.get(fieldname):
frappe.db.sql("""update `tabAddress` set `%s`=0 where `%s`=%s and name!=%s""" %
(is_address_type, fieldname, "%s", "%s"), (self.get(fieldname), self.name))
break
def get_display(self):
return get_address_display(self.as_dict())
@frappe.whitelist()
def get_address_display(address_dict):
if not address_dict:
return
if not isinstance(address_dict, dict):
address_dict = frappe.db.get_value("Address", address_dict, "*", as_dict=True) or {}
name, template = get_address_templates(address_dict)
try:
return frappe.render_template(template, address_dict)
except TemplateSyntaxError:
frappe.throw(_("There is an error in your Address Template {0}").format(name))
def get_territory_from_address(address):
"""Tries to match city, state and country of address to existing territory"""
if not address:
return
if isinstance(address, basestring):
address = frappe.get_doc("Address", address)
territory = None
for fieldname in ("city", "state", "country"):
territory = frappe.db.get_value("Territory", address.get(fieldname))
if territory:
break
return territory
def get_list_context(context=None):
from erpnext.shopping_cart.cart import get_address_docs
return {
"title": _("Addresses"),
"get_list": get_address_list,
"row_template": "templates/includes/address_row.html",
'no_breadcrumbs': True,
}
def get_address_list(doctype, txt, filters, limit_start, limit_page_length=20):
from frappe.www.list import get_list
user = frappe.session.user
ignore_permissions = False
if is_website_user():
if not filters: filters = []
filters.append(("Address", "owner", "=", user))
ignore_permissions = True
return get_list(doctype, txt, filters, limit_start, limit_page_length, ignore_permissions=ignore_permissions)
def has_website_permission(doc, ptype, user, verbose=False):
"""Returns true if customer or lead matches with user"""
customer = frappe.db.get_value("Contact", {"email_id": frappe.session.user}, "customer")
if customer:
return doc.customer == customer
else:
lead = frappe.db.get_value("Lead", {"email_id": frappe.session.user})
if lead:
return doc.lead == lead
return False
def get_address_templates(address):
result = frappe.db.get_value("Address Template", \
{"country": address.get("country")}, ["name", "template"])
if not result:
result = frappe.db.get_value("Address Template", \
{"is_default": 1}, ["name", "template"])
if not result:
frappe.throw(_("No default Address Template found. Please create a new one from Setup > Printing and Branding > Address Template."))
else:
return result
@frappe.whitelist()
def get_shipping_address(company):
filters = {"company": company, "is_your_company_address":1}
fieldname = ["name", "address_line1", "address_line2", "city", "state", "country"]
address_as_dict = frappe.db.get_value("Address", filters=filters, fieldname=fieldname, as_dict=True)
if address_as_dict:
name, address_template = get_address_templates(address_as_dict)
return address_as_dict.get("name"), frappe.render_template(address_template, address_as_dict)

View File

@ -1,21 +0,0 @@
# Copyright (c) 2015, Frappe 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('Address')
import unittest
import frappe
from erpnext.utilities.doctype.address.address import get_address_display
class TestAddress(unittest.TestCase):
def test_template_works(self):
address = frappe.get_list("Address")[0].name
display = get_address_display(frappe.get_doc("Address", address).as_dict())
self.assertTrue(display)
test_dependencies = ["Address Template"]

View File

@ -1,15 +0,0 @@
[
{
"address_line1": "_Test Address Line 1",
"address_title": "_Test Address",
"address_type": "Office",
"city": "_Test City",
"state": "Test State",
"country": "India",
"customer": "_Test Customer",
"customer_name": "_Test Customer",
"doctype": "Address",
"is_primary_address": 1,
"phone": "+91 0000000000"
}
]

View File

@ -1,16 +0,0 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.ui.form.on('Address Template', {
refresh: function(frm) {
if(frm.is_new() && !frm.doc.template) {
// set default template via js so that it is translated
frappe.call({
method: 'erpnext.utilities.doctype.address_template.address_template.get_default_address_template',
callback: function(r) {
frm.set_value('template', r.message);
}
});
}
}
});

View File

@ -1,147 +0,0 @@
{
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 1,
"autoname": "field:country",
"beta": 0,
"creation": "2014-06-05 02:22:36.029850",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "country",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Country",
"length": 0,
"no_copy": 0,
"options": "Country",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 1,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"description": "This format is used if country specific format is not found",
"fieldname": "is_default",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Is Default",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"description": "<h4>Default Template</h4>\n<p>Uses <a href=\"http://jinja.pocoo.org/docs/templates/\">Jinja Templating</a> and all the fields of Address (including Custom Fields if any) will be available</p>\n<pre><code>{{ address_line1 }}&lt;br&gt;\n{% if address_line2 %}{{ address_line2 }}&lt;br&gt;{% endif -%}\n{{ city }}&lt;br&gt;\n{% if state %}{{ state }}&lt;br&gt;{% endif -%}\n{% if pincode %} PIN: {{ pincode }}&lt;br&gt;{% endif -%}\n{{ country }}&lt;br&gt;\n{% if phone %}Phone: {{ phone }}&lt;br&gt;{% endif -%}\n{% if fax %}Fax: {{ fax }}&lt;br&gt;{% endif -%}\n{% if email_id %}Email: {{ email_id }}&lt;br&gt;{% endif -%}\n</code></pre>",
"fieldname": "template",
"fieldtype": "Code",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Template",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
}
],
"hide_heading": 0,
"hide_toolbar": 0,
"icon": "fa fa-map-marker",
"idx": 0,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-11-07 05:47:11.633848",
"modified_by": "Administrator",
"module": "Utilities",
"name": "Address Template",
"name_case": "",
"owner": "Administrator",
"permissions": [
{
"amend": 0,
"apply_user_permissions": 0,
"cancel": 0,
"create": 1,
"delete": 1,
"email": 0,
"export": 1,
"if_owner": 0,
"import": 0,
"is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
"report": 1,
"role": "System Manager",
"set_user_permissions": 1,
"share": 1,
"submit": 0,
"write": 1
}
],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_seen": 0
}

View File

@ -1,42 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils.jinja import validate_template
from frappe import _
class AddressTemplate(Document):
def validate(self):
if not self.template:
self.template = get_default_address_template()
self.defaults = frappe.db.get_values("Address Template", {"is_default":1, "name":("!=", self.name)})
if not self.is_default:
if not self.defaults:
self.is_default = 1
frappe.msgprint(_("Setting this Address Template as default as there is no other default"))
validate_template(self.template)
def on_update(self):
if self.is_default and self.defaults:
for d in self.defaults:
frappe.db.set_value("Address Template", d[0], "is_default", 0)
def on_trash(self):
if self.is_default:
frappe.throw(_("Default Address Template cannot be deleted"))
@frappe.whitelist()
def get_default_address_template():
'''Get default address template (translated)'''
return '''{{ address_line1 }}<br>{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}\
{{ city }}<br>
{% if state %}{{ state }}<br>{% endif -%}
{% if pincode %}{{ pincode }}<br>{% endif -%}
{{ country }}<br>
{% if phone %}'''+_('Phone')+''': {{ phone }}<br>{% endif -%}
{% if fax %}'''+_('Fax')+''': {{ fax }}<br>{% endif -%}
{% if email_id %}'''+_('Email')+''': {{ email_id }}<br>{% endif -%}'''

View File

@ -1,27 +0,0 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: See license.txt
from __future__ import unicode_literals
import frappe
test_records = frappe.get_test_records('Address Template')
import unittest
import frappe
class TestAddressTemplate(unittest.TestCase):
def test_default_is_unset(self):
a = frappe.get_doc("Address Template", "India")
a.is_default = 1
a.save()
b = frappe.get_doc("Address Template", "Brazil")
b.is_default = 1
b.save()
self.assertEqual(frappe.db.get_value("Address Template", "India", "is_default"), 0)
def tearDown(self):
a = frappe.get_doc("Address Template", "India")
a.is_default = 1
a.save()

View File

@ -1,13 +0,0 @@
[
{
"country": "India",
"is_default": 1,
"template": "{{ address_title }}<br>\n{{ address_line1 }}<br>\n{% if address_line2 %}{{ address_line2 }}<br>{% endif %}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif %}\n{% if pincode %} PIN / ZIP: {{ pincode }}<br>{% endif %}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif %}\n{% if fax %}Fax: {{ fax }}<br>{% endif %}\n{% if email_id %}Email: {{ email_id }}<br>{% endif %}\n"
},
{
"country": "Brazil",
"is_default": 0,
"template": "{{ address_title }}<br>\n{{ address_line1 }}<br>\n{% if address_line2 %}{{ address_line2 }}<br>{% endif %}\n{{ city }}<br>\n{% if state %}{{ state }}<br>{% endif %}\n{% if pincode %} PIN / ZIP: {{ pincode }}<br>{% endif %}\n{{ country }}<br>\n{% if phone %}Phone: {{ phone }}<br>{% endif %}\n{% if fax %}Fax: {{ fax }}<br>{% endif %}\n{% if email_id %}Email: {{ email_id }}<br>{% endif %}\n"
}
]

Some files were not shown because too many files have changed in this diff Show More