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

[16.0][MIG] purchase_warn_message: Migration to version 16.0 #2092

Merged
merged 13 commits into from
Nov 14, 2023
Merged
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
78 changes: 78 additions & 0 deletions purchase_warn_message/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
=====================
Purchase Warn Message
=====================

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

.. |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%2Fpurchase--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-workflow/tree/16.0/purchase_warn_message
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-16-0/purchase-workflow-16-0-purchase_warn_message
: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/purchase-workflow&target_branch=16.0
:alt: Try me on Runboat

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

This module add a warning popup on purchase orders to ensure warning is
populated no only when partner is changed.

**Table of contents**

.. contents::
:local:

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

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

* Héctor Villarreal <hector.villarreal@forgeflow.com>
* Manuel Regidor <manuel.regidor@sygel.es>

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/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/16.0/purchase_warn_message>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions purchase_warn_message/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions purchase_warn_message/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2020 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Purchase Warn Message",
"summary": """
Add a popup warning on purchase to ensure warning is populated""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/purchase-workflow",
"depends": ["purchase"],
"data": ["views/purchase_order_views.xml"],
}
31 changes: 31 additions & 0 deletions purchase_warn_message/i18n/purchase_warn_message.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_warn_message
#
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: purchase_warn_message
#: model_terms:ir.ui.view,arch_db:purchase_warn_message.purchase_order_form
msgid ""
"<i class=\"fa fa-info-circle\"/>\n"
" &amp;nbsp;"
msgstr ""

#. module: purchase_warn_message
#: model:ir.model,name:purchase_warn_message.model_purchase_order
msgid "Purchase Order"
msgstr ""

#. module: purchase_warn_message
#: model:ir.model.fields,field_description:purchase_warn_message.field_purchase_order__purchase_warn_msg
msgid "Purchase Warn Msg"
msgstr ""
1 change: 1 addition & 0 deletions purchase_warn_message/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase_order
38 changes: 38 additions & 0 deletions purchase_warn_message/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright 2020 ForgeFlow S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


class PurchaseOrder(models.Model):

_inherit = "purchase.order"

purchase_warn_msg = fields.Text(compute="_compute_purchase_warn_msg")

@api.depends(
"state",
"partner_id.purchase_warn",
"partner_id.commercial_partner_id.purchase_warn",
)
def _compute_purchase_warn_msg(self):
for rec in self:
purchase_warn_msg = ""
if rec.partner_id:
if rec.state in ["done", "cancel"]:
rec.purchase_warn_msg = ""
continue

Check warning on line 24 in purchase_warn_message/models/purchase_order.py

View check run for this annotation

Codecov / codecov/patch

purchase_warn_message/models/purchase_order.py#L23-L24

Added lines #L23 - L24 were not covered by tests
p = rec.partner_id.commercial_partner_id
separator = ""
if p.purchase_warn == "warning":
separator = "\n"
purchase_warn_msg = "%(msg)s" % ({"msg": p.purchase_warn_msg})
if p != rec.partner_id and rec.partner_id.purchase_warn == "warning":
purchase_warn_msg = "%(old_msg)s%(separator)s%(msg)s" % (
{
"old_msg": purchase_warn_msg,
"separator": separator,
"msg": rec.partner_id.purchase_warn_msg,
}
)
rec.purchase_warn_msg = purchase_warn_msg or False
2 changes: 2 additions & 0 deletions purchase_warn_message/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Héctor Villarreal <hector.villarreal@forgeflow.com>
* Manuel Regidor <manuel.regidor@sygel.es>
2 changes: 2 additions & 0 deletions purchase_warn_message/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module add a warning popup on purchase orders to ensure warning is
populated no only when partner is changed.
Binary file added purchase_warn_message/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