Skip to content

Commit

Permalink
Merge PR #162 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by bguillot
  • Loading branch information
OCA-git-bot committed Oct 12, 2023
2 parents 870e5d8 + 1612445 commit f6088b9
Show file tree
Hide file tree
Showing 20 changed files with 242 additions and 0 deletions.
Empty file added partner_brand/README.rst
Empty file.
1 change: 1 addition & 0 deletions partner_brand/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions partner_brand/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "Partner Brand",
"summary": "Define registered mark in partners according to brand settings",
"version": "16.0.1.0.0",
"author": "Odoo Community Association (OCA), Akretion",
"development_status": "Alpha",
"category": "Product",
"maintainers": ["bealdav"],
"website": "https://github.com/OCA/brand",
"license": "AGPL-3",
"depends": [
"brand",
"contacts",
],
"data": [
"views/partner.xml",
],
"demo": [
"data/res_brand_demo.xml",
"data/res_partner_demo.xml",
],
}
23 changes: 23 additions & 0 deletions partner_brand/data/res_brand_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" ?>
<odoo>

<record id="carrefour" model="res.brand">
<field name="name">Carrefour</field>
<field
name="image_1920"
type="base64"
file="partner_brand/static/description/carrouf.png"
/>
</record>

<record id="walmart" model="res.brand">
<field name="name">Walmart</field>
<field
name="image_1920"
type="base64"
file="partner_brand/static/description/walmart.png"
/>
</record>


</odoo>
36 changes: 36 additions & 0 deletions partner_brand/data/res_partner_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" ?>
<odoo>

<record id="carrefour_lyon" model="res.partner">
<field name="name">Carrefour Lyon</field>
<field name="company_type">company</field>
<field name="brand_id" ref="carrefour" />
<field
name="image_1920"
type="base64"
file="partner_brand/static/description/lyon.jpg"
/>
</record>
<record id="carrefour_bordeaux" model="res.partner">
<field name="name">Carrefour Bordeaux</field>
<field name="company_type">company</field>
<field name="brand_id" ref="carrefour" />
</record>

<record id="walmart_austin" model="res.partner">
<field name="name">Walmart Austin</field>
<field name="company_type">company</field>
<field name="brand_id" ref="walmart" />
<field
name="image_1920"
type="base64"
file="partner_brand/static/description/walmart.jpg"
/>
</record>
<record id="walmart_miami" model="res.partner">
<field name="name">Walmart Miami</field>
<field name="company_type">company</field>
<field name="brand_id" ref="walmart" />
</record>

</odoo>
53 changes: 53 additions & 0 deletions partner_brand/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_brand
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Poedit 3.0.1\n"

#. module: partner_brand
#: model_terms:ir.ui.view,arch_db:partner_brand.res_partner_kanban_view
msgid ""
"<span title=\"This company is linked to a brand\" attrs=\"{'invisible': "
"[('brand_logo', '=', False)]}\">® &amp;nbsp;</span>"
msgstr ""
"<span title=\"Cette société est lié à une marque\" "
"attrs=\"{'invisible': [('brand_logo', '=', False)]}\">® &amp;nbsp;</"
"span>"

#. module: partner_brand
#: model:ir.model.fields,field_description:partner_brand.field_res_brand__brand_id
#: model:ir.model.fields,field_description:partner_brand.field_res_partner__brand_id
#: model:ir.model.fields,field_description:partner_brand.field_res_users__brand_id
#: model_terms:ir.ui.view,arch_db:partner_brand.view_res_partner_filter
msgid "Brand"
msgstr "Marque"

#. module: partner_brand
#: model:ir.model.fields,field_description:partner_brand.field_res_brand__brand_logo
#: model:ir.model.fields,field_description:partner_brand.field_res_partner__brand_logo
#: model:ir.model.fields,field_description:partner_brand.field_res_users__brand_logo
msgid "Brand logo"
msgstr "Logo de marque"

#. module: partner_brand
#: model:ir.ui.menu,name:partner_brand.res_brand_menu
msgid "Brands"
msgstr "Marque"

#. module: partner_brand
#: model:ir.model,name:partner_brand.model_res_partner
msgid "Contact"
msgstr ""
1 change: 1 addition & 0 deletions partner_brand/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import partner
14 changes: 14 additions & 0 deletions partner_brand/models/partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# © 2023 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

brand_id = fields.Many2one(comodel_name="res.brand")
brand_logo = fields.Image(
string="Brand logo",
related="brand_id.partner_id.image_128",
)
14 changes: 14 additions & 0 deletions partner_brand/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Allow to set brand to partners allowing to group/filter partners by brand

A brand, here, could be Carrefour, Wallmart, etc.

It also display brand image in form view and flag for partner with brand in kanban

.. figure:: ../static/description/brand_form.png
:alt: Brand form view

.. figure:: ../static/description/brand_tree.png
:alt: Brand tree view

.. figure:: ../static/description/brand_kanban.png
:alt: Brand kanban view
Binary file added partner_brand/static/description/brand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added partner_brand/static/description/brand_form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added partner_brand/static/description/brand_tree.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added partner_brand/static/description/carrouf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added partner_brand/static/description/lyon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added partner_brand/static/description/walmart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added partner_brand/static/description/walmart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 71 additions & 0 deletions partner_brand/views/partner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="industry_id" position="after">
<field
name="brand_id"
attrs="{'invisible': [('is_company', '=', False)]}"
/>
</field>
<field name="image_1920" position="before">
<field
name="brand_logo"
widget="image"
class="oe_avatar"
attrs="{'invisible': [('brand_logo', '=', False)]}"
/>
</field>
</field>
</record>

<record id="view_partner_tree" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree" />
<field name="arch" type="xml">
<field name="active" position="after">
<field name="brand_id" optional="hide" />
</field>
</field>
</record>

<record id="view_res_partner_filter" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter" />
<field name="arch" type="xml">
<xpath expr="//group" position="inside">
<filter
name="group_brand"
string="Brand"
context="{'group_by': 'brand_id'}"
/>
</xpath>
</field>
</record>

<record id="res_partner_kanban_view" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view" />
<field name="arch" type="xml">
<xpath expr="//div/div" position="before">
<div>
<field name="brand_logo" invisible="1" />
<span
title="This company is linked to a brand"
attrs="{'invisible': [('brand_logo', '=', False)]}"
&amp;nbsp;</span>
</div>
</xpath>
</field>
</record>

<record model="ir.ui.menu" id="res_brand_menu">
<field name="name">Brands</field>
<field name="parent_id" ref="contacts.res_partner_menu_config" />
<field name="action" ref="brand.res_brand_act_window" />
</record>

</odoo>
1 change: 1 addition & 0 deletions setup/partner_brand/odoo/addons/partner_brand
6 changes: 6 additions & 0 deletions setup/partner_brand/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit f6088b9

Please sign in to comment.