Merge branch 'dev_odex25_realstate' into odex25_realstate_dev
# Conflicts: # odex25_realstate/real_estate/models/re_unit.py
This commit is contained in:
commit
3672ca7723
|
|
@ -202,7 +202,7 @@
|
|||
<field name="vendor_id" attrs="{'invisible':[('renter_invoice', '=', True)],
|
||||
'required':[('renter_invoice', '=', False)], 'readonly':[('state','!=','draft')]}"/>
|
||||
<field name="maintenance_cost" invisible="0" readonly="1"/>
|
||||
<field name="hand_cost" invisible="0" readonly="1"/>
|
||||
<field name="hand_cost" invisible="0" readonly="0"/>
|
||||
<field name="total_amount" readonly="1"/>
|
||||
<field name="company_id" readonly="1"/>
|
||||
<field name="user_id" readonly="1"/>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -137,17 +136,19 @@ class Property(models.Model):
|
|||
|
||||
management_type = fields.Selection([('internal_investment', 'Internal Investment'),
|
||||
('external_investment', 'External Investment'),
|
||||
('include', 'Include')], string="Management Type", default="internal_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")
|
||||
|
|
@ -181,6 +182,7 @@ class Property(models.Model):
|
|||
('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")
|
||||
|
|
@ -235,7 +237,7 @@ class Property(models.Model):
|
|||
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':
|
||||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -199,9 +199,13 @@
|
|||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
|
||||
</group>
|
||||
<group attrs="{'readonly':[('state','=','approve')]}" colspan="2" col="4" string="First Stamping">
|
||||
<group attrs="{'readonly':[('state','=','approve')]}" colspan="2" col="4"
|
||||
string="First Stamping">
|
||||
<field name="stamping_count" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="stamping_state"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"
|
||||
string="Stamping State"/>
|
||||
<field name="stamping" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="stamping_date" required="1"
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@
|
|||
<field name="stamping"/>
|
||||
<field name="stamping_date"/>
|
||||
<field name="stamping_attach"/>
|
||||
<!-- <field name="stamping_state"/>-->
|
||||
<field name="stamping_state"/>
|
||||
</group>
|
||||
<group string="Second Stamping"
|
||||
attrs="{'invisible':['|',('stamping_count','=','1'),('stamping_count','=',False)]}">
|
||||
|
|
@ -264,6 +264,21 @@
|
|||
|
||||
</record>
|
||||
|
||||
<record id="action_duplicate_re_unit" model="ir.actions.server">
|
||||
<field name="name">Duplicate Records</field>
|
||||
<field name="model_id" ref="real_estate.model_re_unit"/>
|
||||
<field name="binding_model_id" ref="real_estate.model_re_unit"/>
|
||||
<field name="binding_view_types">list</field>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
for record in records:
|
||||
record.copy({'name': record.name + ' (Copy)'})
|
||||
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record id="unit_filter_view" model="ir.ui.view">
|
||||
<field name="name">Unit Filter</field>
|
||||
<field name="model">re.unit</field>
|
||||
|
|
|
|||
Loading…
Reference in New Issue