diff --git a/bemade_sethy_configuration/__init__.py b/bemade_sethy_configuration/__init__.py deleted file mode 100644 index d94c5f5..0000000 --- a/bemade_sethy_configuration/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# -*- coding: utf-8 -*- -from . import models -from . import wizard - diff --git a/bemade_sethy_configuration/__manifest__.py b/bemade_sethy_configuration/__manifest__.py deleted file mode 100644 index 5013dd5..0000000 --- a/bemade_sethy_configuration/__manifest__.py +++ /dev/null @@ -1,59 +0,0 @@ - -# -*- coding: utf-8 -*- -{ - 'name': 'Bemade Sethy', - 'version': '1.0', - 'category': 'Specific Module Category', # Specify your module's category here - 'summary': "This module is developed by Bemade to instantiate the Sethy's Odoo", - 'author': 'Bemade', - 'website': 'https://bemade.org', - 'email': 'it@bemade.org', - 'license': 'AGPL-3', - 'depends': [ - # List of module dependencies - 'base', - 'contacts', - 'crm', - 'document_knowledge', - 'document_page', - 'document_page_approval', - 'attachment_indexation', - 'l10n_ca', - 'membership_variable_period', - 'membership_delegated_partner', - 'partner_multi_relation', - 'sale_management', - 'base_automation' - ], - 'data': [ - # Reference to XML, CSV, and other data files - 'data/membership_category_data.xml', - 'data/ir_cron_data.xml', - 'data/product_template_data.xml', - 'data/partner_category_data.xml', - 'data/partner_relation_type_data.xml', - 'data/company_data.xml', - 'views/res_partner_relation_views.xml', -# 'views/membership_membership_line.xml', - 'views/property_view.xml', - 'views/res_partner_views.xml', - 'security/ir.model.access.csv', - 'wizard/transfer_property_wizard_views.xml' - ], - 'demo': [ - # Reference to demo data files - ], - 'installable': True, - 'auto_install': False, - 'application': True, - 'description': """ -Main module for Fondation Séthy -================================== -This module installs base components and will also set up default values according to the Fondation Séthy. - -This will allow us to put all the customization here and add other modules from Oca or our repos if needed. - -Only code specific to Fondation Sethy resides in this module, the reusable stuff should be put in other small dedicated -modules elsewhere -""", -} diff --git a/bemade_sethy_configuration/data/company_data.xml b/bemade_sethy_configuration/data/company_data.xml deleted file mode 100644 index 7149fb6..0000000 --- a/bemade_sethy_configuration/data/company_data.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - Fondation Séthy - https://fondationsethy.org - info@fondationsethy.org - 164, rue Cowie - local 335 - Granby - - J2G 3V3 - - 450 994-3173 - - - - - diff --git a/bemade_sethy_configuration/data/ir_cron_data.xml b/bemade_sethy_configuration/data/ir_cron_data.xml deleted file mode 100644 index 330150b..0000000 --- a/bemade_sethy_configuration/data/ir_cron_data.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Sethy: Update relation - - code - partners = env['res.partner'].search([]) -for rec in partners: - rec._compute_relation_count() - - - 12 - months - -1 - - - - - \ No newline at end of file diff --git a/bemade_sethy_configuration/data/membership_category_data.xml b/bemade_sethy_configuration/data/membership_category_data.xml deleted file mode 100644 index 0070139..0000000 --- a/bemade_sethy_configuration/data/membership_category_data.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Perpetual Membership - - - Annual Membership - - - diff --git a/bemade_sethy_configuration/data/partner_category_data.xml b/bemade_sethy_configuration/data/partner_category_data.xml deleted file mode 100644 index b71dae6..0000000 --- a/bemade_sethy_configuration/data/partner_category_data.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - Property - 7 - - - Owner - 4 - - - diff --git a/bemade_sethy_configuration/data/partner_relation_type_data.xml b/bemade_sethy_configuration/data/partner_relation_type_data.xml deleted file mode 100644 index 46080a3..0000000 --- a/bemade_sethy_configuration/data/partner_relation_type_data.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Owner - Property - c - - - - diff --git a/bemade_sethy_configuration/data/product_template_data.xml b/bemade_sethy_configuration/data/product_template_data.xml deleted file mode 100644 index a1a2b36..0000000 --- a/bemade_sethy_configuration/data/product_template_data.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - Perpetual Membership - - service - 2000-01-01 - 2100-01-01 - 225.0 - - - MBRAV - - - - - Annual Membership - - service - 20.0 - - - MBRAN - variable - - - - - - - diff --git a/bemade_sethy_configuration/models/__init__.py b/bemade_sethy_configuration/models/__init__.py deleted file mode 100644 index 0d7a048..0000000 --- a/bemade_sethy_configuration/models/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from . import res_partner -from . import res_config_settings diff --git a/bemade_sethy_configuration/models/res_config_settings.py b/bemade_sethy_configuration/models/res_config_settings.py deleted file mode 100644 index b89d6b0..0000000 --- a/bemade_sethy_configuration/models/res_config_settings.py +++ /dev/null @@ -1,12 +0,0 @@ -from odoo import models, api - -class ResConfigSettings(models.TransientModel): - _inherit = 'res.config.settings' - - def set_values(self): - res = super().set_values() - category_id = self.env.ref('bemade_sethy_configuration.partner_tag_property', raise_if_not_found=False) - # If the category_id record exists, we set its ID in ir.config_parameter - if category_id: - self.env['ir.config_parameter'].sudo().set_param('bemade_sethy_configuration.partner_tag_property', category_id.id) - return res \ No newline at end of file diff --git a/bemade_sethy_configuration/models/res_partner.py b/bemade_sethy_configuration/models/res_partner.py deleted file mode 100644 index cfabf3e..0000000 --- a/bemade_sethy_configuration/models/res_partner.py +++ /dev/null @@ -1,243 +0,0 @@ -# -*- coding: utf-8 -*- - -from odoo import api, fields, models, _ -from odoo.addons.website.models import ir_http -import logging - -_logger = logging.getLogger(__name__) - -class ResPartner(models.Model): - _inherit = 'res.partner' - - @api.model - def _tag_property(self): - return self.env.ref('bemade_sethy_configuration.partner_tag_property', raise_if_not_found=False) - - @api.model - def _tag_owner(self): - return self.env.ref('bemade_sethy_configuration.partner_tag_owner', raise_if_not_found=False) - - @api.model - def _relation_owner_property(self): - return self.env.ref('bemade_sethy_configuration.partner_relation_property', raise_if_not_found=False) - - # Add new fields to the res.partner model for property management - surface = fields.Float(string='Surface (ha)') - lot_number = fields.Text(string='Lot Number') - - # Add new fields to the res.partner model for owner/member management - ref_project = fields.Text(string='Project No') - intent_signing = fields.Boolean(string='Intent to sign') - cyberimpact = fields.Boolean(string='Cyberimpact') - specification_date = fields.Date(string='Specification date') - crm_stage_activity = fields.Text(string='Activity Stage') - company_use = fields.Text(string='Company related') - - # Add new fields to the res.partner model for member management - sethy_first_date = fields.Date(string='First membership date') # member - sethy_last_date = fields.Date(string='Last membership date') # member - sethy_renew_date = fields.Date(string='Next renew date date') # member - sethy_certification_date = fields.Date(string='Certification date date') # member - sethy_payment_type = fields.Text(string='Payment Type') # member - sethy_amount = fields.Float(string='Payment amount') # Member - - is_property = fields.Boolean( - string='Is Property', - compute='_compute_is_property', - inverse='_inverse_is_property', - store=True - ) # True if property, False if not - - interest_level = fields.Selection( - selection=[ - ('1', 'None'), - ('2', 'Low'), - ('3', 'Average'), - ('4', 'High')], - string='Interest Level') # proprio - - # Filtered fields relation_all_ids for owner - relation_owner_ids = fields.One2many( - "res.partner.relation.all", - compute="_compute_relation_property_owner", - string="Owner ids", - compute_sudo=True, - ) - - # Filtered fields relation_all_ids for property - relation_property_ids = fields.One2many( - "res.partner.relation.all", - compute="_compute_relation_property_owner", - string="Property ids", - compute_sudo=True, - ) - - # Add new fields to the res.partner model for owner management - property_count = fields.Integer( - string='Property count', - compute='_compute_property_count', - store=True, - compute_sudo=True - ) - - is_owner = fields.Boolean( - string='Is Owner', - compute='_compute_owner', - store=True, - compute_sudo=True, - ) - - @api.depends('relation_all_ids') - def _compute_owner(self): - #owner_tag = self._tag_owner() - owner_tag = self.env.ref('bemade_sethy_configuration.partner_tag_owner', raise_if_not_found=False) - for record in self: - record.is_owner = record.relation_count > 0 - if record.is_owner: - record.category_id |= owner_tag - else: - record.category_id -= owner_tag - - # this is an hugly fix because @api depends doesn't work on new function so hacking it here - @api.depends("relation_all_ids") - def _compute_relation_count(self): - super()._compute_relation_count() - #owner_tag = self._tag_owner() - owner_tag = self.env.ref('bemade_sethy_configuration.partner_tag_owner', raise_if_not_found=False) - for record in self: - for line in record.relation_all_ids: - if line.active and line.type_id == owner_tag: - record.relation_count += 1 - record.is_owner = record.relation_count > 0 and not record.is_property - if record.is_owner: - record.category_id |= owner_tag - else: - record.category_id -= owner_tag - - @api.depends('category_id') - def _compute_is_property(self): - default_is_property = self._context.get('default_is_property', None) - #property_tag = self._tag_property() - property_tag = self.env.ref('bemade_sethy_configuration.partner_tag_property', raise_if_not_found=False) - for partner in self: - # Check if the property tag exists. If it doesn't, set is_property to False. - # Because module installation order is not guaranteed, the tag may not exist yet when this method is called. - # This is due to store=True on the is_property field. - if default_is_property is not None and not self.id: - partner.is_property = default_is_property - else: - if property_tag is None: - partner.is_property = False - else: - partner.is_property = property_tag and property_tag in partner.category_id - - - def _inverse_is_property(self): - #property_tag = self._tag_property() - property_tag = self.env.ref('bemade_sethy_configuration.partner_tag_property', raise_if_not_found=False) - if property_tag is not None: - for partner in self: - if partner.is_property and property_tag not in partner.category_id and property_tag: - partner.category_id |= property_tag - elif not partner.is_property and property_tag in partner.category_id: - partner.category_id -= property_tag - - @api.depends("relation_all_ids") - def _compute_property_count(self): - for record in self: - #owner_tag = self._tag_owner() - owner_tag = self.env.ref('bemade_sethy_configuration.partner_tag_owner', raise_if_not_found=False) - record.property_count = len(record._get_owners()) - record.is_owner = record.property_count > 0 - if owner_tag is not None: - if record.is_owner: - record.category_id |= owner_tag - else: - record.category_id -= owner_tag - - @api.depends( - 'relation_all_ids', - 'relation_all_ids.type_id', - 'relation_all_ids.date_end', - 'relation_all_ids.this_partner_id', - 'relation_all_ids.other_partner_id', - 'relation_all_ids.is_inverse' - ) - def _compute_relation_property_owner(self): - for record in self: - # relations = self.env['res.partner.relation.all'] - # for line in record.relation_all_ids: - # if active and is_property and is_inverse: - # relations |= line - # record.relation_property_ids = relations - record.relation_property_ids = record._get_properties() - record.relation_owner_ids = record._get_owners() - # Just for debugging below this line - type_property = self._relation_owner_property() - #type_property = self.env.ref('bemade_sethy_configuration.partner_relation_property') - for line in record.relation_all_ids: - active = line.active - is_property = line.type_id == type_property - is_inverse = line.is_inverse - _logger.info(f"This partner: {line.this_partner_id.name}") - _logger.info(f"Other partner: {line.other_partner_id.name}") - _logger.info(f"Active: {active}, Property: {is_property}, Inverse: {is_inverse}, Type: {line.type_id.name}") - - def _get_properties(self): - self.ensure_one() - #type_property = self._relation_owner_property() - type_property = self.env.ref('bemade_sethy_configuration.partner_relation_property') - return self.relation_all_ids.filtered( - lambda line: (line.type_id.id == type_property.id and line.is_inverse and line.active) - ) - - def _get_owners(self): - self.ensure_one() - #type_property = self._relation_owner_property() - type_property = self.env.ref('bemade_sethy_configuration.partner_relation_property', raise_if_not_found=False) - return self.relation_all_ids.filtered( - lambda line: (line.type_id.id == type_property.id and not line.is_inverse and line.active) - ) - - @api.onchange('lot_number') - def _onchange_lot_number(self): - for lot in self: - if lot.lot_number: - lot.name = "Lot " + str(lot.lot_number) - - @api.model_create_multi - def create(self, vals_list): - # Create Partner records using the super function - records = super().create(vals_list) - user_company = self.env.user.company_id - - # Update the records where 'state_id' or 'country_id' isn't provided - for record in records: - if not record.state_id or not record.country_id: - if not record.state_id and user_company.state_id: - record.write({ - 'state_id': user_company.state_id.id, - }) - if not record.country_id and user_company.country_id: - record.write({ - 'country_id': user_company.country_id.id - }) - if record.name.startswith("Lot "): - record.lot_number = record.name[4:] - record._inverse_is_property() - return records - - @api.onchange('name') - def _onchange_name(self): - for record in self: - if record.name and record.name.startswith("Lot "): - record.lot_number = record.name[4:] - - def write(self, vals): - result = super(ResPartner, self).write(vals) - self._inverse_is_property() - return result - - @api.onchange('category_id') - def _onchange_category_id(self): - self._compute_is_property() \ No newline at end of file diff --git a/bemade_sethy_configuration/security/ir.model.access.csv b/bemade_sethy_configuration/security/ir.model.access.csv deleted file mode 100644 index 38525a7..0000000 --- a/bemade_sethy_configuration/security/ir.model.access.csv +++ /dev/null @@ -1,2 +0,0 @@ -id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_transfer_property_wizard,access_transfer_property_wizard,model_transfer_property_wizard,base.group_user,1,1,1,1 diff --git a/bemade_sethy_configuration/static/description/icon.png b/bemade_sethy_configuration/static/description/icon.png deleted file mode 100644 index 3ee5128..0000000 Binary files a/bemade_sethy_configuration/static/description/icon.png and /dev/null differ diff --git a/bemade_sethy_configuration/static/icon.png b/bemade_sethy_configuration/static/icon.png deleted file mode 100644 index 3ee5128..0000000 Binary files a/bemade_sethy_configuration/static/icon.png and /dev/null differ diff --git a/bemade_sethy_configuration/views/membership_membership_line.xml b/bemade_sethy_configuration/views/membership_membership_line.xml deleted file mode 100644 index db49d54..0000000 --- a/bemade_sethy_configuration/views/membership_membership_line.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Membership line - membership.membership_line - tree - - - - -

- Record and track your partners'membership -

-
-
- - -
diff --git a/bemade_sethy_configuration/views/property_view.xml b/bemade_sethy_configuration/views/property_view.xml deleted file mode 100644 index 3b06b58..0000000 --- a/bemade_sethy_configuration/views/property_view.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - res.partner - - - - - - - - - - - - - - - - - res.partner.kanban.property - res.partner - - - - - - - - - - - - - - - - - Properties - res.partner - kanban,tree,form - - [('is_property','=',True)] - {'default_is_property': True, 'default_is_company': True} - - - - - \ No newline at end of file diff --git a/bemade_sethy_configuration/views/res_partner_relation_views.xml b/bemade_sethy_configuration/views/res_partner_relation_views.xml deleted file mode 100644 index f3a45a5..0000000 --- a/bemade_sethy_configuration/views/res_partner_relation_views.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - res.partner.relation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Relations - relation - res.partner.relation - tree - - - - -

- Record and track your partners' relations. Relations may - be linked to other partners with a type either directly - or inversely. -

-
-
- - -
diff --git a/bemade_sethy_configuration/views/res_partner_views.xml b/bemade_sethy_configuration/views/res_partner_views.xml deleted file mode 100644 index 341bf91..0000000 --- a/bemade_sethy_configuration/views/res_partner_views.xml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - Open Partner - ir.actions.act_window - res.partner - form - current - - - - - Transfer Property - ir.actions.act_window - transfer.property.wizard - form - new - - - - bemade_sethy_configuration.res_partner.defaults.form - res.partner - - - -
-
-
- - - - - - - is_property == True - - - - - - - - not is_company or is_property - - - - is_company or is_property - - - - - - - - - - - - is_property == True - - - - - - - - is_property - - - - is_property == True - - - - is_property == True - - - - is_property == True - - - - is_property == True - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - res.partner.search.inherit - res.partner - - - - - - - - - - - - - - - - - - - - - - - Contacts - ir.actions.act_window - res.partner - tree,form - - [('is_property','=',False)] - - - - -
\ No newline at end of file diff --git a/bemade_sethy_configuration/wizard/__init__.py b/bemade_sethy_configuration/wizard/__init__.py deleted file mode 100644 index 0a03a60..0000000 --- a/bemade_sethy_configuration/wizard/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import transfer_property_wizard diff --git a/bemade_sethy_configuration/wizard/transfer_property_wizard.py b/bemade_sethy_configuration/wizard/transfer_property_wizard.py deleted file mode 100644 index 4abbd50..0000000 --- a/bemade_sethy_configuration/wizard/transfer_property_wizard.py +++ /dev/null @@ -1,44 +0,0 @@ -from odoo import models, fields, api -from datetime import timedelta - -class TransferPropertyWizard(models.TransientModel): - _name = 'transfer.property.wizard' - _description = 'Transfer Property Wizard' - - property_id = fields.Many2one( - comodel_name='res.partner', - string='Property', - domain=[('is_property', '=', True)], - required=True - ) - - new_owner_id = fields.Many2many( - comodel_name='res.partner', - string='New Owner', - required=True, - domain=[('is_property', '=', False)], - ) - - transfer_date = fields.Date( - string='Transfer Date', - required=True, - default=fields.Date.today() - ) - - def action_transfer_property(self): - if self.property_id.relation_property_ids.filtered("active"): - for old_owner_relation in self.property_id.relation_property_ids.filtered("active"): - if old_owner_relation.date_start and old_owner_relation.date_start >= self.transfer_date: - old_owner_relation.unlink() - else: - old_owner_relation.write({'date_end': self.transfer_date - timedelta(days=1)}) - old_owner_relation.this_partner_id._compute_owner() - for new_owner in self.new_owner_id: - self.env['res.partner.relation.all'].create({ - 'this_partner_id': new_owner.id, - 'other_partner_id': self.property_id.id, - 'type_id': self.env.ref('bemade_sethy_configuration.partner_relation_property').id, - 'date_start': self.transfer_date, - }) - new_owner._compute_owner() - return {'type': 'ir.actions.act_window_close'} \ No newline at end of file diff --git a/bemade_sethy_configuration/wizard/transfer_property_wizard_views.xml b/bemade_sethy_configuration/wizard/transfer_property_wizard_views.xml deleted file mode 100644 index 6b79e42..0000000 --- a/bemade_sethy_configuration/wizard/transfer_property_wizard_views.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - property.transfer.wizard.form - transfer.property.wizard - form - -
- - - - - - - - -
-
-
-
\ No newline at end of file