Skip to content

Commit

Permalink
[MIG] account_brand: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardCForgeFlow committed Nov 6, 2024
1 parent 63314e4 commit 01d7361
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
3 changes: 3 additions & 0 deletions account_brand/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ To use this module, you need to:
3. Enter the information and select the brand
4. Print the PDF report. It includes the information of the brand.

To do point 4, the Brand External Report Layout OCA module must be
installed.

Bug Tracker
===========

Expand Down
2 changes: 1 addition & 1 deletion account_brand/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,"
Expand Down
11 changes: 2 additions & 9 deletions account_brand/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
2 changes: 2 additions & 0 deletions account_brand/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ To use this module, you need to:
2. Select or create an invoice
3. Enter the information and select the brand
4. Print the PDF report. It includes the information of the brand.

To do point 4, the Brand External Report Layout OCA module must be installed.
14 changes: 9 additions & 5 deletions account_brand/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -402,6 +402,8 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<li>Enter the information and select the brand</li>
<li>Print the PDF report. It includes the information of the brand.</li>
</ol>
<p>To do point 4, the Brand External Report Layout OCA module must be
installed.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
Expand Down Expand Up @@ -442,7 +444,9 @@ <h2><a class="toc-backref" href="#toc-entry-7">Other credits</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
Expand Down
4 changes: 2 additions & 2 deletions account_brand/tests/test_account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion account_brand/tests/test_brand_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions account_brand/views/account_move_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
<!-- Copyright (C) 2019 Open Source Integrators
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.form - account_brand</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="partner_shipping_id" position="before">
<field
name="brand_id"
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))], 'readonly': [('state', '!=', 'draft')]}"
invisible="move_type not in ['out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt']"
readonly="state != 'draft'"
/>
</field>
</field>
Expand Down

0 comments on commit 01d7361

Please sign in to comment.