18 lines
622 B
Python
18 lines
622 B
Python
from odoo import api, fields, models
|
|
|
|
|
|
class PosOrder(models.Model):
|
|
_inherit = "pos.order"
|
|
|
|
to_invoice = fields.Boolean(default=True)
|
|
|
|
@api.model
|
|
def _process_order(self, order, existing_order):
|
|
# Force to_invoice=True if not explicitly set to False by cashier
|
|
if order and "data" in order:
|
|
data = order["data"]
|
|
# Cashier explicit opt-out preserved (data sent False from frontend)
|
|
# Otherwise default to True
|
|
if "to_invoice" not in data:
|
|
data["to_invoice"] = True
|
|
return super()._process_order(order, existing_order)
|