Skip to content

Commit

Permalink
[PORT] res_company_category from 12.0 to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Oct 17, 2022
1 parent bba5618 commit 07dcb01
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 36 deletions.
9 changes: 3 additions & 6 deletions res_company_category/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

{
"name": "Company Categories",
"version": "12.0.1.0.0",
"version": "16.0.1.0.1",
"category": "Tools",
"author": "GRAP, Odoo Community Association (OCA)",
"maintainers": ["legalsylvain"],
"website": "https://github.com/OCA/multi-company",
"license": "AGPL-3",
"depends": [
"base",
"res_company_search_view",
],
"data": [
"security/ir.model.access.csv",
Expand All @@ -23,9 +25,4 @@
"demo/res_company.xml",
],
"installable": True,
"images": [
"static/description/res_company_category_form.png",
"static/description/res_company_category_tree.png",
"static/description/res_company_form.png",
],
}
38 changes: 27 additions & 11 deletions res_company_category/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,27 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-17 10:51+0000\n"
"PO-Revision-Date: 2019-09-17 10:51+0000\n"
"Last-Translator: <>\n"
"POT-Creation-Date: 2022-10-14 11:55+0000\n"
"PO-Revision-Date: 2022-10-14 11:55+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__active
msgid "Active"
msgstr "active"

#. module: res_company_category
#: model_terms:ir.ui.view,arch_db:res_company_category.view_res_company_category_form
msgid "Archived"
msgstr "Archivé"

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company__category_id
msgid "Category"
Expand All @@ -27,8 +36,10 @@ msgid "Category Childs"
msgstr "Catégories filles"

#. module: res_company_category
#: model:ir.actions.act_window,name:res_company_category.action_company_category_to_company
#: model:ir.model,name:res_company_category.model_res_company
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__company_ids
#: model_terms:ir.ui.view,arch_db:res_company_category.view_res_company_category_form
msgid "Companies"
msgstr "Sociétés"

Expand Down Expand Up @@ -67,7 +78,7 @@ msgstr "Nom affiché"
#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__id
msgid "ID"
msgstr "ID"
msgstr ""

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category____last_update
Expand All @@ -91,22 +102,27 @@ msgid "Name"
msgstr "Nom"

#. module: res_company_category
#: selection:res.company.category,type:0
#: model:ir.model.fields.selection,name:res_company_category.selection__res_company_category__type__normal
msgid "Normal"
msgstr "Normal"
msgstr ""

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__parent_id
#: model_terms:ir.ui.view,arch_db:res_company_category.view_res_company_category_form
msgid "Parent Category"
msgstr "Catégorie mère"

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__parent_path
msgid "Parent Path"
msgstr "Chemin parent"

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__type
msgid "Type"
msgstr "Type"
msgstr ""

#. module: res_company_category
#: selection:res.company.category,type:0
#: model:ir.model.fields.selection,name:res_company_category.selection__res_company_category__type__view
msgid "View"
msgstr "Vue"
msgstr ""
32 changes: 25 additions & 7 deletions res_company_category/i18n/res_company_category.pot
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * res_company_category
# * res_company_category
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"POT-Creation-Date: 2022-10-14 11:55+0000\n"
"PO-Revision-Date: 2022-10-14 11:55+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__active
msgid "Active"
msgstr ""

#. module: res_company_category
#: model_terms:ir.ui.view,arch_db:res_company_category.view_res_company_category_form
msgid "Archived"
msgstr ""

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company__category_id
msgid "Category"
Expand All @@ -24,8 +36,10 @@ msgid "Category Childs"
msgstr ""

#. module: res_company_category
#: model:ir.actions.act_window,name:res_company_category.action_company_category_to_company
#: model:ir.model,name:res_company_category.model_res_company
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__company_ids
#: model_terms:ir.ui.view,arch_db:res_company_category.view_res_company_category_form
msgid "Companies"
msgstr ""

Expand Down Expand Up @@ -88,7 +102,7 @@ msgid "Name"
msgstr ""

#. module: res_company_category
#: selection:res.company.category,type:0
#: model:ir.model.fields.selection,name:res_company_category.selection__res_company_category__type__normal
msgid "Normal"
msgstr ""

Expand All @@ -98,13 +112,17 @@ msgstr ""
msgid "Parent Category"
msgstr ""

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__parent_path
msgid "Parent Path"
msgstr ""

#. module: res_company_category
#: model:ir.model.fields,field_description:res_company_category.field_res_company_category__type
msgid "Type"
msgstr ""

#. module: res_company_category
#: selection:res.company.category,type:0
#: model:ir.model.fields.selection,name:res_company_category.selection__res_company_category__type__view
msgid "View"
msgstr ""

msgstr ""
24 changes: 17 additions & 7 deletions res_company_category/models/res_company_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,30 @@ class ResCompanyCategory(models.Model):
_name = "res.company.category"
_description = "Company Categories"
_order = "complete_name"
_parent_name = "parent_id"
_parent_store = True
_rec_name = "complete_name"
_order = "complete_name"

_TYPE_SELECTION = [
("normal", "Normal"),
("view", "View"),
]

# Fields Section
name = fields.Char(string="Name", required=True)
name = fields.Char(required=True)

type = fields.Selection(
string="Type", selection=_TYPE_SELECTION, required=True, default="normal"
)
active = fields.Boolean(default=True)

type = fields.Selection(selection=_TYPE_SELECTION, required=True, default="normal")

parent_id = fields.Many2one(
string="Parent Category",
comodel_name="res.company.category",
domain=[("type", "=", "view")],
)

parent_path = fields.Char(index=True, unaccent=False)

child_ids = fields.One2many(
string="Category Childs",
comodel_name="res.company.category",
Expand All @@ -39,11 +44,16 @@ class ResCompanyCategory(models.Model):
)

company_qty = fields.Integer(
string="Companies Quantity", compute="_compute_company_qty", store=True
string="Companies Quantity",
compute="_compute_company_qty",
store=True,
recursive=True,
)

complete_name = fields.Char(
string="Complete Name", compute="_compute_complete_name", store=True
compute="_compute_complete_name",
store=True,
recursive=True,
)

# Compute Section
Expand Down
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 modified res_company_category/static/description/res_company_form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 46 additions & 5 deletions res_company_category/views/view_res_company_category.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,56 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record id="action_company_category_to_company" model="ir.actions.act_window">
<field name="name">Companies</field>
<field name="res_model">res.company</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{
"search_default_category_id": [active_id],
"default_category_id": active_id,
}
</field>
</record>


<record id="view_res_company_category_tree" model="ir.ui.view">
<field name="model">res.company.category</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="blue: type == 'view'">
<tree decoration-info="type == 'view'">
<field name="complete_name" />
<field name="company_qty" />
<field name="type" invisible="1" />
</tree>
</field>
</record>


<record id="view_res_company_category_form" model="ir.ui.view">
<field name="model">res.company.category</field>
<field name="type">form</field>
<field name="arch" type="xml">
<header />
<sheet>
<div class="oe_button_box" name="button_box">
<button
class="oe_stat_button"
type="action"
name="%(action_company_category_to_company)d"
icon="fa-list"
>
<field
string="Companies"
name="company_qty"
widget="statinfo"
/>
</button>
</div>
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
attrs="{'invisible': [('active', '=', True)]}"
/>
<div class="oe_title">
<label class="oe_edit_only" for="name" string="Name" />
<h1><field name="name" /></h1>
Expand All @@ -36,22 +66,33 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
/>
<h2><field name="parent_id" /></h2>
</div>
<div class="oe_right oe_button_box" name="buttons" />

<group>
<group>
<field name="type" />
<field name="company_qty" />
<field name="active" invisible="1" />
</group>
</group>
</sheet>
</field>
</record>

<record id="view_res_company_search" model="ir.ui.view">
<field name="model">res.company</field>
<field
name="inherit_id"
ref="res_company_search_view.view_res_company_search"
/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="category_id" />
</field>
</field>
</record>

<record id="action_company_category" model="ir.actions.act_window">
<field name="name">Company Categories</field>
<field name="res_model">res.company.category</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>

Expand Down

0 comments on commit 07dcb01

Please sign in to comment.