RemiFr82
6 months ago
6 changed files with 345 additions and 29 deletions
-
1l10n_fr_association/__init__.py
-
3l10n_fr_association/__manifest__.py
-
186l10n_fr_association/i18n/fr.po
-
1l10n_fr_association/models/__init__.py
-
128l10n_fr_association/models/res_partner.py
-
55l10n_fr_association/views/res_partner.xml
@ -1 +1,2 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import models |
@ -1 +1,2 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import res_partner |
@ -1,17 +1,129 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from odoo import models, fields |
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class ResPartner(models.Model): |
|||
_inherit = "res.partner" |
|||
|
|||
# Important dates |
|||
asso_create_date = fields.Date(string="Creation date", tracking="80") |
|||
association = fields.Boolean(string="Is an association") |
|||
is_french = fields.Boolean( |
|||
string="French partner", compute="partner_is_french", store=True |
|||
) |
|||
constituent_ga_date = fields.Date( |
|||
string="Consitutent GA", |
|||
tracking="80", |
|||
help="Constituent General Assembly date", |
|||
) |
|||
prefecture_date = fields.Date( |
|||
string="Declaration date", |
|||
tracking="82", |
|||
help="Prefecture declaration date", |
|||
) |
|||
prefecture = fields.Char( |
|||
string="Prefecture", |
|||
tracking="81", |
|||
help="Prefecture (city) of declaration", |
|||
) |
|||
official_journal_date = fields.Date( |
|||
string="Official Journal", |
|||
tracking="83", |
|||
help="Official Journal publication date", |
|||
) |
|||
official_journal_dept_id = fields.Many2one( |
|||
comodel_name="res.country.department", |
|||
string="OJ department", |
|||
tracking="81", |
|||
help="Official Journal publication department", |
|||
domain=[ |
|||
( |
|||
"country_id.code", |
|||
"in", |
|||
( |
|||
"FR", |
|||
"GP", |
|||
"MQ", |
|||
"GF", |
|||
"RE", |
|||
"YT", |
|||
), |
|||
) |
|||
], |
|||
) |
|||
official_journal = fields.Char( |
|||
string="OJ reference", |
|||
tracking="81", |
|||
help="Official Journal reference", |
|||
) |
|||
company_registry_date = fields.Date( |
|||
string="Registration date", |
|||
help="Association National Register declaration date", |
|||
tracking="83", |
|||
) |
|||
company_registry = fields.Char(tracking="83") |
|||
naf_ape = fields.Char(string="NAF/APE code", tracking="83") |
|||
last_ga_date = fields.Date(string="Last general assembly", tracking="81") |
|||
# Documents fields |
|||
statuses_file = fields.Binary("Statuses file", tracking="82") |
|||
statuses_filename = fields.Char("Statuses filename") |
|||
statuses_file = fields.Binary("Statuses file") |
|||
statuses_filename = fields.Char("Statuses filename", tracking="83") |
|||
statuses_update_date = fields.Date("Statuses update", tracking="83") |
|||
internal_regul_file = fields.Binary("Statuses file", tracking="84") |
|||
internal_regul_filename = fields.Char("Statuses filename") |
|||
internal_regul_update_date = fields.Date("Internal Regul update", tracking="85") |
|||
internal_regul_file = fields.Binary("Internal Regulations file") |
|||
internal_regul_filename = fields.Char( |
|||
"Internal Regulations filename", tracking="83" |
|||
) |
|||
internal_regul_update_date = fields.Date("Internal Reg. update", tracking="85") |
|||
asso_project_file = fields.Binary("Assocation project") |
|||
asso_project_filename = fields.Char("Assocation project filename", tracking="83") |
|||
asso_project_update_date = fields.Date("Project update", tracking="83") |
|||
|
|||
@api.depends("country_id") |
|||
def partner_is_french(self): |
|||
for partner in self: |
|||
partner.is_french = partner.country_id and partner.country_id.code in ( |
|||
"FR", |
|||
"GP", |
|||
"MQ", |
|||
"GF", |
|||
"RE", |
|||
"YT", |
|||
) |
|||
|
|||
@api.onchange("is_company", "country_id") |
|||
def onchange_asso_is_french_company(self): |
|||
if self.association and (not self.is_company or not self.is_french): |
|||
self.association = False |
|||
|
|||
# @api.onchange("association") |
|||
# def onchange_association(self): |
|||
# if not self.association: |
|||
# values = {} |
|||
# if self.statuses_file: |
|||
# values.update( |
|||
# { |
|||
# "statuses_file": False, |
|||
# "statuses_filename": False, |
|||
# "statuses_update_date": False, |
|||
# } |
|||
# ) |
|||
# if self.internal_regul_file: |
|||
# values.update( |
|||
# { |
|||
# "internal_regul_file": False, |
|||
# "internal_regul_filename": False, |
|||
# "internal_regul_update_date": False, |
|||
# } |
|||
# ) |
|||
# for field in [ |
|||
# "association", |
|||
# "asso_creation_date", |
|||
# "prefecture_date", |
|||
# "prefecture", |
|||
# "official_journal_date", |
|||
# "company_registry_date", |
|||
# "company_registry", |
|||
# "naf_ape", |
|||
# "last_ga_date", |
|||
# ]: |
|||
# if getattr(self, field) != False: |
|||
# values.update({field: False}) |
|||
# if values: |
|||
# self.update(values) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue