first commit
This commit is contained in:
2
modules/party_avatar/__init__.py
Normal file
2
modules/party_avatar/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
BIN
modules/party_avatar/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
modules/party_avatar/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
BIN
modules/party_avatar/__pycache__/company.cpython-311.pyc
Normal file
BIN
modules/party_avatar/__pycache__/company.cpython-311.pyc
Normal file
Binary file not shown.
BIN
modules/party_avatar/__pycache__/party.cpython-311.pyc
Normal file
BIN
modules/party_avatar/__pycache__/party.cpython-311.pyc
Normal file
Binary file not shown.
BIN
modules/party_avatar/__pycache__/res.cpython-311.pyc
Normal file
BIN
modules/party_avatar/__pycache__/res.cpython-311.pyc
Normal file
Binary file not shown.
26
modules/party_avatar/company.py
Normal file
26
modules/party_avatar/company.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.i18n import lazy_gettext
|
||||
from trytond.model import fields
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class Company(metaclass=PoolMeta):
|
||||
__name__ = 'company.company'
|
||||
|
||||
avatar_url = fields.Function(
|
||||
fields.Char(lazy_gettext('ir.msg_avatar_url')), 'get_avatar_url')
|
||||
|
||||
def get_avatar_url(self, name):
|
||||
return self.party.avatar_url
|
||||
|
||||
|
||||
class Employee(metaclass=PoolMeta):
|
||||
__name__ = 'company.employee'
|
||||
|
||||
avatar_url = fields.Function(
|
||||
fields.Char(lazy_gettext('ir.msg_avatar_url')), 'get_avatar_url')
|
||||
|
||||
def get_avatar_url(self, name):
|
||||
return self.party.avatar_url
|
||||
18
modules/party_avatar/company.xml
Normal file
18
modules/party_avatar/company.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data depends="company">
|
||||
<record model="ir.ui.view" id="company_view_list">
|
||||
<field name="model">company.company</field>
|
||||
<field name="inherit" ref="company.company_view_list"/>
|
||||
<field name="name">company_list</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="employee_view_list">
|
||||
<field name="model">company.employee</field>
|
||||
<field name="inherit" ref="company.employee_view_tree"/>
|
||||
<field name="name">employee_list</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
3
modules/party_avatar/locale/bg.po
Normal file
3
modules/party_avatar/locale/bg.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/ca.po
Normal file
3
modules/party_avatar/locale/ca.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/cs.po
Normal file
3
modules/party_avatar/locale/cs.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/de.po
Normal file
3
modules/party_avatar/locale/de.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/es.po
Normal file
3
modules/party_avatar/locale/es.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/es_419.po
Normal file
3
modules/party_avatar/locale/es_419.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/et.po
Normal file
3
modules/party_avatar/locale/et.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/fa.po
Normal file
3
modules/party_avatar/locale/fa.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/fi.po
Normal file
3
modules/party_avatar/locale/fi.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/fr.po
Normal file
3
modules/party_avatar/locale/fr.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/hu.po
Normal file
3
modules/party_avatar/locale/hu.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/id.po
Normal file
3
modules/party_avatar/locale/id.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/it.po
Normal file
3
modules/party_avatar/locale/it.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/lo.po
Normal file
3
modules/party_avatar/locale/lo.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/lt.po
Normal file
3
modules/party_avatar/locale/lt.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/nl.po
Normal file
3
modules/party_avatar/locale/nl.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/pl.po
Normal file
3
modules/party_avatar/locale/pl.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/pt.po
Normal file
3
modules/party_avatar/locale/pt.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/ro.po
Normal file
3
modules/party_avatar/locale/ro.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/ru.po
Normal file
3
modules/party_avatar/locale/ru.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/sl.po
Normal file
3
modules/party_avatar/locale/sl.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/tr.po
Normal file
3
modules/party_avatar/locale/tr.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/uk.po
Normal file
3
modules/party_avatar/locale/uk.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
3
modules/party_avatar/locale/zh_CN.po
Normal file
3
modules/party_avatar/locale/zh_CN.po
Normal file
@@ -0,0 +1,3 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
9
modules/party_avatar/party.py
Normal file
9
modules/party_avatar/party.py
Normal file
@@ -0,0 +1,9 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.model import avatar_mixin
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class Party(avatar_mixin(200, 'name'), metaclass=PoolMeta):
|
||||
__name__ = 'party.party'
|
||||
18
modules/party_avatar/party.xml
Normal file
18
modules/party_avatar/party.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="party_view_tree">
|
||||
<field name="model">party.party</field>
|
||||
<field name="inherit" ref="party.party_view_tree"/>
|
||||
<field name="name">party_list</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="party_view_form">
|
||||
<field name="model">party.party</field>
|
||||
<field name="inherit" ref="party.party_view_form"/>
|
||||
<field name="name">party_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
14
modules/party_avatar/res.py
Normal file
14
modules/party_avatar/res.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class User(metaclass=PoolMeta):
|
||||
__name__ = 'res.user'
|
||||
|
||||
def get_avatar_badge_url(self, name):
|
||||
url = super().get_avatar_badge_url(name)
|
||||
if self.company:
|
||||
url = self.company.avatar_url
|
||||
return url
|
||||
2
modules/party_avatar/tests/__init__.py
Normal file
2
modules/party_avatar/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
BIN
modules/party_avatar/tests/__pycache__/__init__.cpython-311.pyc
Normal file
BIN
modules/party_avatar/tests/__pycache__/__init__.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
18
modules/party_avatar/tests/test_module.py
Normal file
18
modules/party_avatar/tests/test_module.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
try:
|
||||
from trytond.modules.company.tests import CompanyTestMixin
|
||||
except ImportError:
|
||||
class CompanyTestMixin:
|
||||
pass
|
||||
from trytond.tests.test_tryton import ModuleTestCase
|
||||
|
||||
|
||||
class PartyAvatarTestCase(CompanyTestMixin, ModuleTestCase):
|
||||
'Test Party Avatar module'
|
||||
module = 'party_avatar'
|
||||
extras = ['company']
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
21
modules/party_avatar/tryton.cfg
Normal file
21
modules/party_avatar/tryton.cfg
Normal file
@@ -0,0 +1,21 @@
|
||||
[tryton]
|
||||
version=7.8.0
|
||||
depends:
|
||||
ir
|
||||
party
|
||||
res
|
||||
extras_depend:
|
||||
company
|
||||
xml:
|
||||
party.xml
|
||||
company.xml
|
||||
|
||||
[register]
|
||||
model:
|
||||
party.Party
|
||||
|
||||
[register company]
|
||||
model:
|
||||
company.Company
|
||||
company.Employee
|
||||
res.User
|
||||
8
modules/party_avatar/view/company_list.xml
Normal file
8
modules/party_avatar/view/company_list.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="//field[@name='party']" position="inside">
|
||||
<prefix id="avatar" icon="avatar_url" icon_type="url" url_size="s" border="rounded"/>
|
||||
</xpath>
|
||||
</data>
|
||||
8
modules/party_avatar/view/employee_list.xml
Normal file
8
modules/party_avatar/view/employee_list.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="//field[@name='party']" position="inside">
|
||||
<prefix id="avatar" icon="avatar_url" icon_type="url" url_size="s" border="circle"/>
|
||||
</xpath>
|
||||
</data>
|
||||
8
modules/party_avatar/view/party_form.xml
Normal file
8
modules/party_avatar/view/party_form.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="//group[@id='header']" position="after">
|
||||
<field name="avatar" widget="image" height="100" width="100" xexpand="0" border="circle"/>
|
||||
</xpath>
|
||||
</data>
|
||||
8
modules/party_avatar/view/party_list.xml
Normal file
8
modules/party_avatar/view/party_list.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="//field[@name='name']" position="inside">
|
||||
<prefix id="avatar" icon="avatar_url" icon_type="url" url_size="s" border="circle"/>
|
||||
</xpath>
|
||||
</data>
|
||||
Reference in New Issue
Block a user