fix: inventory dimension for inter company transfer return use case

(cherry picked from commit 38aaba5720)
This commit is contained in:
Rohit Waghchaure
2023-05-13 13:00:05 +05:30
committed by Mergify
parent c30dda3328
commit 6d121b8107
3 changed files with 190 additions and 2 deletions

View File

@@ -392,6 +392,9 @@ class AccountsController(TransactionBase):
)
def validate_inter_company_reference(self):
if self.get("is_return"):
return
if self.doctype not in ("Purchase Invoice", "Purchase Receipt"):
return

View File

@@ -449,8 +449,22 @@ class StockController(AccountsController):
"Delivery Note",
"Stock Entry",
]:
if (sl_dict.actual_qty > 0 and self.doctype in ["Purchase Invoice", "Purchase Receipt"]) or (
sl_dict.actual_qty < 0 and self.doctype in ["Sales Invoice", "Delivery Note", "Stock Entry"]
if (
(
sl_dict.actual_qty > 0
and not self.get("is_return")
or sl_dict.actual_qty < 0
and self.get("is_return")
)
and self.doctype in ["Purchase Invoice", "Purchase Receipt"]
) or (
(
sl_dict.actual_qty < 0
and not self.get("is_return")
or sl_dict.actual_qty > 0
and self.get("is_return")
)
and self.doctype in ["Sales Invoice", "Delivery Note", "Stock Entry"]
):
sl_dict[dimension.target_fieldname] = row.get(dimension.source_fieldname)
else: