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

17.0 mig partner exception #1915

Open
wants to merge 11 commits 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
83 changes: 83 additions & 0 deletions partner_exception/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
=================
Partner Exception
=================

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

.. |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%2Fpartner--contact-lightgray.png?logo=github
:target: https://github.com/OCA/partner-contact/tree/15.0/partner_exception
:alt: OCA/partner-contact
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/partner-contact-15-0/partner-contact-15-0-partner_exception
: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/partner-contact&target_branch=15.0
:alt: Try me on Runboat

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

Applies base_exception module for contacts.

**Table of contents**

.. contents::
:local:

Usage
=====

Custom exceptions on partner contact

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

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

* Forgeflow

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

* `ForgeFlow <https://www.forgeflow.com>`__:

* Jaume Bernaus <[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/partner-contact <https://github.com/OCA/partner-contact/tree/15.0/partner_exception>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions partner_exception/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2022 ForgeFlow, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models
13 changes: 13 additions & 0 deletions partner_exception/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2022 ForgeFlow, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Partner Exception",
"summary": "Custom exceptions on partner contact",
"version": "17.0.1.0.0",
"category": "Generic Modules/Sale",
"author": "Forgeflow, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/partner-contact",
"depends": ["contacts", "base_exception"],
"license": "AGPL-3",
"data": ["views/contact_views.xml"],
}
64 changes: 64 additions & 0 deletions partner_exception/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_exception
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2023-10-09 07:40+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: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_exception_rule__model
msgid "Apply on"
msgstr "Aplicar sobre"

#. module: partner_exception
#: model:ir.model,name:partner_exception.model_res_partner
#: model:ir.model.fields.selection,name:partner_exception.selection__exception_rule__model__res_partner
msgid "Contact"
msgstr "Contacto"

#. module: partner_exception
#: model:ir.actions.act_window,name:partner_exception.action_partner_exception_rule_tree
#: model:ir.ui.menu,name:partner_exception.menu_action_contact_exception
msgid "Contact Exception Rules"
msgstr "Normas de excepción de contacto"

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_exception_rule__partner_ids
msgid "Contacts"
msgstr "Contactos"

#. module: partner_exception
#: model:ir.model,name:partner_exception.model_exception_rule
msgid "Exception Rule"
msgstr "Regla de excepción"

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_res_partner__exception_ids
msgid "Exceptions"
msgstr "Excepciones"

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_res_partner__exceptions_summary
msgid "Exceptions Summary"
msgstr "Resumen de Excepciones"

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_res_partner__ignore_exception
msgid "Ignore Exceptions"
msgstr "Ignorar Excepciones"

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_res_partner__main_exception_id
msgid "Main Exception"
msgstr "Excepción Principal"
61 changes: 61 additions & 0 deletions partner_exception/i18n/partner_exception.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * partner_exception
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.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: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_exception_rule__model
msgid "Apply on"
msgstr ""

#. module: partner_exception
#: model:ir.model,name:partner_exception.model_res_partner
#: model:ir.model.fields.selection,name:partner_exception.selection__exception_rule__model__res_partner
msgid "Contact"
msgstr ""

#. module: partner_exception
#: model:ir.actions.act_window,name:partner_exception.action_partner_exception_rule_tree
#: model:ir.ui.menu,name:partner_exception.menu_action_contact_exception
msgid "Contact Exception Rules"
msgstr ""

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_exception_rule__partner_ids
msgid "Contacts"
msgstr ""

#. module: partner_exception
#: model:ir.model,name:partner_exception.model_exception_rule
msgid "Exception Rule"
msgstr ""

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_res_partner__exception_ids
msgid "Exceptions"
msgstr ""

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_res_partner__exceptions_summary
msgid "Exceptions Summary"
msgstr ""

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_res_partner__ignore_exception
msgid "Ignore Exceptions"
msgstr ""

#. module: partner_exception
#: model:ir.model.fields,field_description:partner_exception.field_res_partner__main_exception_id
msgid "Main Exception"
msgstr ""
1 change: 1 addition & 0 deletions partner_exception/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import res_partner
49 changes: 49 additions & 0 deletions partner_exception/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2022 ForgeFlow, S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class ExceptionRule(models.Model):
_inherit = "exception.rule"

model = fields.Selection(
selection_add=[("res.partner", "Contact")], ondelete={"res.partner": "cascade"}
)
partner_ids = fields.Many2many("res.partner", string="Contacts")


class ResPartner(models.Model):
_inherit = ["res.partner", "base.exception"]
_name = "res.partner"
_order = "main_exception_id ASC, complete_name ASC, id DESC"

@api.model
def _reverse_field(self):
return "partner_ids"

def _fields_trigger_check_exception(self):
return ["ignore_exception"]

@api.model
def create(self, vals):
record = super(ResPartner, self).create(vals)
check_exceptions = any(
field in vals for field in self._fields_trigger_check_exception()
)
if check_exceptions:
record.contact_check_exception()
return record

def write(self, vals):
result = super(ResPartner, self).write(vals)
check_exceptions = any(
field in vals for field in self._fields_trigger_check_exception()
)
if check_exceptions:
self.contact_check_exception()
return result

def contact_check_exception(self):
if self:
self._check_exception()
3 changes: 3 additions & 0 deletions partner_exception/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `ForgeFlow <https://www.forgeflow.com>`__:

* Jaume Bernaus <[email protected]>
1 change: 1 addition & 0 deletions partner_exception/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Applies base_exception module for contacts.
1 change: 1 addition & 0 deletions partner_exception/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Custom exceptions on partner contact
Binary file added partner_exception/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading