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

feat: set Purchase Receipt status based on qty instead of amount #597

Merged
merged 5 commits into from
Sep 28, 2020

Conversation

Alchez
Copy link

@Alchez Alchez commented Sep 24, 2020

Changes:

  • On submit of a Purchase Invoice, the billing status of any linked Purchase Receipts will be based on the received item quantity, rather than the amount.
  • Change overbilling message trigger for quantity instead of amount
  • Add a toggle in Buying Settings to check over-billing against quantity or amount (default: Amount)
  • Write patch to set the new billed_qty for each Purchase Receipt Item

Considerations:

  • Should the patch check overbilling by Amount (default) or Quantity?
  • JHA?

@coveralls
Copy link

coveralls commented Sep 24, 2020

Pull Request Test Coverage Report for Build 2280

  • 64 of 69 (92.75%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py 19 20 95.0%
erpnext/controllers/accounts_controller.py 16 20 80.0%
Totals Coverage Status
Change from base Build 2279: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

@Alchez Alchez marked this pull request as ready for review September 24, 2020 12:17
@Alchez Alchez force-pushed the feat-purchase-receipt-bill-status branch from a469e2d to 55e80de Compare September 24, 2020 12:18
erpnext/stock/doctype/purchase_receipt/purchase_receipt.py Outdated Show resolved Hide resolved
Comment on lines +558 to +575
pr_details = frappe.db.sql("""
SELECT
pr_item.name,
pr_item.qty,
pr_item.parent
FROM
`tabPurchase Receipt Item` pr_item,
`tabPurchase Receipt` pr
WHERE
pr.name = pr_item.parent
AND pr_item.purchase_order_item = %s
AND pr.docstatus = 1
AND pr.is_return = 0
ORDER BY
pr.posting_date asc,
pr.posting_time asc,
pr.name asc
""", po_detail, as_dict=1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Use ORM

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how I can do joins using the ORM. I tried using the list-filters way, but it didn't give me any results.

erpnext/controllers/accounts_controller.py Outdated Show resolved Hide resolved
@Alchez Alchez requested a review from hrwX September 28, 2020 06:36
@Alchez Alchez merged commit 14520e7 into Bloomstack:staging Sep 28, 2020
@Alchez Alchez deleted the feat-purchase-receipt-bill-status branch September 28, 2020 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants