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: Use fallback conversion factor while setting incoming rate for petty purchase #31529

Merged
merged 1 commit into from
Jul 5, 2022

Conversation

marination
Copy link
Collaborator

  • Purchase Invoices for petty items (that do not need an Item record) are allowed using Item Name field
  • If a different UOM (different from stock UOM) is used in this case, conversion factor stays 0 and causes an error
 File "apps/erpnext/erpnext/controllers/buying_controller.py", line 33, in validate
    super(BuyingController, self).validate()
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 38, in validate
    super(StockController, self).validate()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 155, in validate
    self.set_incoming_rate()
  File "apps/erpnext/erpnext/controllers/buying_controller.py", line 302, in set_incoming_rate
    rate = flt(outgoing_rate * d.conversion_factor, d.precision("rate"))
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'

Fix:

  • Fallback to 1 as conversion factor in set_incoming_rate for buying
  • Selling will need a proper item, so this change is not needed there

…etty purchase

- PIs for petty items (that do not need an Item record) are allowed using Item Name field
- If a different UOM is used in this case, conversion factor stays 0 and causes an error
- Fallback to 1 in `set_incoming_rate` for buying
- Selling will need a proper item, so this change is not needed there
@codecov
Copy link

codecov bot commented Jul 5, 2022

Codecov Report

Merging #31529 (aa043fe) into develop (37f7801) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop   #31529      +/-   ##
===========================================
+ Coverage    64.33%   64.40%   +0.06%     
===========================================
  Files          965      965              
  Lines        65156    65156              
===========================================
+ Hits         41918    41963      +45     
+ Misses       23238    23193      -45     
Impacted Files Coverage Δ
erpnext/controllers/buying_controller.py 87.85% <100.00%> (ø)
...value/warehouse_wise_item_balance_age_and_value.py 89.02% <0.00%> (-2.44%) ⬇️
erpnext/stock/doctype/item_price/item_price.py 92.98% <0.00%> (-1.76%) ⬇️
erpnext/portal/utils.py 27.69% <0.00%> (-1.54%) ⬇️
erpnext/crm/doctype/prospect/prospect.py 49.25% <0.00%> (-1.50%) ⬇️
erpnext/stock/report/stock_ageing/stock_ageing.py 94.71% <0.00%> (-0.97%) ⬇️
erpnext/support/doctype/issue/issue.py 64.28% <0.00%> (-0.96%) ⬇️
erpnext/crm/doctype/lead/lead.py 70.51% <0.00%> (-0.86%) ⬇️
erpnext/controllers/sales_and_purchase_return.py 91.41% <0.00%> (-0.75%) ⬇️
...t/accounts/report/general_ledger/general_ledger.py 67.57% <0.00%> (-0.35%) ⬇️
... and 18 more

@marination marination merged commit 9b6bb1b into frappe:develop Jul 5, 2022
marination added a commit that referenced this pull request Jul 5, 2022
…-31529

fix: Use fallback conversion factor while setting incoming rate for petty purchase (backport #31529)
@deepeshgarg007
Copy link
Member

@Mergifyio backport version-13

@mergify
Copy link
Contributor

mergify bot commented Jul 8, 2022

backport version-13

✅ Backports have been created

deepeshgarg007 added a commit that referenced this pull request Jul 8, 2022
fix: Use fallback conversion factor while setting incoming rate for petty purchase (backport #31529)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants