Initial import from Docker volume

This commit is contained in:
root
2025-12-26 13:11:43 +00:00
commit 4998dc066a
13336 changed files with 1767801 additions and 0 deletions

16
modules/party_siret/__init__.py Executable file
View File

@@ -0,0 +1,16 @@
# 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 Pool
from . import address, company, party
def register():
Pool.register(
party.Party,
address.Address,
module='party_siret', type_='model')
Pool.register(
company.Company,
module='party_siret', type_='model', depends=['company'])

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

88
modules/party_siret/address.py Executable file
View File

@@ -0,0 +1,88 @@
# 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 sql import Literal, Null
from sql.operators import Concat
from trytond.model import fields
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
class Address(metaclass=PoolMeta):
__name__ = 'party.address'
siret = fields.Function(fields.Many2One(
'party.identifier', "SIRET"),
'get_siret', searcher='search_siret')
@classmethod
def __register__(cls, module):
pool = Pool()
Party = pool.get('party.party')
Identifier = pool.get('party.identifier')
cursor = Transaction().connection.cursor()
party = Party.__table__()
address = cls.__table__()
identifier = Identifier.__table__()
super().__register__(module)
table_h = cls.__table_handler__(module)
party_h = Party.__table_handler__(module)
# Migrate from 6.2: replace siren and siret by identifier
if party_h.column_exist('siren'):
cursor.execute(*identifier.insert(
[identifier.party,
identifier.type, identifier.code,
identifier.active],
party.select(
party.id, Literal('fr_siren'),
party.siren, party.active,
where=(party.siren != Null)
& (party.siren != ''))))
if table_h.column_exist('siret_nic'):
cursor.execute(*identifier.insert(
[identifier.party, identifier.address,
identifier.type, identifier.code,
identifier.active],
address.join(
party, condition=address.party == party.id
).select(
address.party, address.id,
Literal('fr_siret'),
Concat(party.siren, address.siret_nic),
address.active,
where=(address.siret_nic != Null)
& (address.siret_nic != '')
& (party.siren != Null)
& (party.siren != ''))))
table_h.drop_column('siret_nic')
party_h.drop_column('siren')
def get_siret(self, name):
for identifier in self.identifiers:
if identifier.type == 'fr_siret':
return identifier.id
@classmethod
def search_siret(cls, name, clause):
_, operator, value = clause
nested = clause[0][len(name) + 1:]
domain = [
('identifiers', 'where', [
(nested or 'rec_name', operator, value),
('type', '=', 'fr_siren'),
]),
]
# Add party without tax identifier
if ((operator == '=' and value is None)
or (operator == 'in' and None in value)):
domain = ['OR',
domain, [
('identifiers', 'not where', [
('type', '=', 'fr_siren'),
]),
],
]
return domain

12
modules/party_siret/address.xml Executable file
View File

@@ -0,0 +1,12 @@
<?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="address_view_tree">
<field name="model">party.address</field>
<field name="inherit" ref="party.address_view_tree"/>
<field name="name">address_tree</field>
</record>
</data>
</tryton>

21
modules/party_siret/company.py Executable file
View File

@@ -0,0 +1,21 @@
# 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 Company(metaclass=PoolMeta):
__name__ = 'company.company'
@classmethod
def __setup__(cls):
super().__setup__()
cls.header.help += "- ${siren}\n"
cls.footer.help += "- ${siren}\n"
@property
def _substitutions(self):
substitutions = super()._substitutions
siren = self.party.siren
substitutions['siren'] = siren.code if siren else ''
return substitutions

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr "- ${siren}\n"
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr "- ${siren}\n"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr "- ${siren}\n"
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr "- ${siren}\n"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr "- ${siren}\n"
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr "- ${siren}\n"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr "- ${siren}\n"
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr "- ${siren}\n"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr "- ${sirene}\n"
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr "- ${sirene}\n"

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr "SIRET"
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr "SIREN"
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

View File

@@ -0,0 +1,19 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:party.address,siret:"
msgid "SIRET"
msgstr ""
msgctxt "field:party.party,siren:"
msgid "SIREN"
msgstr ""
msgctxt "help:company.company,footer:"
msgid "- ${siren}\n"
msgstr ""
msgctxt "help:company.company,header:"
msgid "- ${siren}\n"
msgstr ""

19
modules/party_siret/party.py Executable file
View File

@@ -0,0 +1,19 @@
# 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 fields
from trytond.pool import PoolMeta
class Party(metaclass=PoolMeta):
__name__ = 'party.party'
siren = fields.Function(fields.Many2One(
'party.identifier', "SIREN"),
'get_siren', searcher='search_siren')
def get_siren(self, name):
return self._get_identifier(name, {'fr_siren'})
@classmethod
def search_siren(cls, name, clause):
return cls._search_identifier(name, clause, {'fr_siren'})

12
modules/party_siret/party.xml Executable file
View File

@@ -0,0 +1,12 @@
<?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_tree</field>
</record>
</data>
</tryton>

View 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.

View File

@@ -0,0 +1,12 @@
# 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.tests.test_tryton import ModuleTestCase
class PartySiretTestCase(ModuleTestCase):
'Test PartySiret module'
module = 'party_siret'
del ModuleTestCase

10
modules/party_siret/tryton.cfg Executable file
View File

@@ -0,0 +1,10 @@
[tryton]
version=7.2.2
depends:
ir
party
extras_depend:
company
xml:
party.xml
address.xml

View 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="/tree/field[@name='party']" position="after">
<field name="siret" optional="1"/>
</xpath>
</data>

View 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="/tree/field[@name='tax_identifier']" position="after">
<field name="siren" optional="1"/>
</xpath>
</data>