account_cash_deposit: allow to specify date
This commit is contained in:
parent
665fb16693
commit
ba0d99036f
@ -39,7 +39,7 @@ class AccountCashDeposit(models.Model):
|
|||||||
)
|
)
|
||||||
date = fields.Date(
|
date = fields.Date(
|
||||||
string="Date",
|
string="Date",
|
||||||
readonly=True,
|
states={"done": [("readonly", "=", True)]},
|
||||||
tracking=True,
|
tracking=True,
|
||||||
copy=False,
|
copy=False,
|
||||||
help="Used as date for the journal entry.",
|
help="Used as date for the journal entry.",
|
||||||
@ -281,7 +281,7 @@ class AccountCashDeposit(models.Model):
|
|||||||
|
|
||||||
def _prepare_account_move(self, vals):
|
def _prepare_account_move(self, vals):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
date = vals["date"]
|
date = vals.get("date") or self.date
|
||||||
op_type = self.operation_type
|
op_type = self.operation_type
|
||||||
total_amount_comp_cur = self.currency_id._convert(
|
total_amount_comp_cur = self.currency_id._convert(
|
||||||
self.total_amount, self.company_id.currency_id, self.company_id, date
|
self.total_amount, self.company_id.currency_id, self.company_id, date
|
||||||
@ -328,7 +328,7 @@ class AccountCashDeposit(models.Model):
|
|||||||
vals = {"state": "done"}
|
vals = {"state": "done"}
|
||||||
if force_date:
|
if force_date:
|
||||||
vals["date"] = force_date
|
vals["date"] = force_date
|
||||||
else:
|
elif not self.date:
|
||||||
vals["date"] = fields.Date.context_today(self)
|
vals["date"] = fields.Date.context_today(self)
|
||||||
return vals
|
return vals
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user