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: purchase receipt creation from SCR #44095

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

rohitwaghchaure
Copy link
Collaborator

@rohitwaghchaure rohitwaghchaure commented Nov 11, 2024

  1. Enable "Auto Create Purchase Receipt" in the Buying Settings
  2. Create the subcontracting PO with TDS and qty as 200 and rate as 10,000
  3. Create and submit the SCO for 200 qty
  4. Create the SCR for 2 qty (partial) and try to submit it
  5. While submitting the SCR, the system will throw the error "Incorrect value:Grand Total (Company Currency) must be >= 0.0"
Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 114, in application
    response = frappe.api.handle(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
           ^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/__init__.py", line 1781, in call
    return fn(*args, **newargs)
           ^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/workflow.py", line 133, in apply_workflow
    doc.submit()
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1048, in submit
    return self._submit()
           ^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1031, in _submit
    return self.save()
           ^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 390, in _save
    self.run_post_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1131, in run_post_save_methods
    self.run_method("on_submit")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py", line 157, in on_submit
    self.auto_create_purchase_receipt()
  File "apps/erpnext/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py", line 676, in auto_create_purchase_receipt
    make_purchase_receipt(self, save=True, notify=True)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py", line 775, in make_purchase_receipt
    target_doc.save()
  File "apps/frappe/frappe/model/document.py", line 337, in save
    return self._save(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 359, in _save
    return self.insert()
           ^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 291, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1091, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 962, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1322, in composer
    return composed(self, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 1304, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/frappe/frappe/model/document.py", line 959, in fn
    return method_object(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "apps/erpnext/erpnext/stock/doctype/purchase_receipt/purchase_receipt.py", line 233, in validate
    super().validate()
  File "apps/erpnext/erpnext/controllers/buying_controller.py", line 32, in validate
    super().validate()
  File "apps/erpnext/erpnext/controllers/subcontracting_controller.py", line 56, in validate
    super().validate()
  File "apps/erpnext/erpnext/controllers/stock_controller.py", line 52, in validate
    super().validate()
  File "apps/erpnext/erpnext/controllers/accounts_controller.py", line 201, in validate
    self.validate_value("base_grand_total", ">=", 0)
  File "apps/frappe/frappe/model/document.py", line 1363, in validate_value
    msgprint(msg, raise_exception=raise_exception or True)
  File "apps/frappe/frappe/__init__.py", line 623, in msgprint
    _raise_exception()
  File "apps/frappe/frappe/__init__.py", line 574, in _raise_exception
    raise exc
frappe.exceptions.ValidationError: Incorrect value:Grand Total (Company Currency) must be >= 0.0

@github-actions github-actions bot added the needs-tests This PR needs automated unit-tests. label Nov 11, 2024
@rohitwaghchaure rohitwaghchaure merged commit 774845f into frappe:develop Nov 12, 2024
19 checks passed
mergify bot pushed a commit that referenced this pull request Nov 12, 2024
ruthra-kumar added a commit that referenced this pull request Nov 12, 2024
…-44095

fix: purchase receipt creation from SCR (backport #44095)
frappe-pr-bot pushed a commit that referenced this pull request Nov 13, 2024
# [15.42.0](v15.41.2...v15.42.0) (2024-11-13)

### Bug Fixes

* add default height to POS item card selector (backport [#44071](#44071)) ([#44075](#44075)) ([65ec7c5](65ec7c5))
* add field conversion_factor when include_uom is settled ([#43701](#43701)) ([f387a8f](f387a8f))
* better gls for purchases with tax witholding ([#42743](#42743)) ([705a26a](705a26a))
* bind this object explicitly on callback event function ([3423d3c](3423d3c))
* calculate percentage received and delivered considering over-receipt and over-delivery (backport [#43870](#43870)) ([#44030](#44030)) ([5958d0c](5958d0c))
* Cannot read properties of undefined (reading 'work_order_closed') (backport [#44117](#44117)) ([#44122](#44122)) ([c1983a4](c1983a4))
* consider service item cost in the RM cost of the BOM (backport [#43962](#43962)) ([#44111](#44111)) ([6e83fec](6e83fec))
* Drop Shipping address based on customer shopping address ([8af005c](8af005c))
* duplicate items and outdated item price in POS (backport [#42978](#42978)) ([#44038](#44038)) ([4cde77d](4cde77d))
* exception on register reports when filtered on cost center ([be07421](be07421))
* improved the conditions for determining voucher subtypes ([58ca4a2](58ca4a2))
* incorrect produced qty in Production Plan Summary (backport [#44112](#44112)) ([#44113](#44113)) ([bce7acf](bce7acf))
* item mapping from modal to batch form ([#44090](#44090)) ([9ac54f6](9ac54f6))
* item not set in the batch quick entry form (backport [#44028](#44028)) ([#44031](#44031)) ([6dcd015](6dcd015))
* Negative stock validation against inventory dimension (backport [#43834](#43834)) ([#43846](#43846)) ([b314f38](b314f38))
* NoneType while updating ordered_qty in SO for removed items ([978a007](978a007))
* not able to cancel DN (backport [#44108](#44108)) ([#44109](#44109)) ([290bdde](290bdde))
* not able to reconcile expired batches ([#44012](#44012)) ([4ba07a4](4ba07a4))
* patch ([107d53b](107d53b))
* populate payment schedule from payment terms (backport [#44082](#44082)) ([#44083](#44083)) ([363f151](363f151))
* purchase receipt creation from SCR ([#44095](#44095)) ([e3d7468](e3d7468))
* slow reposting due to SABB update ([3e29ae8](3e29ae8))
* sort by ascending to get the first period closing voucher (backport [#44029](#44029)) ([#44035](#44035)) ([56f25ae](56f25ae))
* task path (backport [#44073](#44073)) ([#44078](#44078)) ([34b5639](34b5639))
* tyeerror while saving pick list ([7d09832](7d09832))
* update payment amount for partial pos return ([61559be](61559be))
* update per_billed value in Purchase Receipt while creating Debit Note ([#43977](#43977)) ([a833dd6](a833dd6))
* when company is created with other company template Chart of Account  the Create Taxe Template failed ([#42755](#42755)) ([e6894b9](e6894b9))

### Features

* Add item group filtering for search results ([2754793](2754793))
* add template taxe for charts of account France - Plan Comptable General avec code ([#42757](#42757)) ([865786e](865786e))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-15-hotfix needs-tests This PR needs automated unit-tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant