Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] company_dependent_flag: Migrate to 17.0 #699

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions company_dependent_flag/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
======================
Company Dependent Flag
======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:675e1f11fa4e5eedd09d5407f3442f625c5a295eeca2912b0eff3b6baca3362b
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmulti--company-lightgray.png?logo=github
:target: https://github.com/OCA/multi-company/tree/17.0/company_dependent_flag
:alt: OCA/multi-company
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/multi-company-17-0/multi-company-17-0-company_dependent_flag
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/multi-company&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

With this module all company dependent fields are decorated with an
adhoc class.

|image1|

.. |image1| image:: https://raw.githubusercontent.com/OCA/multi-company/17.0/company_dependent_flag/static/description/demo.png

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

- In the next versions, the module should be renamed
web_field_company_dependent_flag

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/multi-company/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/multi-company/issues/new?body=module:%20company_dependent_flag%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Akretion

Contributors
------------

- `Akretion <https://akretion.com>`__:

- David BEAL <[email protected]>

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/multi-company <https://github.com/OCA/multi-company/tree/17.0/company_dependent_flag>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 6 additions & 0 deletions company_dependent_flag/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from odoo.tools import config

from . import models

if not config.get("without_demo"):
from . import demo
15 changes: 15 additions & 0 deletions company_dependent_flag/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Company Dependent Flag",
"author": "Akretion,Odoo Community Association (OCA)",
"summary": "Apply css style to company dependent fields",
"version": "17.0.1.0.2",
"license": "AGPL-3",
"maintainer": ["bealdav"],
"website": "https://github.com/OCA/multi-company",
"category": "web",
"depends": [
"base",
],
"data": [],
"installable": True,
}
1 change: 1 addition & 0 deletions company_dependent_flag/demo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import partner
9 changes: 9 additions & 0 deletions company_dependent_flag/demo/partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# © 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"

phone = fields.Char(company_dependent=True)
30 changes: 30 additions & 0 deletions company_dependent_flag/i18n/company_dependent_flag.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * company_dependent_flag
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \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: company_dependent_flag
#: model:ir.model,name:company_dependent_flag.model_base
msgid "Base"
msgstr ""

#. module: company_dependent_flag
#: model:ir.model,name:company_dependent_flag.model_res_partner
msgid "Contact"
msgstr ""

#. module: company_dependent_flag
#: model:ir.model.fields,field_description:company_dependent_flag.field_res_partner__phone
#: model:ir.model.fields,field_description:company_dependent_flag.field_res_users__phone
msgid "Phone"
msgstr ""
33 changes: 33 additions & 0 deletions company_dependent_flag/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * company_dependent_flag
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-02 20:36+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\n"
"Language-Team: none\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: company_dependent_flag
#: model:ir.model,name:company_dependent_flag.model_base
msgid "Base"
msgstr "Base"

#. module: company_dependent_flag
#: model:ir.model,name:company_dependent_flag.model_res_partner
msgid "Contact"
msgstr "Contacto"

#. module: company_dependent_flag
#: model:ir.model.fields,field_description:company_dependent_flag.field_res_partner__phone
#: model:ir.model.fields,field_description:company_dependent_flag.field_res_users__phone
msgid "Phone"
msgstr "Teléfono"
33 changes: 33 additions & 0 deletions company_dependent_flag/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * company_dependent_flag
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-01-19 19:35+0000\n"
"Last-Translator: mymage <[email protected]>\n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.17\n"

#. module: company_dependent_flag
#: model:ir.model,name:company_dependent_flag.model_base
msgid "Base"
msgstr "Base"

#. module: company_dependent_flag
#: model:ir.model,name:company_dependent_flag.model_res_partner
msgid "Contact"
msgstr "Contatto"

#. module: company_dependent_flag
#: model:ir.model.fields,field_description:company_dependent_flag.field_res_partner__phone
#: model:ir.model.fields,field_description:company_dependent_flag.field_res_users__phone
msgid "Phone"
msgstr "Telefono"
1 change: 1 addition & 0 deletions company_dependent_flag/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import base
32 changes: 32 additions & 0 deletions company_dependent_flag/models/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# © 2023 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, models


class Base(models.AbstractModel):
_inherit = "base"

@api.model
def _get_view(self, view_id=None, view_type="form", **options):
arch, view = super()._get_view(view_id, view_type, **options)
if view_type == "form":
self._update_company_dependent_css(arch)
return arch, view

def _update_company_dependent_css(self, arch):
cpny_dep_fields = [
field_name
for field_name, field_rec in self.env[self._name]._fields.items()
if field_rec.company_dependent
]
for field_name in cpny_dep_fields:
for field in arch.xpath(f"//field[@name='{field_name}']"):
classes = field.attrib.get("class", "").split(" ")
classes += self._get_company_dependent_css_class()
field.attrib["class"] = " ".join(set(classes))

def _get_company_dependent_css_class(self):
"""Inherit to apply your own class"""

return ["fa", "fa-building-o", "d-flex", "flex-row"]
3 changes: 3 additions & 0 deletions company_dependent_flag/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
2 changes: 2 additions & 0 deletions company_dependent_flag/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Akretion](https://akretion.com):
- David BEAL \<<[email protected]>\>
4 changes: 4 additions & 0 deletions company_dependent_flag/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
With this module all company dependent fields are decorated with an
adhoc class.

![](../static/description/demo.png)
2 changes: 2 additions & 0 deletions company_dependent_flag/readme/ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- In the next versions, the module should be renamed
web_field_company_dependent_flag
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.
Loading
Loading