feat: add getter and setter for _code_activated_coupon_ids to PosOrder model
This commit is contained in:
parent
bd09459c63
commit
d308497945
@ -52,6 +52,22 @@ patch(PosOrderline.prototype, {
|
|||||||
// ─── PosOrder patches ─────────────────────────────────────────────────────────
|
// ─── PosOrder patches ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
patch(PosOrder.prototype, {
|
patch(PosOrder.prototype, {
|
||||||
|
get _code_activated_coupon_ids() {
|
||||||
|
const ids = this.raw._code_activated_coupon_ids || [];
|
||||||
|
const result = [];
|
||||||
|
for (const id of ids) {
|
||||||
|
const coupon = this.models["loyalty.card"].get(id);
|
||||||
|
if (coupon && coupon.program_id) {
|
||||||
|
result.push(coupon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
set _code_activated_coupon_ids(values) {
|
||||||
|
this.update({ _code_activated_coupon_ids: values });
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getLoyaltyPoints reads coupon_id.id — guard undefined coupon_id.
|
* getLoyaltyPoints reads coupon_id.id — guard undefined coupon_id.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user