addons/pos_restaurant_loyalty/static/src/overrides/models/pos_order.js
raw| 1 | import { PosOrder } from "@point_of_sale/app/models/pos_order"; |
| 2 | import { patch } from "@web/core/utils/patch"; |
| 3 | |
| 4 | patch(PosOrder.prototype, { |
| 5 | _getRewardLineValues(args) { |
| 6 | const lineValues = super._getRewardLineValues(args); |
| 7 | // Assign last course to reward lines |
| 8 | if (this.hasCourses()) { |
| 9 | const course = this.getLastCourse(); |
| 10 | lineValues.forEach((line) => { |
| 11 | line.course_id = course; |
| 12 | }); |
| 13 | } |
| 14 | return lineValues; |
| 15 | }, |
| 16 | }); |