2
0
account-financial-tools/account_cash_deposit/wizards/account_cash_order_reception.py
Alexis de Lattre 6b8d47f5c0 Add module account_cash_deposit
This module manages cash deposits (cash to bank) and cash orders (bank to cash)
2022-12-12 18:13:15 +01:00

28 lines
994 B
Python

# Copyright 2022 Akretion France (http://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, fields, models
from odoo.tools.misc import format_date
class AccountCashOrderReception(models.TransientModel):
_name = "account.cash.order.reception"
_description = "Cash Order Reception"
order_id = fields.Many2one(
"account.cash.deposit", readonly=True, string="Cash Order"
)
date = fields.Date(
string="Cash Reception Date", default=fields.Date.context_today, required=True
)
total_amount = fields.Monetary(related="order_id.total_amount")
currency_id = fields.Many2one(related="order_id.currency_id")
def run(self):
self.ensure_one()
self.order_id.message_post(
body=_("Cash reception confirmed on %s.") % format_date(self.env, self.date)
)
self.order_id.validate(force_date=self.date)