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_order_responsible #525

Merged
merged 9 commits into from
Dec 15, 2023
Merged
71 changes: 71 additions & 0 deletions purchase_order_responsible/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
==========================
Purchase Order Responsible
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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-beescoop%2FObeesdoo-lightgray.png?logo=github
:target: https://github.com/beescoop/Obeesdoo/tree/12.0/purchase_order_responsible
:alt: beescoop/Obeesdoo

|badge1| |badge2| |badge3|

- Adds a 'Responsible' field to purchase orders:
This is a user who will follow up the order. This users replaces
the creator in the order's mail messages followers list, and in the
create_uid ORM field. His user's contact info is printed on
purchases orders as 'Referent'.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/beescoop/Obeesdoo/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/beescoop/Obeesdoo/issues/new?body=module:%20purchase_order_responsible%0Aversion:%2012.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
~~~~~~~

* Coop IT Easy SC

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

* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Victor Champonnois

Maintainers
~~~~~~~~~~~

.. |maintainer-victor-champonnois| image:: https://github.com/victor-champonnois.png?size=40px
:target: https://github.com/victor-champonnois
:alt: victor-champonnois

Current maintainer:

|maintainer-victor-champonnois|

This module is part of the `beescoop/Obeesdoo <https://github.com/beescoop/Obeesdoo/tree/12.0/purchase_order_responsible>`_ project on GitHub.

You are welcome to contribute.
4 changes: 4 additions & 0 deletions purchase_order_responsible/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-FileCopyrightText: 2022 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later
from . import models
26 changes: 26 additions & 0 deletions purchase_order_responsible/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# SPDX-FileCopyrightText: 2022 Coop IT Easy SC
#
# SPDX-License-Identifier: AGPL-3.0-or-later

{
"name": "Purchase Order Responsible",
"summary": """
Adds a 'Responsible' field to purchase orders""",
"version": "16.0.1.0.0",
"category": "Purchase",
"website": "https://github.com/beescoop/Obeesdoo",
"author": "Coop IT Easy SC",
"maintainers": ["victor-champonnois"],
"license": "AGPL-3",
"application": False,
"depends": [
"purchase",
],
"excludes": [],
"data": [
"views/purchase_order.xml",
"report/report_purchaseorder.xml",
],
"demo": [],
"qweb": [],
}
35 changes: 35 additions & 0 deletions purchase_order_responsible/i18n/purchase_order_responsible.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_order_responsible
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.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_order_responsible
#: model_terms:ir.ui.view,arch_db:purchase_order_responsible.report_purchaseorder_document
msgid "<strong>Your Referent:</strong>"
msgstr ""

#. module: purchase_order_responsible
#: model:ir.model.fields,field_description:purchase_order_responsible.field_purchase_order__create_uid
msgid "Create Uid"
msgstr ""

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

#. module: purchase_order_responsible
#: model:ir.model.fields,field_description:purchase_order_responsible.field_purchase_order__supervisor_id
msgid "Responsible"
msgstr ""

1 change: 1 addition & 0 deletions purchase_order_responsible/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import purchase
35 changes: 35 additions & 0 deletions purchase_order_responsible/models/purchase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from odoo import api, fields, models


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

# create_uid must mirror the supervisor_id value.
# create_uid is a magic field that belongs to the ORM that is not
# editable via a form.
create_uid = fields.Many2one(
comodel_name="res.users", compute="_compute_create_uid"
)
# todo: rename to responsible_id
supervisor_id = fields.Many2one(
comodel_name="res.users",
string="Responsible",
required=True,
default=lambda self: self.env.user,
)

@api.depends("supervisor_id")
def _compute_create_uid(self):
for rec in self:
if rec.supervisor_id:
rec.create_uid = rec.supervisor_id

def write(self, vals):
if "supervisor_id" in vals:
new_partner = (
self.env["res.users"].browse(vals["supervisor_id"]).partner_id.id
)
for rec in self:
rec.message_unsubscribe(partner_ids=rec.supervisor_id.partner_id.ids)
rec.message_subscribe(partner_ids=[new_partner], subtype_ids=[])
return super(PurchaseOrder, self).write(vals)
3 changes: 3 additions & 0 deletions purchase_order_responsible/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Coop IT Easy SC <https://coopiteasy.be>`_:

* Victor Champonnois
5 changes: 5 additions & 0 deletions purchase_order_responsible/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Adds a 'Responsible' field to purchase orders:
This is a user who will follow up the order. This users replaces
the creator in the order's mail messages followers list, and in the
create_uid ORM field. His user's contact info is printed on
purchases orders as 'Referent'.
21 changes: 21 additions & 0 deletions purchase_order_responsible/report/report_purchaseorder.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="report_purchaseorder_document"
inherit_id="purchase.report_purchaseorder_document"
name="beesdoo purchaseorder"
>
<div t-elif="o.date_order" position="after">

<div t-if="o.create_uid.name" class="col-xs-3 bm-2">
<strong>Your Referent:</strong>
<p
t-field="o.create_uid"
t-options='{"widget": "contact", "fields": ["name", "phone", "mobile"], "no_marker": true, "phone_icons": true}'
class="m-0"
/>
</div>

</div>
</template>
</odoo>
Loading
Loading