From d2c1043d0e08a4789ee6b0a6d8d3dd17e27ade06 Mon Sep 17 00:00:00 2001 From: jbw Date: Mon, 24 Feb 2020 14:17:12 +0000 Subject: [PATCH] [IMP] account_move : display "Post Automatically" on vendor bills As we already have the Post Automatically concept in account.move, we want to be able to use it for vendor bills. This way, e.g. one can prepare all it's office rents bill for the year and everything will be automatic.. Other changes : - auto_post reset to False when move is canceled - auto_post set to readonly in view when state != draft Task : 2200743 closes odoo/odoo#46218 Signed-off-by: Cedric Snauwaert (csn) --- addons/account/models/account_move.py | 2 +- addons/account/views/account_move_views.xml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index ca183becb2c..d14164136b8 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -2231,7 +2231,7 @@ class AccountMove(models.Model): self.write({'state': 'draft'}) def button_cancel(self): - self.write({'state': 'cancel'}) + self.write({'auto_post': False, 'state': 'cancel'}) def action_invoice_sent(self): """ Open a window to compose an email, with the edi invoice template diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 69d5499c6ad..2fa1f3e067b 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -987,6 +987,8 @@ + + attrs="{'invisible': [('move_type', '!=', 'entry')], 'readonly': ['|',('reversed_entry_id', '!=', False),('state','!=','draft')]}"/>