feat: restore slip id, dates and tax-free indicators per month in payroll register
Bring back salary_slip_id, start_date, end_date and the four tax-free Göstərici Link fields that were dropped in the numeric-only pass, each split into per-month columns so the formula editor can pick a specific month's value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ec95dda8c2
commit
46977b3427
|
|
@ -28,11 +28,19 @@ DEDUCTION_TYPES = [
|
|||
"Gəlir vergisi",
|
||||
]
|
||||
|
||||
TAX_FREE_AMOUNT_FIELDS = [
|
||||
("custom_vergi_amount", "Vergi tutulmayan gəlir"),
|
||||
("custom_mdss_amount", "MDSS cəlb olunmayan gəlir"),
|
||||
("custom_unemployment_insurance_amount", "İşsizlik sığortasına cəlb olunmayan gəlir"),
|
||||
("custom_medical_insurance_amount", "İcbari tibbi sığortaya cəlb olunmayan gəlir"),
|
||||
TAX_FREE_FIELDS = [
|
||||
("custom_vergi_indicator", "custom_vergi_amount", "Vergi tutulmayan gəlir"),
|
||||
("custom_mdss_indicator", "custom_mdss_amount", "MDSS cəlb olunmayan gəlir"),
|
||||
(
|
||||
"custom_unemployment_insurance_indicator",
|
||||
"custom_unemployment_insurance_amount",
|
||||
"İşsizlik sığortasına cəlb olunmayan gəlir",
|
||||
),
|
||||
(
|
||||
"custom_medical_insurance_indicator",
|
||||
"custom_medical_insurance_amount",
|
||||
"İcbari tibbi sığortaya cəlb olunmayan gəlir",
|
||||
),
|
||||
]
|
||||
|
||||
MONTHS = (1, 2, 3)
|
||||
|
|
@ -83,6 +91,10 @@ def execute(filters=None):
|
|||
continue
|
||||
prefix = f"ay_{month_index}_"
|
||||
|
||||
row[prefix + "salary_slip_id"] = ss.name
|
||||
row[prefix + "start_date"] = ss.start_date
|
||||
row[prefix + "end_date"] = ss.end_date
|
||||
|
||||
for field in ("leave_without_pay", "absent_days", "payment_days"):
|
||||
row[prefix + field] += flt(ss.get(field))
|
||||
|
||||
|
|
@ -102,7 +114,8 @@ def execute(filters=None):
|
|||
row[prefix + "total_deduction"] += flt(ss.total_deduction)
|
||||
row[prefix + "net_pay"] += flt(ss.net_pay)
|
||||
|
||||
for amount_field, _label in TAX_FREE_AMOUNT_FIELDS:
|
||||
for indicator_field, amount_field, _label in TAX_FREE_FIELDS:
|
||||
row[prefix + indicator_field] = ss.get(indicator_field)
|
||||
amount = flt(ss.get(amount_field))
|
||||
if currency == company_currency:
|
||||
amount *= flt(ss.exchange_rate)
|
||||
|
|
@ -124,6 +137,9 @@ def build_empty_row(ss, doj_map, currency, company_currency):
|
|||
}
|
||||
for i in MONTHS:
|
||||
prefix = f"ay_{i}_"
|
||||
row[prefix + "salary_slip_id"] = None
|
||||
row[prefix + "start_date"] = None
|
||||
row[prefix + "end_date"] = None
|
||||
row[prefix + "leave_without_pay"] = 0.0
|
||||
row[prefix + "absent_days"] = 0.0
|
||||
row[prefix + "payment_days"] = 0.0
|
||||
|
|
@ -134,7 +150,8 @@ def build_empty_row(ss, doj_map, currency, company_currency):
|
|||
row[prefix + frappe.scrub(e)] = 0.0
|
||||
for d in DEDUCTION_TYPES:
|
||||
row[prefix + frappe.scrub(d)] = 0.0
|
||||
for amount_field, _lbl in TAX_FREE_AMOUNT_FIELDS:
|
||||
for indicator_field, amount_field, _lbl in TAX_FREE_FIELDS:
|
||||
row[prefix + indicator_field] = None
|
||||
row[prefix + amount_field] = 0.0
|
||||
return row
|
||||
|
||||
|
|
@ -202,6 +219,25 @@ def get_columns():
|
|||
suffix = f" ({i}ci ay)"
|
||||
columns.extend(
|
||||
[
|
||||
{
|
||||
"label": _("Salary Slip ID") + suffix,
|
||||
"fieldname": prefix + "salary_slip_id",
|
||||
"fieldtype": "Link",
|
||||
"options": "Salary Slip",
|
||||
"width": 150,
|
||||
},
|
||||
{
|
||||
"label": _("Start Date") + suffix,
|
||||
"fieldname": prefix + "start_date",
|
||||
"fieldtype": "Date",
|
||||
"width": 100,
|
||||
},
|
||||
{
|
||||
"label": _("End Date") + suffix,
|
||||
"fieldname": prefix + "end_date",
|
||||
"fieldtype": "Date",
|
||||
"width": 100,
|
||||
},
|
||||
{
|
||||
"label": _("Leave Without Pay") + suffix,
|
||||
"fieldname": prefix + "leave_without_pay",
|
||||
|
|
@ -269,7 +305,16 @@ def get_columns():
|
|||
},
|
||||
]
|
||||
)
|
||||
for amount_field, label in TAX_FREE_AMOUNT_FIELDS:
|
||||
for indicator_field, amount_field, label in TAX_FREE_FIELDS:
|
||||
columns.append(
|
||||
{
|
||||
"label": _(label) + " - Göstərici" + suffix,
|
||||
"fieldname": prefix + indicator_field,
|
||||
"fieldtype": "Link",
|
||||
"options": "Tax Free Indicator",
|
||||
"width": 200,
|
||||
}
|
||||
)
|
||||
columns.append(
|
||||
{
|
||||
"label": _(label) + suffix,
|
||||
|
|
|
|||
Loading…
Reference in New Issue