[setup][fix] company fixtures

This commit is contained in:
Prateeksha Singh 2018-11-20 23:38:19 +05:30
parent 6bf22fa7d7
commit 6f7233229e
3 changed files with 10 additions and 13 deletions

View File

@ -97,7 +97,7 @@ class Company(NestedSet):
if not frappe.db.get_value("Department", {"company": self.name}):
from erpnext.setup.setup_wizard.operations.install_fixtures import install_post_company_fixtures
install_post_company_fixtures(self.name)
install_post_company_fixtures(frappe._dict({'company_name': self.name}))
if not frappe.db.get_value("Cost Center", {"is_group": 0, "company": self.name}):
self.create_default_cost_center()

View File

@ -373,11 +373,15 @@ def install_post_company_fixtures(args=None):
{'doctype': 'Department', 'department_name': _('Quality Management'), 'parent_department': _('All Departments'), 'company': args.company_name},
{'doctype': 'Department', 'department_name': _('Research & Development'), 'parent_department': _('All Departments'), 'company': args.company_name},
{'doctype': 'Department', 'department_name': _('Legal'), 'parent_department': _('All Departments'), 'company': args.company_name},
]
make_records(records)
def install_defaults(args=None):
records = [
# Price Lists
{ "doctype": "Price List", "price_list_name": _("Standard Buying"), "enabled": 1, "buying": 1, "selling": 0, "currency": args.currency },
{ "doctype": "Price List", "price_list_name": _("Standard Selling"), "enabled": 1, "buying": 0, "selling": 1, "currency": args.currency },
]
make_records(records)
@ -478,7 +482,7 @@ def install_post_company_fixtures(args=None):
]
# TODO:
# make_records(records, True)
make_records(records, True)
def get_fy_details(fy_start_date, fy_end_date):

View File

@ -5,6 +5,7 @@ from __future__ import unicode_literals
import frappe
import json
from time import time
from frappe import _
from .operations import install_fixtures as fixtures, taxes_setup, company_setup, sample_data
@ -93,7 +94,7 @@ def setup_complete(args=None):
fin(args)
def stage_fixtures(args):
fixtures.install(_dict(frappe.local.conf.setup).country)
fixtures.install(args.get('country'))
def setup_company(args):
fixtures.install_company(args)
@ -140,7 +141,7 @@ def make_setup_docs(args):
args.update(config)
fixtures.install_company(_dict(args))
fixtures.install_post_company_fixtures(_dict(args))
fixtures.install_defaults(_dict(args))
run_post_setup_complete(args)
@ -148,11 +149,3 @@ def make_setup_docs(args):
def setup(args, config=None):
install_fixtures()
make_setup_docs(args)
def get_fy_details(fy_start_date, fy_end_date):
start_year = getdate(fy_start_date).year
if start_year == getdate(fy_end_date).year:
fy = cstr(start_year)
else:
fy = cstr(start_year) + '-' + cstr(start_year + 1)
return fy