mirror of
https://github.com/frappe/books.git
synced 2025-02-02 12:08:27 +00:00
fix: Verify if a shipment is being returned during the return process.
This commit is contained in:
parent
70e69e623d
commit
ad07746245
@ -49,6 +49,7 @@ import { AppliedCouponCodes } from '../AppliedCouponCodes/AppliedCouponCodes';
|
|||||||
import { CouponCode } from '../CouponCode/CouponCode';
|
import { CouponCode } from '../CouponCode/CouponCode';
|
||||||
import { SalesInvoice } from '../SalesInvoice/SalesInvoice';
|
import { SalesInvoice } from '../SalesInvoice/SalesInvoice';
|
||||||
import { SalesInvoiceItem } from '../SalesInvoiceItem/SalesInvoiceItem';
|
import { SalesInvoiceItem } from '../SalesInvoiceItem/SalesInvoiceItem';
|
||||||
|
import { getLinkedEntries } from 'src/utils/doc';
|
||||||
import { PricingRuleItem } from '../PricingRuleItem/PricingRuleItem';
|
import { PricingRuleItem } from '../PricingRuleItem/PricingRuleItem';
|
||||||
|
|
||||||
export type TaxDetail = {
|
export type TaxDetail = {
|
||||||
@ -979,6 +980,17 @@ export abstract class Invoice extends Transactional {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let linkedEntries;
|
||||||
|
|
||||||
|
if (this.returnAgainst) {
|
||||||
|
const someDOC = (await this.fyo.doc.getDoc(
|
||||||
|
ModelNameEnum.SalesInvoice,
|
||||||
|
this.returnAgainst
|
||||||
|
)) as SalesInvoice;
|
||||||
|
|
||||||
|
linkedEntries = await getLinkedEntries(someDOC);
|
||||||
|
}
|
||||||
|
|
||||||
const schemaName = this.stockTransferSchemaName;
|
const schemaName = this.stockTransferSchemaName;
|
||||||
|
|
||||||
const defaults = (this.fyo.singles.Defaults as Defaults) ?? {};
|
const defaults = (this.fyo.singles.Defaults as Defaults) ?? {};
|
||||||
@ -998,6 +1010,7 @@ export abstract class Invoice extends Transactional {
|
|||||||
terms,
|
terms,
|
||||||
numberSeries,
|
numberSeries,
|
||||||
backReference: this.name,
|
backReference: this.name,
|
||||||
|
returnAgainst: linkedEntries ? linkedEntries.Shipment![0] : '',
|
||||||
};
|
};
|
||||||
|
|
||||||
let location = this.autoStockTransferLocation;
|
let location = this.autoStockTransferLocation;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user