Collect accounting_method on company step, apply to Company
Tax Policy → Uçot metodu (Accounting Method) is a Select with two
options ("Hesablama metodu" / "Kassa metodu") that the e-taxes
/v2/profile payload doesn't carry — it's a user choice. Add a Select
on the company wizard step (right under the FIFO/Moving Average
picker), default "Hesablama metodu".
Persisted by passing accounting_method through build_setup_args into
setup_complete (Frappe ignores unknown args; we read it back in
materialize_after_setup) and then a direct frappe.db.set_value on the
new Company. Done in the same block as valuation_method since both
come from the same step. _apply_company_profile won't clobber it
because the profile payload has no field for it.
Confirm screen now shows the chosen accounting method. Trace
breadcrumb "materialize start" now includes accounting_method
alongside valuation_method.
This commit is contained in:
parent
89ae5e237c
commit
f10721302e
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.1.13"
|
__version__ = "0.1.14"
|
||||||
|
|
|
||||||
|
|
@ -275,6 +275,18 @@ def materialize_after_setup(args):
|
||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"Company", company_name, "valuation_method", chosen_vm, update_modified=False
|
"Company", company_name, "valuation_method", chosen_vm, update_modified=False
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Tax Policy: accounting_method ("Hesablama metodu" / "Kassa metodu")
|
||||||
|
# is collected on the same wizard step as valuation_method, so we apply
|
||||||
|
# both here. The e-taxes /v2/profile payload does not carry this field
|
||||||
|
# — it's purely a user choice. _apply_company_profile later won't
|
||||||
|
# override unless that changes upstream.
|
||||||
|
chosen_am = (args or {}).get("accounting_method") or ""
|
||||||
|
if chosen_am in ("Hesablama metodu", "Kassa metodu"):
|
||||||
|
frappe.db.set_value(
|
||||||
|
"Company", company_name, "accounting_method", chosen_am, update_modified=False
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
stock_settings = frappe.get_doc("Stock Settings")
|
stock_settings = frappe.get_doc("Stock Settings")
|
||||||
stock_settings.valuation_method = chosen_vm
|
stock_settings.valuation_method = chosen_vm
|
||||||
|
|
@ -1161,6 +1173,7 @@ def _log_materialize_entry(args):
|
||||||
"company_name": company_name,
|
"company_name": company_name,
|
||||||
"company_exists": bool(company_name and frappe.db.exists("Company", company_name)),
|
"company_exists": bool(company_name and frappe.db.exists("Company", company_name)),
|
||||||
"valuation_method": (args or {}).get("valuation_method"),
|
"valuation_method": (args or {}).get("valuation_method"),
|
||||||
|
"accounting_method": (args or {}).get("accounting_method"),
|
||||||
"chart_of_accounts": (args or {}).get("chart_of_accounts"),
|
"chart_of_accounts": (args or {}).get("chart_of_accounts"),
|
||||||
"country": (args or {}).get("country"),
|
"country": (args or {}).get("country"),
|
||||||
"currency": (args or {}).get("currency"),
|
"currency": (args or {}).get("currency"),
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ frappe.provide("jey_wizard");
|
||||||
// Bump this string in every commit that changes wizard code. Displayed in the badge so
|
// Bump this string in every commit that changes wizard code. Displayed in the badge so
|
||||||
// we can tell at a glance which version is actually running on a given machine. Kept in
|
// we can tell at a glance which version is actually running on a given machine. Kept in
|
||||||
// sync with __version__ in jey_wizard/__init__.py.
|
// sync with __version__ in jey_wizard/__init__.py.
|
||||||
const JEY_WIZARD_VERSION = "0.1.13";
|
const JEY_WIZARD_VERSION = "0.1.14";
|
||||||
|
|
||||||
// Wipe Frappe + ERPNext default slides so their `before_load`/`after_load` listeners
|
// Wipe Frappe + ERPNext default slides so their `before_load`/`after_load` listeners
|
||||||
// don't try to mutate a wizard that isn't slide-based anymore.
|
// don't try to mutate a wizard that isn't slide-based anymore.
|
||||||
|
|
@ -53,6 +53,7 @@ frappe.setup.SetupWizard = class JeySetupWizard {
|
||||||
fy_start_date: `${year}-01-01`,
|
fy_start_date: `${year}-01-01`,
|
||||||
fy_end_date: `${year}-12-31`,
|
fy_end_date: `${year}-12-31`,
|
||||||
valuation_method: "FIFO",
|
valuation_method: "FIFO",
|
||||||
|
accounting_method: "Hesablama metodu",
|
||||||
// Admin user (fresh user step — Administrator stays untouched)
|
// Admin user (fresh user step — Administrator stays untouched)
|
||||||
user_full_name: "",
|
user_full_name: "",
|
||||||
user_email: "",
|
user_email: "",
|
||||||
|
|
@ -424,11 +425,21 @@ frappe.setup.SetupWizard = class JeySetupWizard {
|
||||||
</select>
|
</select>
|
||||||
<div style="color:#888;font-size:12px;margin-top:6px">${__("Cannot be changed after the first stock entry.")}</div>
|
<div style="color:#888;font-size:12px;margin-top:6px">${__("Cannot be changed after the first stock entry.")}</div>
|
||||||
</div>
|
</div>
|
||||||
|
<h4 style="margin-top:20px;margin-bottom:10px">${__("Uçot metodu (Accounting Method)")}</h4>
|
||||||
|
<div style="max-width:280px">
|
||||||
|
<label style="display:block;margin-bottom:4px">${__("Accounting method")}</label>
|
||||||
|
<select class="jey-accounting-method form-control">
|
||||||
|
<option value="Hesablama metodu">${__("Hesablama metodu")}</option>
|
||||||
|
<option value="Kassa metodu">${__("Kassa metodu")}</option>
|
||||||
|
</select>
|
||||||
|
<div style="color:#888;font-size:12px;margin-top:6px">${__("Stored in Company → Tax Policy.")}</div>
|
||||||
|
</div>
|
||||||
`);
|
`);
|
||||||
$body.find(".jey-company-name").val(this.data.company_name);
|
$body.find(".jey-company-name").val(this.data.company_name);
|
||||||
$body.find(".jey-fy-start").val(this.data.fy_start_date);
|
$body.find(".jey-fy-start").val(this.data.fy_start_date);
|
||||||
$body.find(".jey-fy-end").val(this.data.fy_end_date);
|
$body.find(".jey-fy-end").val(this.data.fy_end_date);
|
||||||
$body.find(".jey-valuation-method").val(this.data.valuation_method || "FIFO");
|
$body.find(".jey-valuation-method").val(this.data.valuation_method || "FIFO");
|
||||||
|
$body.find(".jey-accounting-method").val(this.data.accounting_method || "Hesablama metodu");
|
||||||
|
|
||||||
// If user has never touched the abbr field, keep it in sync with the name.
|
// If user has never touched the abbr field, keep it in sync with the name.
|
||||||
// Once they edit it manually we stop auto-suggesting so their choice sticks.
|
// Once they edit it manually we stop auto-suggesting so their choice sticks.
|
||||||
|
|
@ -566,6 +577,7 @@ frappe.setup.SetupWizard = class JeySetupWizard {
|
||||||
: ""}
|
: ""}
|
||||||
<li><b>${__("Fiscal Year")}:</b> ${frappe.utils.escape_html(this.data.fy_start_date)} — ${frappe.utils.escape_html(this.data.fy_end_date)}</li>
|
<li><b>${__("Fiscal Year")}:</b> ${frappe.utils.escape_html(this.data.fy_start_date)} — ${frappe.utils.escape_html(this.data.fy_end_date)}</li>
|
||||||
<li><b>${__("Valuation method")}:</b> ${this.data.valuation_method === "Moving Average" ? __("Moving Average") : "FIFO"}</li>
|
<li><b>${__("Valuation method")}:</b> ${this.data.valuation_method === "Moving Average" ? __("Moving Average") : "FIFO"}</li>
|
||||||
|
<li><b>${__("Accounting method")}:</b> ${frappe.utils.escape_html(this.data.accounting_method || "Hesablama metodu")}</li>
|
||||||
<li><b>${__("Admin user")}:</b> ${frappe.utils.escape_html(this.data.user_full_name)} <span style="color:#888">(${frappe.utils.escape_html(this.data.user_email)})</span></li>
|
<li><b>${__("Admin user")}:</b> ${frappe.utils.escape_html(this.data.user_full_name)} <span style="color:#888">(${frappe.utils.escape_html(this.data.user_email)})</span></li>
|
||||||
<li><b>${__("ƏMAS employees")}:</b> ${empRow}</li>
|
<li><b>${__("ƏMAS employees")}:</b> ${empRow}</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -656,6 +668,8 @@ frappe.setup.SetupWizard = class JeySetupWizard {
|
||||||
this.data.fy_end_date = fyEnd;
|
this.data.fy_end_date = fyEnd;
|
||||||
const vm = (this.$wrap.find(".jey-valuation-method").val() || "FIFO").trim();
|
const vm = (this.$wrap.find(".jey-valuation-method").val() || "FIFO").trim();
|
||||||
this.data.valuation_method = vm === "Moving Average" ? "Moving Average" : "FIFO";
|
this.data.valuation_method = vm === "Moving Average" ? "Moving Average" : "FIFO";
|
||||||
|
const am = (this.$wrap.find(".jey-accounting-method").val() || "").trim();
|
||||||
|
this.data.accounting_method = (am === "Kassa metodu") ? "Kassa metodu" : "Hesablama metodu";
|
||||||
} else if (step === "user") {
|
} else if (step === "user") {
|
||||||
const fullName = (this.$wrap.find(".jey-user-name").val() || "").trim();
|
const fullName = (this.$wrap.find(".jey-user-name").val() || "").trim();
|
||||||
const email = (this.$wrap.find(".jey-user-email").val() || "").trim().toLowerCase();
|
const email = (this.$wrap.find(".jey-user-email").val() || "").trim().toLowerCase();
|
||||||
|
|
@ -1269,6 +1283,7 @@ frappe.setup.SetupWizard = class JeySetupWizard {
|
||||||
fy_start_date: this.data.fy_start_date,
|
fy_start_date: this.data.fy_start_date,
|
||||||
fy_end_date: this.data.fy_end_date,
|
fy_end_date: this.data.fy_end_date,
|
||||||
valuation_method: this.data.valuation_method || "FIFO",
|
valuation_method: this.data.valuation_method || "FIFO",
|
||||||
|
accounting_method: this.data.accounting_method || "Hesablama metodu",
|
||||||
setup_demo: 0,
|
setup_demo: 0,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue