[IMP] mail_activity_creator black, isort, prettier
This commit is contained in:
parent
ec0465939c
commit
5f61826c36
@ -2,20 +2,14 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Mail Activity Creator',
|
||||
'summary': """
|
||||
"name": "Mail Activity Creator",
|
||||
"summary": """
|
||||
Show activities creator""",
|
||||
'version': '11.0.1.0.0',
|
||||
'license': 'AGPL-3',
|
||||
'author': 'Creu Blanca,Odoo Community Association (OCA)',
|
||||
'website': 'https://github.com/OCA/social',
|
||||
'depends': [
|
||||
'mail'
|
||||
],
|
||||
'data': [
|
||||
'views/mail_activity_views.xml',
|
||||
],
|
||||
'qweb': [
|
||||
'static/src/xml/activity.xml',
|
||||
],
|
||||
"version": "11.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Creu Blanca,Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/social",
|
||||
"depends": ["mail"],
|
||||
"data": ["views/mail_activity_views.xml"],
|
||||
"qweb": ["static/src/xml/activity.xml"],
|
||||
}
|
||||
|
@ -6,10 +6,8 @@ from odoo import fields, models
|
||||
|
||||
class MailActivity(models.Model):
|
||||
|
||||
_inherit = 'mail.activity'
|
||||
_inherit = "mail.activity"
|
||||
|
||||
creator_uid = fields.Many2one(
|
||||
'res.users',
|
||||
default=lambda r: r.env.user.id,
|
||||
string="Creator",
|
||||
"res.users", default=lambda r: r.env.user.id, string="Creator",
|
||||
)
|
||||
|
@ -1,12 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<templates>
|
||||
<t t-extend="mail.activity_items">
|
||||
<t t-jquery="dd.mb8:first" t-operation="after">
|
||||
<dt>Creator</dt>
|
||||
<dd class="mb8">
|
||||
<img t-attf-src="/web/image#{activity.creator_uid[0] >= 0 ? ('/res.users/' + activity.creator_uid[0] + '/image_small') : ''}"
|
||||
height="18" width="18" class="rounded-circle mr4" t-att-title="activity.creator_uid[1]" t-att-alt="activity.creator_uid[1]"/>
|
||||
<b><t t-esc="activity.creator_uid[1]"/></b>
|
||||
<img
|
||||
t-attf-src="/web/image#{activity.creator_uid[0] >= 0 ? ('/res.users/' + activity.creator_uid[0] + '/image_small') : ''}"
|
||||
height="18"
|
||||
width="18"
|
||||
class="rounded-circle mr4"
|
||||
t-att-title="activity.creator_uid[1]"
|
||||
t-att-alt="activity.creator_uid[1]"
|
||||
/>
|
||||
<b><t t-esc="activity.creator_uid[1]" /></b>
|
||||
</dd>
|
||||
</t>
|
||||
</t>
|
||||
|
@ -1,38 +1,45 @@
|
||||
# Copyright 2020 Creu Blanca
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.models import SUPERUSER_ID
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestCreator(TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.partner = self.env['res.partner'].create({
|
||||
'name': 'DEMO'
|
||||
})
|
||||
self.user_01 = self.env['res.users'].create({
|
||||
'name': 'user_01',
|
||||
'login': 'demo_user_01',
|
||||
'email': 'demo@demo.de',
|
||||
'notification_type': 'inbox',
|
||||
})
|
||||
self.model_id = self.env['ir.model']._get('res.partner').id
|
||||
self.activity_type = self.env['mail.activity.type'].create({
|
||||
'name': 'Initial Contact',
|
||||
'days': 5,
|
||||
'summary': 'ACT 1 : Presentation, barbecue, ... ',
|
||||
'res_model_id': self.model_id,
|
||||
})
|
||||
self.partner = self.env["res.partner"].create({"name": "DEMO"})
|
||||
self.user_01 = self.env["res.users"].create(
|
||||
{
|
||||
"name": "user_01",
|
||||
"login": "demo_user_01",
|
||||
"email": "demo@demo.de",
|
||||
"notification_type": "inbox",
|
||||
}
|
||||
)
|
||||
self.model_id = self.env["ir.model"]._get("res.partner").id
|
||||
self.activity_type = self.env["mail.activity.type"].create(
|
||||
{
|
||||
"name": "Initial Contact",
|
||||
"days": 5,
|
||||
"summary": "ACT 1 : Presentation, barbecue, ... ",
|
||||
"res_model_id": self.model_id,
|
||||
}
|
||||
)
|
||||
|
||||
def test_activity_creator(self):
|
||||
activity = self.env['mail.activity'].sudo(self.user_01.id).create({
|
||||
'activity_type_id': self.activity_type.id,
|
||||
'note': 'Partner activity 3.',
|
||||
'res_id': self.partner.id,
|
||||
'res_model_id': self.model_id,
|
||||
'user_id': self.user_01.id
|
||||
})
|
||||
activity = (
|
||||
self.env["mail.activity"]
|
||||
.sudo(self.user_01.id)
|
||||
.create(
|
||||
{
|
||||
"activity_type_id": self.activity_type.id,
|
||||
"note": "Partner activity 3.",
|
||||
"res_id": self.partner.id,
|
||||
"res_model_id": self.model_id,
|
||||
"user_id": self.user_01.id,
|
||||
}
|
||||
)
|
||||
)
|
||||
self.assertEqual(activity.creator_uid, self.user_01)
|
||||
self.assertEqual(activity.create_uid.id, SUPERUSER_ID)
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
<record id="mail_activity_view_form_popup" model="ir.ui.view">
|
||||
<field name="name">mail.activity.form.activity</field>
|
||||
<field name="model">mail.activity</field>
|
||||
<field name="inherit_id" ref="mail.mail_activity_view_form_popup"/>
|
||||
<field name="inherit_id" ref="mail.mail_activity_view_form_popup" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="user_id" position="after">
|
||||
<field name="creator_uid" readonly="1"/>
|
||||
<field name="creator_uid" readonly="1" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
Loading…
x
Reference in New Issue
Block a user