diff --git a/odex25_realstate/property_management/models/rental_contract.py b/odex25_realstate/property_management/models/rental_contract.py
index bad15c483..025b0cb5d 100644
--- a/odex25_realstate/property_management/models/rental_contract.py
+++ b/odex25_realstate/property_management/models/rental_contract.py
@@ -78,6 +78,12 @@ class RentalContract(models.Model):
if record.state == 'renewed':
record.is_today_end_date = False
+ @api.onchange('unit_ids')
+ def get_units_accounts(self):
+ self.journal_id = self.unit_ids.journal_id
+ self.debit_account_id = self.unit_ids.debit_account_id
+ self.accrued_account_id = self.unit_ids.accrued_account_id
+ self.revenue_account_id = self.unit_ids.revenue_account_id
@api.onchange('rent_method')
def onchange_rent_method(self):
diff --git a/odex25_realstate/real_estate/i18n/ar_001.po b/odex25_realstate/real_estate/i18n/ar_001.po
index ac44c5ca8..b9172017c 100644
--- a/odex25_realstate/real_estate/i18n/ar_001.po
+++ b/odex25_realstate/real_estate/i18n/ar_001.po
@@ -90,6 +90,22 @@ msgstr ""
"فتح\n"
" إغلاق"
+#. module: real_estate
+#: model_terms:ir.ui.view,arch_db:real_estate.unit_form_view
+msgid "Accounts"
+msgstr "الحسابات"
+
+#. module: real_estate
+#: model:ir.model.fields,field_description:real_estate.field_re_unit__accrued_account_id
+#: model:ir.model.fields,field_description:real_estate.field_re_unit__debit_account_id
+msgid "Accrued Account"
+msgstr "تأمين لدى الغير"
+
+#. module: real_estate
+#: model:ir.model.fields,field_description:real_estate.field_re_unit__debit_account_id
+msgid "Debit Account"
+msgstr "حساب المدين"
+
#. module: real_estate
#: model:ir.model.fields,field_description:real_estate.field_internal_property__message_needaction
#: model:ir.model.fields,field_description:real_estate.field_internal_property_type__message_needaction
@@ -509,6 +525,12 @@ msgstr "سعر متر المساحة الخارجية"
msgid "External Space"
msgstr "المساحة الخارجية"
+#. module: real_estate
+#: model_terms:ir.ui.view,arch_db:real_estate.property_form_view
+#: model_terms:ir.ui.view,arch_db:real_estate.unit_form_view
+msgid "First Stamping"
+msgstr "الصك الأول"
+
#. module: real_estate
#: model:ir.model.fields.selection,name:real_estate.selection__internal_property__company_profit__number
msgid "Fixed amount"
@@ -706,6 +728,11 @@ msgstr "هل العقار جديد؟"
msgid "Is Unit Count Fixed in Floor"
msgstr "هل عدد الوحدات ثابت في الأدوار؟"
+#. module: real_estate
+#: model:ir.model.fields,field_description:real_estate.field_re_unit__journal_id
+msgid "Journal"
+msgstr "القيد"
+
#. module: real_estate
#: model:ir.model.fields,field_description:real_estate.field_internal_property_type__is_land
msgid "Land"
@@ -1454,6 +1481,11 @@ msgstr "المستخدم"
msgid "Responsible User"
msgstr "المستخدم المسئول"
+#. module: real_estate
+#: model:ir.model.fields,field_description:real_estate.field_re_unit__revenue_account_id
+msgid "Revenue Account"
+msgstr "حساب اﻹيراد"
+
#. module: real_estate
#: model:ir.model.fields,field_description:real_estate.field_re_unit__role_id
msgid "Role"
@@ -1571,7 +1603,7 @@ msgstr "مرفق الصك الجديد"
#: model:ir.model.fields,field_description:real_estate.field_internal_property__stamping_count
#: model:ir.model.fields,field_description:real_estate.field_re_unit__stamping_count
msgid "Stamping Count"
-msgstr "رقم الصك"
+msgstr "عدد الصكوك"
#. module: real_estate
#: model:ir.model.fields,field_description:real_estate.field_internal_property__stamping_date
@@ -1749,7 +1781,7 @@ msgstr "معلومات الوحدة"
#. module: real_estate
#: model:ir.model.fields,field_description:real_estate.field_re_unit__unit_market_type
msgid "Unit Market Type"
-msgstr "نوع العقار"
+msgstr "صفة العقار"
#. module: real_estate
#: model:ir.model.fields,field_description:real_estate.field_re_unit__name
diff --git a/odex25_realstate/real_estate/models/internal_property.py b/odex25_realstate/real_estate/models/internal_property.py
index a24d596f8..492dc4b1f 100644
--- a/odex25_realstate/real_estate/models/internal_property.py
+++ b/odex25_realstate/real_estate/models/internal_property.py
@@ -464,14 +464,3 @@ class PropertyUnitDetails(models.Model):
record.total = record.no_of_house + record.no_of_shop + record.no_of_other_unit
-
-
-class PropertyContentDetails(models.Model):
- _name = 'property.content.details'
- _description = 'Property Unit Details'
-
- property_id = fields.Many2one('internal.property', string='Property', required=True, ondelete='cascade')
- content_id = fields.Many2one('property.contents','Property Content')
- qty = fields.Integer('QTY')
- desc = fields.Char('Description')
- attachment = fields.Binary(string="Property Docs")
diff --git a/odex25_realstate/real_estate/models/re_unit.py b/odex25_realstate/real_estate/models/re_unit.py
index ea2dc02be..8efe74b18 100644
--- a/odex25_realstate/real_estate/models/re_unit.py
+++ b/odex25_realstate/real_estate/models/re_unit.py
@@ -9,25 +9,27 @@
import base64
import re
from odoo import models, fields, api, exceptions, _
+
+
class PropertyRole(models.Model):
_name = 'property.role'
_description = 'Property Role'
name = fields.Char('Name')
+
class Unit(models.Model):
_name = 're.unit'
_description = 'Property Unit'
_inherit = ['mail.thread', 'mail.activity.mixin']
_order = "id desc"
-
-
+
unit_category = fields.Selection([
('residential', 'Residential'),
('commercial', 'Commercial'),
- ('lands', 'Lands') ], string="Unit Category")
+ ('lands', 'Lands')], string="Unit Category")
attach_nbr = fields.Integer(compute='get_attachments')
- content_ids= fields.One2many(comodel_name='property.content.details', inverse_name='property_id',string='')
+ content_ids = fields.One2many(comodel_name='property.content.details', inverse_name='unit_id', string='')
active = fields.Boolean(default=True)
role_id = fields.Many2one('property.role', string='Role')
unlock = fields.Boolean(default=True, string="Unlock")
@@ -40,6 +42,10 @@ class Unit(models.Model):
('reserved', 'Reserved'),
('rented', 'Rented'),
('sold', 'Sold')], string="Status", default='draft')
+ journal_id = fields.Many2one('account.journal', string='Journal')
+ accrued_account_id = fields.Many2one('account.account', string='Accrued Account')
+ debit_account_id = fields.Many2one('account.account', string='Debit Account')
+ revenue_account_id = fields.Many2one('account.account', string='Revenue Account')
unit_type_id = fields.Many2one('unit.type', string="Unit Type")
management_type = fields.Selection(related='property_id.management_type', string="Management Type", store=True)
market_type = fields.Selection(related="property_id.market_type", string="Market Type", store=True)
@@ -57,7 +63,7 @@ class Unit(models.Model):
mezzanine = fields.Boolean(string="Mezzanine")
mezzan_length = fields.Float(string="Mezzan Length")
mezzan_width = fields.Float(string="Mezzan Width")
- meter_price = fields.Float(string="Meter Price", compute="get_rent_price" , store=True, digits=(16, 2))
+ meter_price = fields.Float(string="Meter Price", compute="get_rent_price", store=True, digits=(16, 2))
rent_price = fields.Float(string="Total Price")
limit_meter_price = fields.Float(string="Limit Meter Price", compute="get_limit_rent_price", store=True)
limit_rent = fields.Float(string="Limit Rent", store=True)
@@ -72,40 +78,42 @@ class Unit(models.Model):
bathroom_no = fields.Integer(string="Bathroom Count")
hall_no = fields.Integer(string="Hall Count")
kitchen_no = fields.Integer(string="kitchen Count")
- stamping_count = fields.Selection(string="Stamping Count",related='property_id.stamping_count')
- stamping = fields.Char(string="Stamping Number",related='property_id.stamping')
- stamping_date = fields.Date(string="Stamping Date",related='property_id.stamping_date')
+ stamping_count = fields.Selection(string="Stamping Count", related='property_id.stamping_count')
+ stamping = fields.Char(string="Stamping Number", related='property_id.stamping')
+ stamping_date = fields.Date(string="Stamping Date", related='property_id.stamping_date')
# stamping_state = fields.Selection(related='property_id.stamping_state')
- stamping_attach = fields.Binary("Stamping Attach", attachment=True,related='property_id.stamping_attach')
+ stamping_attach = fields.Binary("Stamping Attach", attachment=True, related='property_id.stamping_attach')
- stamping_2 = fields.Char(string="Stamping Number",related='property_id.stamping_2')
- stamping_date_2 = fields.Date(string="Stamping Date",related='property_id.stamping_date_2')
- stamping_attach_2 = fields.Binary("Stamping Attach", attachment=True,related='property_id.stamping_attach_2')
- stamping_state_2 = fields.Selection([('updated', 'Updated'), ('not_updated', 'Not Updated')],related='property_id.stamping_state_2')
+ stamping_2 = fields.Char(string="Stamping Number", related='property_id.stamping_2')
+ stamping_date_2 = fields.Date(string="Stamping Date", related='property_id.stamping_date_2')
+ stamping_attach_2 = fields.Binary("Stamping Attach", attachment=True, related='property_id.stamping_attach_2')
+ stamping_state_2 = fields.Selection([('updated', 'Updated'), ('not_updated', 'Not Updated')],
+ related='property_id.stamping_state_2')
- stamping_3 = fields.Char(string="Stamping Number",related='property_id.stamping_3')
- stamping_date_3 = fields.Date(string="Stamping Date",related='property_id.stamping_date_3')
- stamping_attach_3 = fields.Binary("Stamping Attach", attachment=True,related='property_id.stamping_attach_3')
- stamping_state_3 = fields.Selection([('updated', 'Updated'), ('not_updated', 'Not Updated')],related='property_id.stamping_state_3')
+ stamping_3 = fields.Char(string="Stamping Number", related='property_id.stamping_3')
+ stamping_date_3 = fields.Date(string="Stamping Date", related='property_id.stamping_date_3')
+ stamping_attach_3 = fields.Binary("Stamping Attach", attachment=True, related='property_id.stamping_attach_3')
+ stamping_state_3 = fields.Selection([('updated', 'Updated'), ('not_updated', 'Not Updated')],
+ related='property_id.stamping_state_3')
stamping_new = fields.Char(string="Stamping Number New")
stamping_date_new = fields.Date(string="Stamping Date New")
stamping_attach_new = fields.Binary("Stamping Attach New", attachment=True)
-
_sql_constraints = [
('name', 'unique(name)', _('Name must be unique.')),
]
- # Smart button to count related maintenance records
+ # Smart button to count related maintenance records
maintenance_count = fields.Integer(string="Maintenance Count", compute='_compute_maintenance_count')
+
def get_attachments(self):
action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
- action['domain'] = str([('res_model', '=', 're.unit'),('res_id', 'in', self.ids)])
+ action['domain'] = str([('res_model', '=', 're.unit'), ('res_id', 'in', self.ids)])
action['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
domain = [('res_model', '=', 're.unit'), ('res_id', '=', self.id)]
self.attach_nbr = self.env['ir.attachment'].search_count(domain)
return action
-
+
def _compute_maintenance_count(self):
for record in self:
record.maintenance_count = self.env['property.management.maintenance'].search_count([
@@ -121,7 +129,7 @@ class Unit(models.Model):
'domain': [('unit_ids', 'in', self.id)],
'context': dict(self.env.context),
}
-
+
@api.depends('state')
def set_color(self):
for record in self:
@@ -144,7 +152,6 @@ class Unit(models.Model):
else:
rec.limit_rent = 0.0
-
def action_available(self):
"""
after checking meter price and limit price meter
@@ -198,7 +205,6 @@ class Unit(models.Model):
if white_space.search(self.electric_account):
raise exceptions.ValidationError(_("Electric account (cannot accept white space)"))
-
@api.constrains('limit_meter_price', 'space', 'meter_price', 'mezzan_width', 'mezzan_length')
def check_number(self):
"""
@@ -223,7 +229,6 @@ class Unit(models.Model):
if record.space != 0.0:
record.meter_price = record.rent_price / record.space
-
def action_toggle_is_locked(self):
self.ensure_one()
if self.unlock:
@@ -232,15 +237,12 @@ class Unit(models.Model):
self.write({'unlock': True})
-
-
-
class PropertyContentDetails(models.Model):
_name = 'property.content.details'
_description = 'Property Unit Details'
- property_id = fields.Many2one('internal.property', string='Property', required=True, ondelete='cascade')
- content_id = fields.Many2one('property.contents','Property Content')
+ unit_id = fields.Many2one('re.unit', string='Property', required=True, ondelete='cascade')
+ content_id = fields.Many2one('property.contents', 'Property Content')
qty = fields.Integer('QTY')
desc = fields.Char('Description')
attachment = fields.Binary(string="Property Docs")
diff --git a/odex25_realstate/real_estate/views/internal_property_views.xml b/odex25_realstate/real_estate/views/internal_property_views.xml
index a1f6052f3..3311c5031 100644
--- a/odex25_realstate/real_estate/views/internal_property_views.xml
+++ b/odex25_realstate/real_estate/views/internal_property_views.xml
@@ -199,7 +199,7 @@
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
-
+
-
+
@@ -161,6 +161,18 @@
+
+
+
+
+
+
+
+
+
+
+