| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
from odoo import _, fields, models |
| 5 |
|
| 6 |
|
| 7 |
class AccountPayment(models.Model): |
| 8 |
_inherit = 'account.payment' |
| 9 |
|
| 10 |
pos_order_id = fields.Many2one('pos.order', string='POS Order', help='The Point of Sale order linked to this payment', readonly=True) |
| 11 |
|
| 12 |
def action_view_pos_order(self): |
| 13 |
""" Return the action for the view of the pos order linked to the payment. |
| 14 |
""" |
| 15 |
self.ensure_one() |
| 16 |
|
| 17 |
action = { |
| 18 |
'name': _("POS Order"), |
| 19 |
'type': 'ir.actions.act_window', |
| 20 |
'res_model': 'pos.order', |
| 21 |
'target': 'current', |
| 22 |
'res_id': self.pos_order_id.id, |
| 23 |
'view_mode': 'form' |
| 24 |
} |
| 25 |
return action |