diff --git a/beesdoo_purchase/__init__.py b/beesdoo_purchase/__init__.py index 9a7e03e..0650744 100644 --- a/beesdoo_purchase/__init__.py +++ b/beesdoo_purchase/__init__.py @@ -1 +1 @@ -from . import models \ No newline at end of file +from . import models diff --git a/beesdoo_purchase/__manifest__.py b/beesdoo_purchase/__manifest__.py index 686afc6..938e3c1 100644 --- a/beesdoo_purchase/__manifest__.py +++ b/beesdoo_purchase/__manifest__.py @@ -1,25 +1,25 @@ { - 'name': "Bees Purchase", - - 'summary': """ - Extension du module Purchase""", - - 'description': """ - Long description of module's purpose + "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', - 'security/ir.model.access.csv', - 'report/report_purchaseorder.xml', + "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/models/__init__.py b/beesdoo_purchase/models/__init__.py index cacb10c..370f577 100644 --- a/beesdoo_purchase/models/__init__.py +++ b/beesdoo_purchase/models/__init__.py @@ -1 +1 @@ -from . import purchase, purchase_order +from . import purchase diff --git a/beesdoo_purchase/models/purchase.py b/beesdoo_purchase/models/purchase.py index fe069e5..554e4b6 100644 --- a/beesdoo_purchase/models/purchase.py +++ b/beesdoo_purchase/models/purchase.py @@ -1,5 +1,6 @@ from odoo import api, fields, models + class PurchaseOrder(models.Model): _inherit = "purchase.order" @@ -7,17 +8,16 @@ class PurchaseOrder(models.Model): # 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', + comodel_name="res.users", compute="_compute_create_uid" ) supervisor_id = fields.Many2one( - comodel_name='res.users', - string='Responsible', + comodel_name="res.users", + string="Responsible", required=True, default=lambda self: self.env.user, ) - @api.depends('supervisor_id') + @api.depends("supervisor_id") def _compute_create_uid(self): for rec in self: if rec.supervisor_id: @@ -25,14 +25,17 @@ class PurchaseOrder(models.Model): @api.multi def write(self, vals): - if 'supervisor_id' in vals: - new_supervisor = vals['supervisor_id'] + 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_users( - user_ids=rec.supervisor_id.ids, + rec.message_unsubscribe( + partner_ids=rec.supervisor_id.partner_id.ids ) - rec.message_subscribe_users( - user_ids=[new_supervisor], - subtype_ids=[], + rec.message_subscribe( + partner_ids=[new_partner], subtype_ids=[] ) return super(PurchaseOrder, self).write(vals) diff --git a/beesdoo_purchase/models/purchase_order.py b/beesdoo_purchase/models/purchase_order.py deleted file mode 100644 index c572f8b..0000000 --- a/beesdoo_purchase/models/purchase_order.py +++ /dev/null @@ -1,9 +0,0 @@ -from odoo import models, fields, api - -class PurchaseOrder(models.Model): - - _inherit = 'purchase.order' - -class PurchaseOrderLine(models.Model): - - _inherit = 'purchase.order.line' diff --git a/beesdoo_purchase/report/report_purchaseorder.xml b/beesdoo_purchase/report/report_purchaseorder.xml index 99d4b67..7a4cf5d 100644 --- a/beesdoo_purchase/report/report_purchaseorder.xml +++ b/beesdoo_purchase/report/report_purchaseorder.xml @@ -7,7 +7,7 @@
Your Referent:
+ t-options='{"widget": "contact", "fields": ["name", "phone", "mobile"], "no_marker": true, "phone_icons": true}'/>
diff --git a/beesdoo_purchase/security/ir.model.access.csv b/beesdoo_purchase/security/ir.model.access.csv deleted file mode 100644 index 58262d4..0000000 --- a/beesdoo_purchase/security/ir.model.access.csv +++ /dev/null @@ -1 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink \ No newline at end of file