From b90df1a4ec8ec84ca41c8f93dc6fb6c6637d77fb Mon Sep 17 00:00:00 2001 From: RicardCForgeFlow Date: Mon, 11 Mar 2024 10:17:42 +0100 Subject: [PATCH] [MIG] account_brand: Migration to 17.0 --- account_brand/__manifest__.py | 2 +- account_brand/models/account_move.py | 11 ++--------- account_brand/static/description/index.html | 1 - account_brand/tests/test_account_move.py | 4 ++-- account_brand/tests/test_brand_mixin.py | 2 +- account_brand/views/account_move_views.xml | 3 ++- 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/account_brand/__manifest__.py b/account_brand/__manifest__.py index edec0c66e..6725d75f2 100644 --- a/account_brand/__manifest__.py +++ b/account_brand/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Account Brand", "summary": "Send branded invoices and refunds", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "category": "Accounting Management", "website": "https://github.com/OCA/brand", "author": "Open Source Integrators," diff --git a/account_brand/models/account_move.py b/account_brand/models/account_move.py index 46e8c96d2..ad0223704 100644 --- a/account_brand/models/account_move.py +++ b/account_brand/models/account_move.py @@ -9,14 +9,7 @@ class AccountMove(models.Model): _name = "account.move" _inherit = ["account.move", "res.brand.mixin"] - brand_id = fields.Many2one( - states={ - "open": [("readonly", True)], - "in_payment": [("readonly", True)], - "paid": [("readonly", True)], - "cancel": [("readonly", True)], - } - ) + brand_id = fields.Many2one() def _is_brand_required(self): self.ensure_one() @@ -59,7 +52,7 @@ def _onchange_partner_id(self): account_id = rec_account if account_id: self.line_ids.filtered( - lambda l, a=account_id: l.account_id.account_type + lambda line, a=account_id: line.account_id.account_type == a.account_type ).update({"account_id": account_id.id}) return res diff --git a/account_brand/static/description/index.html b/account_brand/static/description/index.html index 433316250..6e1e7b514 100644 --- a/account_brand/static/description/index.html +++ b/account_brand/static/description/index.html @@ -1,4 +1,3 @@ - diff --git a/account_brand/tests/test_account_move.py b/account_brand/tests/test_account_move.py index f7ed4c058..7c3835e42 100644 --- a/account_brand/tests/test_account_move.py +++ b/account_brand/tests/test_account_move.py @@ -6,7 +6,7 @@ class TestAccountMove(TransactionCase): def setUp(self): - super(TestAccountMove, self).setUp() + super().setUp() self.product = self.env.ref("product.product_product_4") self.account_receivable = self.env["account.account"].create( { @@ -63,7 +63,7 @@ def setUp(self): def _get_receivable_account(self, move): return self.move.line_ids.filtered( - lambda l: l.account_id.account_type == "asset_receivable" + lambda line: line.account_id.account_type == "asset_receivable" ).account_id def test_on_change_partner_id(self): diff --git a/account_brand/tests/test_brand_mixin.py b/account_brand/tests/test_brand_mixin.py index 9c8443573..b87635ad7 100644 --- a/account_brand/tests/test_brand_mixin.py +++ b/account_brand/tests/test_brand_mixin.py @@ -11,7 +11,7 @@ class TestBrandMixin(TransactionCase): def setUp(self): - super(TestBrandMixin, self).setUp() + super().setUp() self.partner = self.env.user.partner_id self.company = self.env.user.company_id self.other_company = self.env["res.company"].create( diff --git a/account_brand/views/account_move_views.xml b/account_brand/views/account_move_views.xml index cbdf8752a..69fd66ed5 100644 --- a/account_brand/views/account_move_views.xml +++ b/account_brand/views/account_move_views.xml @@ -8,7 +8,8 @@