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: invoice return #743

Merged
merged 9 commits into from Nov 18, 2023
Merged

feat: invoice return #743

merged 9 commits into from Nov 18, 2023

Conversation

akshayitzme
Copy link
Contributor

@akshayitzme akshayitzme commented Sep 23, 2023

This PR adds the functionality for Sales and Purchase Return.

Invoice Return

Workflow

follows ERPNext's workflow

# Qty SINV Outstanding Return Inv Outstanding Paid Amt (Pay) Paid Amt (Receive)
Scenario 1: (F Payment, F Return, F Payment)
Invoice created 2 20 0 0 0
Payment created 2 0 0 0 20
Return issued (Full) 2 0 -20 0 0
Payment created against Return 2 0 0 20 0
Scenario 2: (F Payment, P Return, P Payment)
Invoice created 2 20 0 0 0
Payment created 2 0 0 0 20
Return Issued (Partial) 1 0 -10 0 0
Payment created against Return 1 0 0 10 0
Scenario 3: (N Payment, F Return)
Invoice created 2 20 0 0 0
Return Issued (Full) 2 20 -20 0 0

(F payment: Full Payment, P Payment: Partial Payment, N Payment: No Payment)

@akshayitzme akshayitzme mentioned this pull request Sep 23, 2023
8 tasks
@akshayitzme akshayitzme marked this pull request as ready for review October 11, 2023 06:41
@chaoxu
Copy link

chaoxu commented Nov 7, 2023

Is there a timeline on when this can be merged?
This is an essential requirement that is holding me back from adopting frappe book.

@akshayitzme
Copy link
Contributor Author

Did a self review, LGTM

@akshayitzme akshayitzme merged commit f5304b1 into frappe:master Nov 18, 2023
4 checks passed
@mildred
Copy link
Contributor

mildred commented Dec 1, 2023

@akshayitzme When using your code on an existing database, I get an error:

SqliteError alter table Payment add column referenceType text not null - Cannot add a NOT NULL column with default value ...

@akshayitzme
Copy link
Contributor Author

@akshayitzme When using your code on an existing database, I get an error:

SqliteError alter table Payment add column referenceType text not null - Cannot add a NOT NULL column with default value ...

Hi, Thanks for pointing this out. I haven't tried reproducing it yet.. will do it in the coming days and push fixes if needed.

@akshayitzme
Copy link
Contributor Author

@akshayitzme When using your code on an existing database, I get an error:

SqliteError alter table Payment add column referenceType text not null - Cannot add a NOT NULL column with default value ...

fixed in #782

Comment on lines +160 to +175
"fieldname": "referenceType",
"label": "Type",
"placeholder": "Type",
"fieldtype": "Select",
"options": [
{
"value": "SalesInvoice",
"label": "Sales"
},
{
"value": "PurchaseInvoice",
"label": "Purchase"
}
],
"hidden": true,
"required": true
Copy link
Member

Choose a reason for hiding this comment

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

@akshayitzme setting "required": true for this field breaks migrations.

Ideally this field should not be present because a similar field is present on the PaymentFor child table. You should have used that with a single row instead of introducing a new field.

Copy link
Member

@18alantom 18alantom Dec 4, 2023

Choose a reason for hiding this comment

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

I suppose 74a81de fixes it, nevertheless it's a redundant field.

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.

None yet

4 participants