Browse Source

[ADD] l10n_fr_department_state

16.0
RemiFr82 7 months ago
parent
commit
62b0d230cd
  1. 2
      l10n_fr_department_state/__init__.py
  2. 37
      l10n_fr_department_state/__manifest__.py
  3. 27
      l10n_fr_department_state/i18n/fr.po
  4. 2
      l10n_fr_department_state/models/__init__.py
  5. 22
      l10n_fr_department_state/models/res_partner.py
  6. 19
      l10n_fr_department_state/views/res_partner.xml

2
l10n_fr_department_state/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

37
l10n_fr_department_state/__manifest__.py

@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
"name": "Partner department state",
"version": "1.0.0",
"summary": "Get state from department (FR)",
"description": "",
"author": "RemiFr82",
"contributors": "",
"maintainer": "RemiFr82",
"website": "https://remifr82.me",
"license": "LGPL-3",
"category": "",
# "price": 0,
# "currency": "EUR",
"application": False,
"installable": True,
"auto_install": False,
# "pre_init_hook": "",
# "post_init_hook": "",
# "uninstall_hook": "",
# "excludes": [],
# "external_dependencies": [],
"depends": [
"l10n_fr_department",
],
"data": [
# Views
"views/res_partner.xml",
],
# "assets": [],
# "css": [],
# "images": [],
# "js": [],
# "test": [],
# "demo": [],
}

27
l10n_fr_department_state/i18n/fr.po

@ -0,0 +1,27 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * l10n_fr_department_state
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0-20230613\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-26 14:23+0000\n"
"PO-Revision-Date: 2024-05-26 14:23+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: l10n_fr_department_state
#: model:ir.model,name:l10n_fr_department_state.model_res_partner
msgid "Contact"
msgstr ""
#. module: l10n_fr_department_state
#: model:ir.model.fields,field_description:l10n_fr_department_state.field_res_partner__state_id
#: model:ir.model.fields,field_description:l10n_fr_department_state.field_res_users__state_id
msgid "State"
msgstr "Région"

2
l10n_fr_department_state/models/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import res_partner

22
l10n_fr_department_state/models/res_partner.py

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
import logging
from odoo import models, fields, api, tools
_logger = logging.getLogger(__name__)
class ResPartner(models.Model):
_inherit = "res.partner"
state_id = fields.Many2one(
compute="_compute_country_depatemnt",
store=True,
)
@api.depends("country_department_id")
def _compute_country_depatemnt(self):
for partner in self:
dept = partner.country_department_id
dept_stat = dept.state_id
if dept and dept_stat and not partner.state_id:
partner.state_id = dept_stat

19
l10n_fr_department_state/views/res_partner.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_partner_form_inherit_base" model="ir.ui.view">
<field name="name">res.partner.view.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<field name="state_id" position="attributes">
<attribute name="attrs">{'readonly':[('country_department_id','!=',False)]}</attribute>
<attribute name="options">{'no_open':1}</attribute>
</field>
<field name="country_department_id" position="attributes">
<attribute name="options">{'no_open':1}</attribute>
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save