Browse Source

[ADD] crock_base module

16.0
RemiFr82 6 months ago
parent
commit
c69b862597
  1. 1
      crock_base/__init__.py
  2. 53
      crock_base/__manifest__.py
  3. 27
      crock_base/data/res_partner.xml
  4. 1
      crock_base/models/__init__.py
  5. 35
      crock_base/models/res_partner.py
  6. BIN
      crock_base/static/description/icon.png
  7. 8
      crock_base/views/res_partner.xml

1
crock_base/__init__.py

@ -0,0 +1 @@
from . import models

53
crock_base/__manifest__.py

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "CROCK Base",
"version": "1.0.0",
"summary": """
TODO
""",
"description": """
""",
"author": "RemiFr82",
"website": "https://remifr82.me",
"license": "AGPL-3",
"category": "Technical",
"depends": [
"base",
"contacts",
"ffck_commons",
"l10n_fr_department_oversea",
],
"data": [
# Base data
# "data/ir_model.xml",
# Security
# 'security/res_groups.xml',
# 'security/ir.model.access.csv',
# 'security/ir_rule.xml',
# Views
"views/res_partner.xml",
# Wizards
# 'wizards/transient_model.xml',
# Reports
# 'reports/report_assets.xml',
# 'reports/report_templates.xml',
# 'reports/sql_view.xml',
],
# 'assets': {
# 'web.report_assets_common': [
# 'ffck_color_paddles/static/src/scss/report_pdf.scss',
# ],
# },
"demo": [],
"auto_install": False,
"external_dependencies": [],
"application": True,
"css": [],
"images": [],
"installable": True,
"maintainer": "RemiFr82",
"pre_init_hook": "",
"post_init_hook": "",
"uninstall_hook": "",
}

27
crock_base/data/res_partner.xml

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="res_partner_cdck09" model="res.partner">
<!-- Main data -->
<field name="name">Comité Départemental de CK&amp;SP de l'Ariège</field>
<field name="is_company" eval="True" />
<field name="street"></field>
<field name="street2"></field>
<field name="zip"></field>
<field name="city"></field>
<field name="department_id" ref=" l10n_fr_department.res_country_department_ariege" />
<field name="state_id" ref="l10n_fr_state.res_country_state_languedocroussillon" />
<field name="country_id" ref="base.fr" />
<field name="vat"></field>
<field name="phone"></field>
<field name="email"></field>
<field name="website"></field>
<!-- FFCK data -->
<!-- Notebook data -->
<field name="ref">CDCK 09</field>
</record>
</data>
</odoo>

1
crock_base/models/__init__.py

@ -0,0 +1 @@
from . import res_partner

35
crock_base/models/res_partner.py

@ -0,0 +1,35 @@
from odoo import models, api
class ResPartner(models.Model):
_inherit = "res.partner"
_order = "is_company desc, country_id, department_id, display_name, id"
@api.onchange("state_id")
def _onchange_state_id(self):
state = self.state_id
if state:
if self.partner_scale in ["dept", "loc"]:
crck = self.search(
[("partner_scale", "=", "reg"), ("state_id", "=", state)], limit=1
)
if crck and crck != self.crck_partner_id:
main = self.env.ref("base.main_partner")
if self.crck_partner_id != main:
self.crck_partner_id = main
elif self.partner_scale == "reg":
self.crck_partner_id = self
@api.onchange("department_id")
def _onchange_department_id(self):
dept = self.department_id
if dept and self.partner_scale == "loc":
cdck = self.search(
[("partner_scale", "=", "dep"), ("department_id", "=", dept)], limit=1
)
if cdck and cdck != self.cdck_partner_id:
main = self.env.ref("base.main_partner")
if self.cdck_partner_id != main:
self.cdck_partner_id = main
elif self.partner_scale == "dep":
self.cdck_partner_id = self

BIN
crock_base/static/description/icon.png

After

Width: 1024  |  Height: 1024  |  Size: 174 KiB

8
crock_base/views/res_partner.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="contacts.action_contacts" model="ir.actions.act_window">
<field name="context">{'default_is_company': True, 'search_default_country_department_groupby': 1}</field>
</record>
</odoo>
Loading…
Cancel
Save