RemiFr82
6 months ago
7 changed files with 229 additions and 35 deletions
-
2ffck_commons/data/ffck_structure_type.xml
-
47ffck_commons/i18n/fr.po
-
1ffck_commons/models/__init__.py
-
127ffck_commons/models/res_partner.py
-
44ffck_commons/models/res_partner_hierarchy.py
-
5ffck_commons/security/ir.model.access.csv
-
38ffck_commons/views/res_partner.xml
@ -1,3 +1,4 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from . import res_partner_hierarchy |
|||
from . import ffck_structure_type |
|||
from . import res_partner |
@ -0,0 +1,44 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from odoo import models, fields, tools |
|||
|
|||
|
|||
class ResPartnerRoot(models.Model): |
|||
_name = "res.partner.hierarchy" |
|||
_description = "Partners hierarchy" |
|||
_auto = False |
|||
|
|||
name = fields.Char() |
|||
active = fields.Boolean() |
|||
parent_id = fields.Many2one("res.partner.hierarchy") |
|||
|
|||
def init(self): |
|||
tools.drop_view_if_exists(self.env.cr, self._table) |
|||
self.env.cr.execute( |
|||
""" |
|||
CREATE OR REPLACE VIEW %s AS ( |
|||
SELECT DISTINCT id AS id, |
|||
active as active, |
|||
CONCAT(partner_code, ' - ', ref) AS name, |
|||
NULL::int AS parent_id |
|||
FROM res_partner WHERE partner_code IS NOT NULL AND ffck_network IS TRUE AND partner_scale = '1' AND (ref IS NOT NULL OR name IS NOT NULL) |
|||
UNION ALL |
|||
SELECT DISTINCT id AS id, |
|||
active as active, |
|||
CONCAT(partner_code, ' - ', ref) AS name, |
|||
ffck_partner_id AS parent_id |
|||
FROM res_partner WHERE partner_code IS NOT NULL AND ffck_network IS TRUE AND partner_scale = '2' AND (ref IS NOT NULL OR name IS NOT NULL) |
|||
UNION ALL |
|||
SELECT DISTINCT id AS id, |
|||
active as active, |
|||
CONCAT(partner_code, ' - ', ref) AS name, |
|||
crck_partner_id AS parent_id |
|||
FROM res_partner WHERE partner_code IS NOT NULL AND ffck_network IS TRUE AND partner_scale = '3' AND (ref IS NOT NULL OR name IS NOT NULL) |
|||
UNION ALL |
|||
SELECT DISTINCT id AS id, |
|||
active as active, |
|||
CONCAT(partner_code, ' - ', ref) AS name, |
|||
cdck_partner_id AS parent_id |
|||
FROM res_partner WHERE partner_code IS NOT NULL AND ffck_network IS TRUE AND partner_scale = '4' AND (ref IS NOT NULL OR name IS NOT NULL) |
|||
)""" |
|||
% (self._table,) |
|||
) |
@ -1,3 +1,4 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
access_ir_model_all,All ffck.structure.type,ffck_commons.model_ffck_structure_type,,1,0,0,0 |
|||
access_ir_model_group_partner_manager,Partner manager ffck.structure.type,ffck_commons.model_ffck_structure_type,base.group_partner_manager,1,1,1,0 |
|||
access_ffck_structure_type_all,All ffck.structure.type,ffck_commons.model_ffck_structure_type,,1,0,0,0 |
|||
access_ffck_structure_type_group_partner_manager,Partner manager ffck.structure.type,ffck_commons.model_ffck_structure_type,base.group_partner_manager,1,1,1,0 |
|||
access_res_partner_hierarchy_all,All res.partner.hierarchy,ffck_commons.model_res_partner_hierarchy,,1,0,0,0 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue