diff --git a/beesdoo_purchase/__init__.py b/beesdoo_purchase/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/beesdoo_purchase/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/beesdoo_purchase/__manifest__.py b/beesdoo_purchase/__manifest__.py new file mode 100644 index 0000000..938e3c1 --- /dev/null +++ b/beesdoo_purchase/__manifest__.py @@ -0,0 +1,25 @@ +{ + "name": "Bees Purchase", + "summary": """ + Extends Purchase module. + """, + "description": """ + Extends Purchase module: + - 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'. + - A filter w.r.t. the mail sellers is placed on the products field of a + purchase order. + """, + "author": "Beescoop - Cellule IT, " "Coop IT Easy SCRLfs", + "website": "https://github.com/beescoop/Obeesdoo", + "category": "Purchase", + "version": "12.0.1.1.0", + "depends": ["base", "purchase", "beesdoo_product"], + "data": [ + "views/purchase_order.xml", + "report/report_purchaseorder.xml", + ], +} diff --git a/beesdoo_purchase/i18n/fr_BE.po b/beesdoo_purchase/i18n/fr_BE.po new file mode 100644 index 0000000..cd16936 --- /dev/null +++ b/beesdoo_purchase/i18n/fr_BE.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * beesdoo_purchase +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 9.0c\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2016-11-13 15:25+0000\n" +"PO-Revision-Date: 2016-11-13 15:25+0000\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: beesdoo_purchase +#: model:ir.model,name:beesdoo_purchase.model_purchase_order +msgid "Purchase Order" +msgstr "Commande fournisseur" + diff --git a/beesdoo_purchase/models/__init__.py b/beesdoo_purchase/models/__init__.py new file mode 100644 index 0000000..370f577 --- /dev/null +++ b/beesdoo_purchase/models/__init__.py @@ -0,0 +1 @@ +from . import purchase diff --git a/beesdoo_purchase/models/purchase.py b/beesdoo_purchase/models/purchase.py new file mode 100644 index 0000000..554e4b6 --- /dev/null +++ b/beesdoo_purchase/models/purchase.py @@ -0,0 +1,41 @@ +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" + ) + 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 + + @api.multi + 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) diff --git a/beesdoo_purchase/report/report_purchaseorder.xml b/beesdoo_purchase/report/report_purchaseorder.xml new file mode 100644 index 0000000..7a4cf5d --- /dev/null +++ b/beesdoo_purchase/report/report_purchaseorder.xml @@ -0,0 +1,16 @@ + + + + + + diff --git a/beesdoo_purchase/views/purchase_order.xml b/beesdoo_purchase/views/purchase_order.xml new file mode 100644 index 0000000..71c0f81 --- /dev/null +++ b/beesdoo_purchase/views/purchase_order.xml @@ -0,0 +1,39 @@ + + + + beesdoo.purchase.order.form.view + purchase.order + + + + + + + [('main_seller_id','=', parent.partner_id), ('purchase_ok', '=', True)] + + + + + + beesdoo.purchase.order.tree.view + purchase.order + + + + + + + + + + beesdoo.purchase.order.search.view + purchase.order + + + + + + + + +