Skip to content

Commit

Permalink
Merge pull request #1 from Comunitea/16.0-pms_l10n_es_sii
Browse files Browse the repository at this point in the history
[16.0][MIG]  pms_l10n_es_sii
  • Loading branch information
syci authored Oct 14, 2024
2 parents 210f64e + 341f03b commit dbf94d0
Show file tree
Hide file tree
Showing 261 changed files with 91,793 additions and 0 deletions.
100 changes: 100 additions & 0 deletions multi_pms_properties/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
====================
multi_pms_properties
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:63aa2d9bf2f7be1cb90c028270bb6d8850f7492fb066ed649f409279bb9ccdaf
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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%2Fpms-lightgray.png?logo=github
:target: https://github.com/OCA/pms/tree/14.0/multi_pms_properties
:alt: OCA/pms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pms-14-0/pms-14-0-multi_pms_properties
: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/pms&target_branch=14.0
:alt: Try me on Runboat

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

Technical addon to support multiproperty in property management system (PMS).

**Table of contents**

.. contents::
:local:

Installation
============

To install this module, you only need to add it to your addons, and load it as
a server-wide module.

This can be done with the ``server_wide_modules`` parameter in ``/etc/odoo.conf``
or with the ``--load`` command-line parameter

``server_wide_modules = "multi_pms_properties"``

Usage
=====

* Use the standard multicompany guidelines applied to pms.property:

``_check_pms_properties_auto like model attribute to autocheck on create/write``
``check_pms_properties like field attribute to check relational record properties consistence``
``This module not implement propety dependent fields``

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/pms/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/pms/issues/new?body=module:%20multi_pms_properties%0Aversion:%2014.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
~~~~~~~

* Commit [Sun]

Contributors
~~~~~~~~~~~~

* `Commit [Sun] <https://www.commitsun.com>`:

* Dario Lodeiros
* Eric Antones
* Sara Lago

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/pms <https://github.com/OCA/pms/tree/14.0/multi_pms_properties>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
64 changes: 64 additions & 0 deletions multi_pms_properties/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2021 Dario Lodeiros
# Copyright 2021 Eric Antones
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging

from odoo import fields
from odoo.tools import config

from . import models


def _description_domain(self, env):
if self.check_company and not self.domain:
if self.company_dependent:
if self.comodel_name == "res.users":
# user needs access to current company (self.env.company)
return "[('company_ids', 'in', allowed_company_ids[0])]"
else:
return "[('company_id', 'in', [allowed_company_ids[0], False])]"
else:
# when using check_company=True on a field on 'res.company', the
# company_id comes from the id of the current record
cid = "id" if self.model_name == "res.company" else "company_id"
if self.comodel_name == "res.users":
# User allowed company ids = user.company_ids
return f"['|', (not {cid}, '=', True), ('company_ids', 'in', [{cid}])]"
else:
return f"[('company_id', 'in', [{cid}, False])]"

if self.check_pms_properties and not self.domain:
record = env[self.model_name]
# Skip company_id domain to avoid domain multiproperty error in inherited views
if (
self.check_pms_properties
and not self.domain
and self.name not in ["company_id"]
):
if self.model_name == "pms.property":
prop1 = "id"
prop2 = f"[{prop1}]"
elif "pms_property_id" in record._fields:
prop1 = "pms_property_id"
prop2 = f"[{prop1}]"
else:
prop1 = prop2 = "pms_property_ids"
coprop = (
"pms_property_id"
if "pms_property_id" in env[self.comodel_name]._fields
else "pms_property_ids"
)
return f"['|', '|', \
(not {prop1}, '=', True), \
('{coprop}', 'in', {prop2}), \
('{coprop}', '=', False)]"

return self.domain(env[self.model_name]) if callable(self.domain) else self.domain


if "multi_pms_properties" in config.get("server_wide_modules"):
_logger = logging.getLogger(__name__)
_logger.info("monkey patching fields._Relational")

fields._Relational.check_pms_properties = False
fields._Relational._description_domain = _description_domain
17 changes: 17 additions & 0 deletions multi_pms_properties/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# © 2013 Therp BV
# © 2014 ACSONE SA/NV
# Copyright 2018 Quartile Limited
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "multi_pms_properties",
"summary": "Multi Properties Manager",
"version": "14.0.1.0.0",
"website": "https://github.com/OCA/pms",
"author": "Commit [Sun], Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Pms",
"depends": ["base"],
"auto_install": False,
"installable": True,
}
49 changes: 49 additions & 0 deletions multi_pms_properties/i18n/multi_pms_properties.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * multi_pms_properties
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.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: multi_pms_properties
#: code:addons/multi_pms_properties/models.py:0
#, python-format
msgid ""
"- %(record)r belongs to properties %(pms_properties)r and\n"
" %(field)r (%(fname)s: %(values)s) belongs to another properties."
msgstr ""

#. module: multi_pms_properties
#: code:addons/multi_pms_properties/models.py:0
#, python-format
msgid ""
"- Record is properties %(pms_properties)r and %(field)r\n"
" (%(fname)s: %(values)s) belongs to another properties."
msgstr ""

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

#. module: multi_pms_properties
#: code:addons/multi_pms_properties/models.py:0
#, python-format
msgid "Incompatible properties on records:"
msgstr ""

#. module: multi_pms_properties
#: code:addons/multi_pms_properties/models.py:0
#, python-format
msgid ""
"You cannot establish a company other than the one with the established "
"properties"
msgstr ""
Loading

0 comments on commit dbf94d0

Please sign in to comment.