Tower: upload laundry_management 19.0.19.0.4 (via marketplace)
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/** @odoo-module
|
||||
*
|
||||
* LaundryWorkOrderThermal — receipt-style component for the POS printer.
|
||||
*
|
||||
* Rendered by `pos.printer.print(LaundryWorkOrderThermal, {data}, {webPrintFallback: true})`.
|
||||
* The data payload comes from `laundry.order.pos_get_thermal_data` —
|
||||
* a self-contained dict so this component never reads from the POS env.
|
||||
*
|
||||
* Styling lives in laundry_pos.scss under `.laundry-thermal`. The
|
||||
* `webPrintFallback` option means this component also works when no
|
||||
* hardware printer is configured: POS opens a print preview in a new
|
||||
* tab using the same DOM.
|
||||
*/
|
||||
import { Component } from "@odoo/owl";
|
||||
|
||||
export class LaundryWorkOrderThermal extends Component {
|
||||
static template = "laundry_management.LaundryWorkOrderThermal";
|
||||
static props = {
|
||||
data: { type: Object },
|
||||
};
|
||||
|
||||
fmt(amount) {
|
||||
return parseFloat(amount || 0).toFixed(2);
|
||||
}
|
||||
|
||||
fmtDate(s) {
|
||||
if (!s) return "";
|
||||
try {
|
||||
const d = new Date(s.replace(" ", "T") + "Z");
|
||||
if (!isNaN(d.getTime())) return d.toLocaleString();
|
||||
} catch (_e) { /* fall through */ }
|
||||
return s;
|
||||
}
|
||||
|
||||
get currency() {
|
||||
const sym = this.props.data?.currency_symbol || "";
|
||||
const pos = this.props.data?.currency_position || "after";
|
||||
return { sym, pos };
|
||||
}
|
||||
|
||||
money(amount) {
|
||||
const v = this.fmt(amount);
|
||||
const { sym, pos } = this.currency;
|
||||
if (!sym) return v;
|
||||
return pos === "before" ? `${sym} ${v}` : `${v} ${sym}`;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user