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