Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: corrective job card creation #31083

Merged
merged 2 commits into from
May 21, 2022
Merged

Conversation

ankush
Copy link
Member

@ankush ankush commented May 21, 2022

On v13 child tables aren't auto-initialized with new_doc so corrective job card creation fails.

  • Initialized manually and added test for corrective job costing.
  • Also cleaned up JC tests.
Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 55, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 37, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 75, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1447, in call
    return fn(*args, **newargs)
  File "apps/erpnext/erpnext/manufacturing/doctype/job_card/job_card.py", line 885, in make_corrective_job_card
    set_missing_values,
  File "apps/frappe/frappe/model/mapper.py", line 149, in get_mapped_doc
    postprocess(source_doc, target_doc)
  File "apps/erpnext/erpnext/manufacturing/doctype/job_card/job_card.py", line 869, in set_missing_values
    target.set_sub_operations()
  File "apps/erpnext/erpnext/manufacturing/doctype/job_card/job_card.py", line 63, in set_sub_operations
    if not self.sub_operations and self.operation:
AttributeError: 'JobCard' object has no attribute 'sub_operations'

ankush added 2 commits May 21, 2022 14:01
This used to fail because sub_operations is a child table that's not
initalized by default till v13, in develop branch we init tables with
empty list.
@ankush
Copy link
Member Author

ankush commented May 21, 2022

@Mergifyio copy version-13-hotfix

@mergify
Copy link
Contributor

mergify bot commented May 21, 2022

copy version-13-hotfix

✅ Pull request copies have been created

@codecov
Copy link

codecov bot commented May 21, 2022

Codecov Report

Merging #31083 (66cf9aa) into develop (dac678e) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop   #31083      +/-   ##
===========================================
+ Coverage    63.04%   63.09%   +0.05%     
===========================================
  Files          986      986              
  Lines        67342    67343       +1     
===========================================
+ Hits         42453    42490      +37     
+ Misses       24889    24853      -36     
Impacted Files Coverage Δ
erpnext/manufacturing/doctype/job_card/job_card.py 70.12% <100.00%> (+5.14%) ⬆️
.../report/delayed_item_report/delayed_item_report.py 60.78% <0.00%> (-35.30%) ⬇️
erpnext/accounts/doctype/bank/bank.py 71.42% <0.00%> (-14.29%) ⬇️
...urity_shortfall/process_loan_security_shortfall.py 93.75% <0.00%> (-6.25%) ⬇️
erpnext/stock/reorder_item.py 74.35% <0.00%> (-2.57%) ⬇️
...value/warehouse_wise_item_balance_age_and_value.py 89.02% <0.00%> (-2.44%) ⬇️
...eorder_level/itemwise_recommended_reorder_level.py 90.74% <0.00%> (-1.86%) ⬇️
erpnext/projects/doctype/project/project.py 52.27% <0.00%> (-0.98%) ⬇️
erpnext/stock/doctype/batch/batch.py 82.80% <0.00%> (-0.64%) ⬇️
...cial_statement/consolidated_financial_statement.py 89.71% <0.00%> (-0.63%) ⬇️
... and 19 more

@ankush ankush marked this pull request as ready for review May 21, 2022 08:57
@ankush ankush merged commit 3019f93 into frappe:develop May 21, 2022
ankush added a commit that referenced this pull request May 21, 2022
* test: simplify job card tests

(cherry picked from commit e625394)

* fix: creation of corrective job card fails

This used to fail because sub_operations is a child table that's not
initalized by default till v13, in develop branch we init tables with
empty list.

(cherry picked from commit 66cf9aa)

Co-authored-by: Ankush Menat <ankush@frappe.io>
@ankush ankush deleted the jc_corrective_creation branch May 21, 2022 09:05
frappe-pr-bot pushed a commit that referenced this pull request May 26, 2022
# [13.31.0](v13.30.0...v13.31.0) (2022-05-26)

### Bug Fixes

* Account currency validation for first transaction ([228f10b](228f10b))
* Add party account validation for journal entry ([7f853b1](7f853b1))
* always update item_name for stock entry (backport [#31068](#31068)) ([#31071](#31071)) ([f519dc6](f519dc6))
* change project's actual_start_date fieldtype from Data to Date (backport [#31085](#31085)) ([#31135](#31135)) ([8c2f203](8c2f203))
* Chart data for monthly periodicity in Cash Flow report ([#31039](#31039)) ([f14e9b7](f14e9b7))
* corrective job card creation (backport [#31083](#31083)) ([#31084](#31084)) ([c17c260](c17c260))
* don't capture payments with invoice_id as donations ([168a9d4](168a9d4))
* employee advance status update on return via additional salary ([d59c3d2](d59c3d2))
* Handle missing HSN Codes ([ce3a21e](ce3a21e))
* Healthcare module accounting test cases ([09a42a1](09a42a1))
* **India:** Async issue in company address trigger ([2ea3318](2ea3318))
* **india:** error while parsing e-invoice ([#31061](#31061)) ([1461d66](1461d66))
* **india:** eway bill cancel api is disabled ([#31060](#31060)) ([95491e1](95491e1))
* Job Card excess transfer behaviour (backport [#31054](#31054)) ([#31096](#31096)) ([3984f04](3984f04))
* Leave Encashment calculations (backport [#31062](#31062)) ([#31091](#31091)) ([ba76b64](ba76b64))
* Loan Doc query in Bank Reconciliation Statement ([611d1af](611d1af))
* Loan repayment entries for payroll payable account ([ea6d754](ea6d754))
* multiple entries for same payment term ([90b1147](90b1147))
* Party account validation in JV ([d10c2e5](d10c2e5))
* payments duplicate on pos closing entry (backport [#30976](#30976)) ([#31005](#31005)) ([0efbabe](0efbabe))
* **pos:** paid amount calculation for multicurrency invoice ([#31122](#31122)) ([98eb7da](98eb7da))
* remove bad default for Membership From Date ([34928d2](34928d2))
* Remove validation from Journal Entry ([4ca6cdc](4ca6cdc))
* replace document states with list settings ([78e9e66](78e9e66))
* timesheet fetching in sales invoice ([216c32f](216c32f))
* Use directly <a> and style it as button instead of using button ([0ab9fc0](0ab9fc0))

### Features

* **Employee Advance:** add 'Returned' and 'Partly Claimed and Returned' status ([42e7a86](42e7a86))

### Reverts

* Revert "fix: Add party account validation for journal entry" ([9d43a90](9d43a90))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant