mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
account_payment_order: remove done state (migration script provided)
Don't set reference_type field on account.move required=True, because it causes a lot of problems in other modules that don't depend on this one. Setting it as required in the view is enough.
This commit is contained in:
committed by
Marçal Isern
parent
74dd1adc3e
commit
6b5859b8bc
@@ -8,7 +8,7 @@
|
||||
|
||||
{
|
||||
"name": "Account Payment Order",
|
||||
"version": "14.0.1.2.4",
|
||||
"version": "14.0.1.3.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "ACSONE SA/NV, "
|
||||
"Therp BV, "
|
||||
|
||||
10
account_payment_order/migrations/14.0.1.3.0/pre-migration.py
Normal file
10
account_payment_order/migrations/14.0.1.3.0/pre-migration.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# Copyright 2021 Akretion France (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
cr.execute(
|
||||
"UPDATE account_payment_order SET state='uploaded' WHERE state='done'")
|
||||
@@ -24,7 +24,6 @@ class AccountMove(models.Model):
|
||||
reference_type = fields.Selection(
|
||||
selection=[("none", "Free Reference"), ("structured", "Structured Reference")],
|
||||
string="Reference Type",
|
||||
required=True,
|
||||
readonly=True,
|
||||
states={"draft": [("readonly", False)]},
|
||||
default="none",
|
||||
|
||||
@@ -74,7 +74,6 @@ class AccountPaymentOrder(models.Model):
|
||||
("open", "Confirmed"),
|
||||
("generated", "File Generated"),
|
||||
("uploaded", "File Uploaded"),
|
||||
("done", "Done"),
|
||||
("cancel", "Cancel"),
|
||||
],
|
||||
string="Status",
|
||||
@@ -106,7 +105,6 @@ class AccountPaymentOrder(models.Model):
|
||||
)
|
||||
date_generated = fields.Date(string="File Generation Date", readonly=True)
|
||||
date_uploaded = fields.Date(string="File Upload Date", readonly=True)
|
||||
date_done = fields.Date(string="Done Date", readonly=True)
|
||||
generated_user_id = fields.Many2one(
|
||||
comodel_name="res.users",
|
||||
string="Generated by",
|
||||
@@ -250,11 +248,7 @@ class AccountPaymentOrder(models.Model):
|
||||
if self.payment_mode_id.default_date_prefered:
|
||||
self.date_prefered = self.payment_mode_id.default_date_prefered
|
||||
|
||||
def action_done(self):
|
||||
self.write({"date_done": fields.Date.context_today(self), "state": "done"})
|
||||
return True
|
||||
|
||||
def action_done_cancel(self):
|
||||
def action_uploaded_cancel(self):
|
||||
for move in self.move_ids:
|
||||
move.button_cancel()
|
||||
for move_line in move.line_ids:
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
string="Cancel Payments"
|
||||
/>
|
||||
<button
|
||||
name="action_done_cancel"
|
||||
name="action_uploaded_cancel"
|
||||
type="object"
|
||||
states="uploaded"
|
||||
string="Cancel Payments"
|
||||
@@ -55,7 +55,7 @@
|
||||
<field
|
||||
name="state"
|
||||
widget="statusbar"
|
||||
statusbar_visible="draft,open,generated,uploaded,done"
|
||||
statusbar_visible="draft,open,generated,uploaded"
|
||||
/>
|
||||
</header>
|
||||
<sheet>
|
||||
@@ -158,7 +158,7 @@
|
||||
<field
|
||||
name="state"
|
||||
decoration-info="state == 'draft'"
|
||||
decoration-success="state in ('uploaded', 'done')"
|
||||
decoration-success="state == 'uploaded'"
|
||||
decoration-warning="state == 'open'"
|
||||
decoration-danger="state == 'generated'"
|
||||
decoration-muted="state == 'cancel'"
|
||||
|
||||
Reference in New Issue
Block a user