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
fix: Accounting for internal transfer invoices within same company #24021
Conversation
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 | ||
|
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add description
Expected GL Entries for stock transfers:
Sales:
Purchase:
Default Inter - company account can be set for company incase no inter company account is selected in Company:
Inter - company account in transaction:
Sales Transaction GL Entries:
Purchase GL Entries: