mirror of
https://github.com/frappe/books.git
synced 2026-08-24 10:04:45 -05:00
fix: add loyaltypoint in salesinvoice
This commit is contained in:
@@ -94,6 +94,7 @@ export abstract class Invoice extends Transactional {
|
||||
discountAmount?: Money;
|
||||
discountPercent?: number;
|
||||
loyaltyPoints?: number;
|
||||
availableLoyaltyPoints?: number;
|
||||
discountAfterTax?: boolean;
|
||||
stockNotTransferred?: number;
|
||||
loyaltyProgram?: string;
|
||||
@@ -992,6 +993,21 @@ export abstract class Invoice extends Transactional {
|
||||
},
|
||||
dependsOn: ['party', 'name'],
|
||||
},
|
||||
availableLoyaltyPoints: {
|
||||
formula: async () => {
|
||||
if (!this.party) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const partyDoc = (await this.fyo.doc.getDoc(
|
||||
ModelNameEnum.Party,
|
||||
this.party
|
||||
)) as Party;
|
||||
|
||||
return partyDoc?.loyaltyPoints || 0;
|
||||
},
|
||||
dependsOn: ['party'],
|
||||
},
|
||||
currency: {
|
||||
formula: async () => {
|
||||
const currency = (await this.fyo.getValue(
|
||||
@@ -1181,6 +1197,7 @@ export abstract class Invoice extends Transactional {
|
||||
backReference: () => !this.backReference,
|
||||
quote: () => !this.quote,
|
||||
loyaltyProgram: () => !this.loyaltyProgram,
|
||||
availableLoyaltyPoints: () => !this.loyaltyProgram || this.isReturn,
|
||||
loyaltyPoints: () => !this.redeemLoyaltyPoints || this.isReturn,
|
||||
redeemLoyaltyPoints: () => !this.loyaltyProgram || this.isReturn,
|
||||
coupons: () => this.isSubmitted && !this.coupons?.length,
|
||||
|
||||
@@ -49,7 +49,8 @@
|
||||
"label": "Sync Data From Server",
|
||||
"fieldname": "syncDataFromServer",
|
||||
"fieldtype": "Button",
|
||||
"section": "Default"
|
||||
"section": "Default",
|
||||
"bold": true
|
||||
},
|
||||
{
|
||||
"label": "Register Instance",
|
||||
|
||||
@@ -85,6 +85,13 @@
|
||||
"section": "References",
|
||||
"readOnly": true
|
||||
},
|
||||
{
|
||||
"fieldname": "availableLoyaltyPoints",
|
||||
"fieldtype": "Int",
|
||||
"label": "Available Loyalty Points",
|
||||
"readOnly": true,
|
||||
"section": "References"
|
||||
},
|
||||
{
|
||||
"fieldname": "redeemLoyaltyPoints",
|
||||
"fieldtype": "Check",
|
||||
|
||||
+3
-2
@@ -67,10 +67,11 @@ export interface BaseField {
|
||||
computed?: boolean; // Computed values are not stored in the database.
|
||||
section?: string; // UI Facing config, for grouping by sections
|
||||
tab?: string; // UI Facing config, for grouping by tabs
|
||||
abstract?: string; // Used to mark the location of a field in an Abstract schema
|
||||
abstract?: string; // Used to mark the location of a field in an Abstract schema
|
||||
isCustom?: boolean; // Whether the field is a custom field
|
||||
bold?: boolean; // UI Facing config, whether to make the label bold
|
||||
filters?: Record<string, string>;
|
||||
getOptions?: () => Promise<{ label: string; value: string }[]>;
|
||||
getOptions?: () => Promise<{ label: string; value: string }[]>;
|
||||
}
|
||||
|
||||
export type SelectOption = { value: string; label: string };
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
>
|
||||
<label class="flex items-center justify-between w-full">
|
||||
<div v-if="showLabel && !labelRight" :class="labelClasses">
|
||||
{{ df.label }}
|
||||
<span :class="{ 'font-bold': df.bold }">{{ df.label }}</span>
|
||||
</div>
|
||||
<button
|
||||
:class="['flex items-center justify-center']"
|
||||
|
||||
Reference in New Issue
Block a user