first commit

This commit is contained in:
root
2026-03-14 09:42:12 +00:00
commit 0adbd20c2c
10991 changed files with 1646955 additions and 0 deletions

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.

Binary file not shown.

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

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>

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 "- ${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 ""
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 ""

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'})

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

View File

@@ -0,0 +1,19 @@
[tryton]
version=7.8.1
depends:
ir
party
extras_depend:
company
xml:
party.xml
address.xml
[register]
model:
party.Party
address.Address
[register company]
model:
company.Company

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>