Skip to content

Commit

Permalink
Merge pull request #15 from coopiteasy/12.0-show-receipt-sent-field-o…
Browse files Browse the repository at this point in the history
…n-pos-order

12.0 show receipt sent field on pos order
  • Loading branch information
vvrossem authored Jul 22, 2021
2 parents 84e900d + f1d5a8d commit 07cdd96
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pos_print_receipt_backend/models/pos_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class PosOrder(models.Model):
_inherit = "pos.order"

receipt_sent = fields.Boolean(
string="Receipt sent by backend interface",
readonly=True,
default=False,
copy=False,
Expand Down Expand Up @@ -61,3 +62,15 @@ def action_receipt_sent(self):
"target": "new",
"context": ctx,
}

@api.model
def send_mail_receipt(self, pos_reference, email, body_from_ui, force=True):
order = self.search([("pos_reference", "=", pos_reference)])

order.note = "{}\n{} UTC Attempting to send mail receipt ".format(
order.note or "", fields.datetime.now()
)

return super(PosOrder, self).send_mail_receipt(
pos_reference, email, body_from_ui, force=True
)
3 changes: 3 additions & 0 deletions pos_print_receipt_backend/views/pos_order_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<xpath expr="//button[@name='%(point_of_sale.action_pos_payment)d']" position="after">
<button name="action_receipt_sent" string="Send &amp; Print Receipt" type="object" attrs="{'invisible': [('state', '=', 'draft')]}" class="oe_highlight" groups="point_of_sale.group_pos_user"/>
</xpath>
<field name="fiscal_position_id" position="after">
<field name="receipt_sent" />
</field>
</field>
</record>
</odoo>

0 comments on commit 07cdd96

Please sign in to comment.