diff --git a/odex25_realstate/property_management/views/end_rent_views.xml b/odex25_realstate/property_management/views/end_rent_views.xml
index 57896bd17..8c4d22895 100644
--- a/odex25_realstate/property_management/views/end_rent_views.xml
+++ b/odex25_realstate/property_management/views/end_rent_views.xml
@@ -202,7 +202,7 @@
-
+
diff --git a/odex25_realstate/real_estate/i18n/ar_001.po b/odex25_realstate/real_estate/i18n/ar_001.po
index b9172017c..69502f81c 100644
--- a/odex25_realstate/real_estate/i18n/ar_001.po
+++ b/odex25_realstate/real_estate/i18n/ar_001.po
@@ -1641,6 +1641,12 @@ msgstr "رقم الصك الجديد"
msgid "Stamping State 2"
msgstr "حالة الصك"
+#. module: real_estate
+#: model:ir.model.fields,field_description:real_estate.field_internal_property__stamping_state
+#: model:ir.model.fields,field_description:real_estate.field_re_unit__stamping_state
+msgid "Stamping State"
+msgstr "حالة الصك"
+
#. module: real_estate
#: model:ir.model.fields,field_description:real_estate.field_internal_property__stamping_state_3
#: model:ir.model.fields,field_description:real_estate.field_re_unit__stamping_state_3
diff --git a/odex25_realstate/real_estate/models/internal_property.py b/odex25_realstate/real_estate/models/internal_property.py
index 492dc4b1f..46baa8fee 100644
--- a/odex25_realstate/real_estate/models/internal_property.py
+++ b/odex25_realstate/real_estate/models/internal_property.py
@@ -23,7 +23,7 @@ class Property(models.Model):
# Smart button to count related maintenance records
maintenance_count = fields.Integer(string="Maintenance Count", compute='_compute_maintenance_count')
is_unit_count_fixed = fields.Boolean(string="Is Unit Count Fixed in Floor")
- floor_ids= fields.One2many(comodel_name='floor.unit.details', inverse_name='property_id',string='')
+ floor_ids = fields.One2many(comodel_name='floor.unit.details', inverse_name='property_id', string='')
account_analy_id = fields.Many2one('account.analytic.account', string='Analytic Account')
is_new = fields.Boolean(string="Is New Property?", default=False)
suitability_for_residence = fields.Selection([
@@ -31,6 +31,7 @@ class Property(models.Model):
('non_residential', 'Non-Residential'),
], string="Property Suitability for Residence")
contract_counts = fields.Integer(string='Contracts', compute='count_contracts_number')
+
def count_contracts_number(self):
contract_count = self.env['rental.contract'].search([('property_id', '=', self.id)])
self.contract_counts = len(contract_count)
@@ -52,8 +53,6 @@ class Property(models.Model):
'domain': domain,
}
-
-
# @api.model
# def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
# res = super(Property, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar,
@@ -69,7 +68,7 @@ class Property(models.Model):
@api.onchange('floors_count')
def _onchange_no_of_floor(self):
- if self.floors_count>0:
+ if self.floors_count > 0:
# Clear existing lines
self.floor_ids = [(5, 0, 0)]
# Create floor records based on the number of floors
@@ -124,7 +123,7 @@ class Property(models.Model):
('rent', 'Rented'),
('sold', 'Sold')], string="Status", default='draft')
logo = fields.Binary("Property Logo", default=_default_image, attachment=True,
- help="This field holds the image used as photo for the Property, limited to 1024x1024px.")
+ help="This field holds the image used as photo for the Property, limited to 1024x1024px.")
property_type_id = fields.Many2one('internal.property.type', string="Type")
property_state_id = fields.Many2one('re.property.state', string="Property State")
ownership_type = fields.Selection(
@@ -136,18 +135,20 @@ class Property(models.Model):
company_profit_amount = fields.Float(string='Company Profit Amount')
management_type = fields.Selection([('internal_investment', 'Internal Investment'),
- ('external_investment', 'External Investment'),
- ('include', 'Include')], string="Management Type", default="internal_investment")
+ ('external_investment', 'External Investment'),
+ ('include', 'Include')], string="Management Type",
+ default="internal_investment")
market_type = fields.Selection([('residential', 'Residential'),
- ('commercial', 'Commercial'),('residential_commercial', 'Residential and Commercial'),
+ ('commercial', 'Commercial'),
+ ('residential_commercial', 'Residential and Commercial'),
('industrial', 'Industrial'),
('other', 'Other')], string="Market Type", default="commercial")
other_type = fields.Char(string="Other Type")
action_type = fields.Selection([('sale', 'Sale')], string="Action Type", default="sale")
- no_units = fields.Integer(string="Number of units", compute="count_unit_number",store=True)
- no_rented_units = fields.Integer(string='Number of rented units', compute='count_unit_number',store=True)
- no_available_units = fields.Integer(string='Number of available units', compute='count_unit_number',store=True)
- no_reserved_units = fields.Integer(string='Number of reserved units', compute='count_unit_number',store=True )
+ no_units = fields.Integer(string="Number of units", compute="count_unit_number", store=True)
+ no_rented_units = fields.Integer(string='Number of rented units', compute='count_unit_number', store=True)
+ no_available_units = fields.Integer(string='Number of available units', compute='count_unit_number', store=True)
+ no_reserved_units = fields.Integer(string='Number of reserved units', compute='count_unit_number', store=True)
# no_sold_units = fields.Integer(_('Number Of Sold Units'), compute='count_unit_number')
city_id = fields.Many2one('re.city', string="City")
district_id = fields.Many2one('district', string="District")
@@ -178,9 +179,10 @@ class Property(models.Model):
planned_id = sketch = fields.Many2one('sketchs.sketchs', string='Planned Name')
# Stamping information
stamping_count = fields.Selection(string="Stamping Count", selection=[('1', '1'),
- ('2', '2'),
- ('3', '3')], default="1")
+ ('2', '2'),
+ ('3', '3')], default="1")
stamping = fields.Char(string="Stamping Number")
+ stamping_state = fields.Selection([('updated', 'Updated'), ('not_updated', 'Not Updated')])
stamping_date = fields.Date(string="Stamping Date")
stamping_attach = fields.Binary("Stamping Attach", attachment=True)
@@ -197,7 +199,7 @@ class Property(models.Model):
# Water Meter information
water_count = fields.Selection([('1', '1'),
('2', '2'),
- ('3', '3')], string="Meter Count",default="1")
+ ('3', '3')], string="Meter Count", default="1")
water_serial = fields.Char(string="Serial Number")
water_subscription = fields.Char(string="Subscription Number")
water_account = fields.Char(string="Water Account")
@@ -210,7 +212,7 @@ class Property(models.Model):
unit_ids = fields.One2many('re.unit', 'property_id', string="Property Unit")
property_space = fields.Float(string="Property Space", digits=(16, 2))
property_unit_space = fields.Float(string="Unit's Space", compute="get_property_space", store=True)
-
+
uexternal_space = fields.Float(string="Unit External Space", compute="get_unit_info", store=True)
uspace = fields.Float(string="Unit Total Space", compute="get_unit_info", store=True)
@@ -226,16 +228,16 @@ class Property(models.Model):
appendices = fields.Selection([('yes', 'Yes'),
('no', 'No')], string="Appendices", default="no")
separated = fields.Selection([('yes', 'Yes'),
- ('no', 'No')], string="Separated", default="no")
+ ('no', 'No')], string="Separated", default="no")
internal_staircase = fields.Selection([('yes', 'Yes'),
- ('no', 'No')], string="Internal Staircase", default="no")
+ ('no', 'No')], string="Internal Staircase", default="no")
shops_no = fields.Integer(string="Shops Number")
tree_no = fields.Integer(string="Tree Number")
apartment_no = fields.Integer(string="Apartment Number")
buildings_no = fields.Integer(string="Buildings Number")
well_no = fields.Integer(string="Well Numbers")
rent_status = fields.Selection([('rented', 'Rented'),
- ('not', 'Not Rented')],string="Rent Status", default="not")
+ ('not', 'Not Rented')], string="Rent Status", default="not")
property_cost = fields.Float(string="Property Cost")
company_id = fields.Many2one('res.company', string='Company', required=True,
@@ -256,12 +258,10 @@ class Property(models.Model):
hall_no = fields.Integer(string="Hall Count", compute="get_unit_info", store=True)
kitchen_no = fields.Integer(string="kitchen Count", compute="get_unit_info", store=True)
-
# _sql_constraints = [
# ('stamping', 'unique(stamping)', _('Stamping must be unique.')),
# ]
-
@api.depends('unit_ids', 'unit_ids.room_no', 'unit_ids.bathroom_no', 'unit_ids.hall_no', 'unit_ids.kitchen_no',
'unit_ids.space', 'unit_ids.external_space')
def get_unit_info(self):
@@ -274,13 +274,11 @@ class Property(models.Model):
uspace = rec.uexternal_space + rec.property_unit_space
rec.uspace = uspace
-
@api.depends('property_space', 'meter_price')
def get_total_price(self):
for rec in self:
rec.total_price = rec.meter_price * rec.property_space
-
def get_unit(self):
form_id = self.env.ref('real_estate.unit_form_view').id
domain = [('id', 'in', self.unit_ids.ids)]
@@ -295,18 +293,15 @@ class Property(models.Model):
'domain': domain,
}
-
def get_attachments(self):
action = self.env['ir.actions.act_window']._for_xml_id('base.action_attachment')
- action['domain'] = str([('res_model', '=', 'internal.property'),('res_id', 'in', self.ids)])
+ action['domain'] = str([('res_model', '=', 'internal.property'), ('res_id', 'in', self.ids)])
action['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
return action
-
def compute_unit_count(self):
self.unit_counts = len(self.unit_ids)
-
@api.onchange('ownership_type')
def set_owner(self):
if self.ownership_type == 'full':
@@ -322,7 +317,6 @@ class Property(models.Model):
'target': 'new'
}
-
@api.depends('unit_ids', 'unit_ids.space')
def get_property_space(self):
"""
@@ -332,7 +326,6 @@ class Property(models.Model):
for rec in self:
rec.property_unit_space = sum([unit.space for unit in rec.unit_ids])
-
def unlink(self):
for record in self:
if record.state != 'draft':
@@ -341,7 +334,7 @@ class Property(models.Model):
state = dict(unit.fields_get(allfields=['state'])['state']['selection'])[unit.state]
if unit.state != 'draft':
raise exceptions.ValidationError(
- _("You cannot delete this property because he have a unit with the following state %s unit "
+ _("You cannot delete this property because he have a unit with the following state %s unit "
"code %s") % state % unit.seq)
record.unit_ids.unlink()
return super(Property, self).unlink()
@@ -406,7 +399,6 @@ class Property(models.Model):
if white_space.search(self.water_serial):
raise exceptions.ValidationError(_("Water serial (cannot accept white space)"))
-
@api.constrains('meter_price', 'property_space', 'floors_count', 'property_cost')
def check_number(self):
"""
@@ -442,15 +434,16 @@ class Property(models.Model):
def action_toggle_is_locked(self):
self.ensure_one()
if self.unlock:
- self.write({'unlock':False})
+ self.write({'unlock': False})
else:
- self.write({'unlock':True})
+ self.write({'unlock': True})
+
class PropertyUnitDetails(models.Model):
_name = 'floor.unit.details'
_description = 'Floor Unit Details'
- role_id= fields.Many2one(comodel_name='property.role', string='Roles',)
+ role_id = fields.Many2one(comodel_name='property.role', string='Roles', )
property_id = fields.Many2one('internal.property', string='Property', required=True, ondelete='cascade')
no_of_house = fields.Integer(string='No of Housees')
no_of_shop = fields.Integer(string='No of Shops')
@@ -462,5 +455,3 @@ class PropertyUnitDetails(models.Model):
def _compute_total(self):
for record in self:
record.total = record.no_of_house + record.no_of_shop + record.no_of_other_unit
-
-
diff --git a/odex25_realstate/real_estate/models/re_unit.py b/odex25_realstate/real_estate/models/re_unit.py
index 3c45c3a5a..26b81a52e 100644
--- a/odex25_realstate/real_estate/models/re_unit.py
+++ b/odex25_realstate/real_estate/models/re_unit.py
@@ -81,8 +81,8 @@ class Unit(models.Model):
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,store=True, related='property_id.stamping_attach')
+ stamping_state = fields.Selection(related='property_id.stamping_state')
+ 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')
@@ -236,6 +236,28 @@ class Unit(models.Model):
else:
self.write({'unlock': True})
+ @api.model
+ def create_duplicate_server_action(self):
+ # Create the server action to duplicate records
+ action = self.env['ir.actions.server'].create({
+ 'name': 'Duplicate Selected Records',
+ 'model_id': self.env['ir.model'].search([('model', '=', 're.unit')], limit=1).id,
+ 'state': 'code',
+ 'code': """
+ for record in records:
+ record.copy()
+ """,
+ })
+
+ # Create the action in the contextual action dropdown menu
+ self.env['ir.actions.actions'].create({
+ 'name': 'Duplicate Selected Records',
+ 'binding_model_id': self.env['ir.model'].search([('model', '=', 're.unit')], limit=1).id,
+ 'type': 'ir.actions.server',
+ 'binding_type': 'action',
+ 'binding_view_types': 'list',
+ 'server_action_ids': [(4, action.id)],
+ })
class PropertyContentDetails(models.Model):
_name = 'property.content.details'
@@ -246,3 +268,10 @@ class PropertyContentDetails(models.Model):
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 3311c5031..16676f484 100644
--- a/odex25_realstate/real_estate/views/internal_property_views.xml
+++ b/odex25_realstate/real_estate/views/internal_property_views.xml
@@ -199,9 +199,13 @@
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
-
-
+
+
-
diff --git a/odex25_realstate/real_estate/views/re_unit_view.xml b/odex25_realstate/real_estate/views/re_unit_view.xml
index 11ba6bc59..b207dac44 100644
--- a/odex25_realstate/real_estate/views/re_unit_view.xml
+++ b/odex25_realstate/real_estate/views/re_unit_view.xml
@@ -121,7 +121,7 @@
-
+
@@ -264,6 +264,21 @@
+
+ Duplicate Records
+
+
+ list
+ code
+
+ for record in records:
+ record.copy({'name': record.name + ' (Copy)'})
+
+
+
+
+
+
Unit Filter
re.unit