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: Accounting for internal transfer invoices within same company #24021

Merged
merged 10 commits into from Dec 11, 2020

Conversation

deepeshgarg007
Copy link
Member

@deepeshgarg007 deepeshgarg007 commented Nov 27, 2020

Expected GL Entries for stock transfers:

Sales:
Screenshot 2020-11-30 at 6 20 05 PM

Purchase:
Screenshot 2020-11-30 at 6 19 58 PM

Default Inter - company account can be set for company incase no inter company account is selected in Company:
Screenshot 2020-11-30 at 6 51 31 PM

Inter - company account in transaction:
Screenshot 2020-11-30 at 8 50 52 PM

Sales Transaction GL Entries:
Screenshot 2020-11-30 at 8 43 15 PM

Purchase GL Entries:
Screenshot 2020-11-30 at 8 49 02 PM

@nabinhait nabinhait self-assigned this Dec 10, 2020
Comment on lines 574 to 600
def set_inter_company_account(self):
"""
Set intercompany account for inter warehouse transactions
This account will be used in case billing company and internal customer's
representation company is same
"""

if self.is_internal_transfer() and not self.unrealized_profit_loss_account:
unrealized_profit_loss_account = frappe.db.get_value('Company', self.company, 'unrealized_profit_loss_account')

if not unrealized_profit_loss_account:
msg = _("Please select Unrealized Profit / Loss account or add default Unrealized Profit / Loss account account for company {0}").format(
frappe.bold(self.company))
frappe.throw(msg)

self.unrealized_profit_loss_account = unrealized_profit_loss_account

def is_internal_transfer(self):
"""
It will an internal transfer if its an internal customer and representation
company is same as billing company
"""
if self.is_internal_customer and (self.represents_company == self.company):
return True

return False

Copy link
Member

Choose a reason for hiding this comment

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

This is repetitive, the same as PI. Move those functions to accounts_controller.py?

# expense account
# expense account/ target_warehouse / source_warehouse
if item_row.get('target_warehouse'):
warehouse = item_row.get('target_warehouse')
Copy link
Member

Choose a reason for hiding this comment

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

against value in line 97 should also be based on this.

"depends_on": "eval:doc.is_internal_supplier",
"fieldname": "unrealized_profit_loss_account",
"fieldtype": "Link",
"label": "Unrealized Profit / Loss Account",
Copy link
Member

Choose a reason for hiding this comment

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

add description

"fetch_from": "supplier.represents_company",
"fieldname": "represents_company",
"fieldtype": "Link",
"label": "Represents Company",
Copy link
Member

Choose a reason for hiding this comment

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

add description

@nabinhait nabinhait merged commit f17ea2c into frappe:develop Dec 11, 2020
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

2 participants