|
|
|
@ -128,7 +128,8 @@ class AccountCashDepositWizard(models.TransientModel):
|
|
|
|
|
|
|
|
|
|
def action_confirm(self):
|
|
|
|
|
total_amount = self.total_amount if self.total_amount > 0 else False
|
|
|
|
|
if self.operation_type and self.has_partner and total_amount:
|
|
|
|
|
if self.operation_type and total_amount and self.has_partner \
|
|
|
|
|
and not (self.has_partner == 'bktobk' and not self.counterpart_journal_id):
|
|
|
|
|
if self.operation_type == 'order':
|
|
|
|
|
self.order_date = self.order_date if self.order_date else self.date if self.date else fields.Date.context_today(self)
|
|
|
|
|
self.date = False
|
|
|
|
@ -153,12 +154,19 @@ class AccountCashDepositWizard(models.TransientModel):
|
|
|
|
|
else:
|
|
|
|
|
self.deposit_id.update(deposit_values)
|
|
|
|
|
else:
|
|
|
|
|
raise ValidationError("Some fields require your attention: %s" % ' and '.join([
|
|
|
|
|
field[0] for field in [
|
|
|
|
|
fields = [
|
|
|
|
|
("Type d'opération", self.operation_type),
|
|
|
|
|
("Choix du partenaire", self.has_partner),
|
|
|
|
|
("Choix du partenaire", self.has_partner),
|
|
|
|
|
("Montant total",total_amount)
|
|
|
|
|
] if not field[1]
|
|
|
|
|
]
|
|
|
|
|
if self.operation_type and self.has_partner:
|
|
|
|
|
if self.has_partner == 'bktobk' and not self.counterpart_journal_id:
|
|
|
|
|
if self.operation_type == 'order':
|
|
|
|
|
fields.append(("Banque ou caisse de destination", self.counterpart_journal_id))
|
|
|
|
|
else:
|
|
|
|
|
fields.append(("Banque ou caisse d'origine'", self.counterpart_journal_id))
|
|
|
|
|
raise ValidationError("Some fields require your attention: %s" % ' and '.join([
|
|
|
|
|
field[0] for field in fields if not field[1]
|
|
|
|
|
]))
|
|
|
|
|
_logger.warning("deposit %s created/updated" % self.deposit_id.id)
|
|
|
|
|
return {
|
|
|
|
|