[UPDATE]UPDATE properrty
This commit is contained in:
parent
0b720fad5e
commit
af8b2e12fd
|
|
@ -218,7 +218,7 @@ class PropertyManagementMaintenance(models.Model):
|
|||
|
||||
def _prepare_invoice_values(self, maintenance, amount):
|
||||
origin = _(
|
||||
'Maintenance Order') + ' ' + maintenance.name + ' ' + maintenance.partner_id.name if maintenance.partner_id else \
|
||||
'Maintenance Order') + ' ' + maintenance.name + ' '+maintenance.property_id.name+' ' +maintenance.unit_ids[0].name+' ' +maintenance.partner_id.name if maintenance.partner_id else \
|
||||
_('Maintenance Order') + ' ' + maintenance.name + ' ' + maintenance.vendor_id.name
|
||||
line_data = []
|
||||
for line in maintenance.end_line_ids:
|
||||
|
|
@ -226,6 +226,7 @@ class PropertyManagementMaintenance(models.Model):
|
|||
'product_id': line.product_id.id,
|
||||
'name': origin + ' - ' + str(maintenance.date),
|
||||
'account_id': line.product_id.property_account_expense_id.id,
|
||||
'analytic_account_id': maintenance.property_id.analytic_account_id.id if maintenance.analytic_account_id else False,
|
||||
'quantity': line.qty,
|
||||
'price_unit': line.cost,
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -101,35 +101,38 @@ class RentPayment(models.Model):
|
|||
line_journal = []
|
||||
|
||||
if payment.amount>0.00:
|
||||
print('go on....')
|
||||
line_invoice.append((0, 0, {
|
||||
'name':'قيمة الإيجار '+' - '+payment.contract_id.name+'- '+ self.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'name':'قيمة الإيجار '+' - '+payment.contract_id.name+'- '+self.property_id.name+' - '+self.unit_ids[0].name+' - ' + self.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': self.amount,
|
||||
'quantity': 1.0,
|
||||
'account_id': payment.contract_id.revenue_account_id.id,
|
||||
'analytic_account_id': payment.property_id.analytic_account_id.id if property_id.analytic_account_id else False,
|
||||
'tax_ids': [(6, 0, [payment.tax_id.id])] if payment.tax_id else False, # Assigning tax_id to tax_ids
|
||||
}))
|
||||
if payment.water_cost>0.00:
|
||||
line_invoice.append((0, 0, {
|
||||
'name': 'تكلفة المياه'+' -'+self.name + ' - '+payment.contract_id.name +' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'name': 'تكلفة المياه'+' -'+self.name + ' - '+payment.contract_id.name +' - ' +self.property_id.name+' - '+self.unit_ids[0].name+' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit':self.water_cost,
|
||||
'quantity': 1.0,
|
||||
'account_id': payment.contract_id.revenue_account_id.id,
|
||||
'analytic_account_id': payment.property_id.analytic_account_id.id if property_id.analytic_account_id else False,
|
||||
'tax_ids': [(6, 0, [payment.tax_id.id])] if payment.tax_id else False, # Assigning tax_id to tax_ids
|
||||
}),)
|
||||
if payment.service_cost>0.00:
|
||||
line_invoice.append((0, 0, {
|
||||
'name':'قيمة الخدمات'+' - '+ self.name+' - '+payment.contract_id.name + ' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'name':'قيمة الخدمات'+' - '+ self.name+' - '+payment.contract_id.name + ' - '+self.property_id.name+' - '+self.unit_ids[0].name+' - ' + payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit': self.service_cost,
|
||||
'quantity': 1.0,
|
||||
'analytic_account_id': payment.property_id.analytic_account_id.id if property_id.analytic_account_id else False,
|
||||
'account_id': payment.contract_id.revenue_account_id.id,
|
||||
'tax_ids': [(6, 0, [payment.tax_id.id])] if payment.tax_id else False, # Assigning tax_id to tax_ids
|
||||
}))
|
||||
if payment.amount==0.00 and payment.service_cost==0.00 and payment.water_cost==0.00:
|
||||
line_invoice.append((0, 0, {
|
||||
'name':self.name + ' - ' +payment.contract_id.name + ' - '+payment.code + ' - ' + str(payment.due_date),
|
||||
'name':self.name + ' - ' +payment.contract_id.name + ' - '+self.property_id.name+' - '+self.unit_ids[0].name+' - '+payment.code + ' - ' + str(payment.due_date),
|
||||
'price_unit':self.total_amount,
|
||||
'quantity': 1.0,
|
||||
'analytic_account_id': payment.property_id.analytic_account_id.id if property_id.analytic_account_id else False,
|
||||
'account_id': payment.contract_id.revenue_account_id.id,
|
||||
'tax_ids': [(6, 0, [payment.tax_id.id])] if payment.tax_id else False, # Assigning tax_id to tax_ids
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -557,7 +557,7 @@ class RentalContract(models.Model):
|
|||
water_amount_per_payment = self.water_cost / (rent_factor / service_months)
|
||||
services_amount_per_payment = self.service_amount / (rent_factor / service_months)
|
||||
untaxed_amount = round(rent_amount_per_payment + water_amount_per_payment + services_amount_per_payment, 2)
|
||||
tax_amount = round(self.tax_id.amount / 100 * rent_amount_per_payment, 2)
|
||||
tax_amount = round(self.tax_id.amount / 100 * rent_amount_per_payment, 2) if self.tax_id else 0.0
|
||||
total_amount = round(untaxed_amount + tax_amount, 2)
|
||||
|
||||
|
||||
|
|
@ -587,7 +587,7 @@ class RentalContract(models.Model):
|
|||
self.user_id.id,
|
||||
self.env.user.company_id.id,
|
||||
'draft',
|
||||
self.tax_id.id,
|
||||
self.tax_id.id if self.tax_id else None, # Handle None value for tax_id
|
||||
untaxed_amount,
|
||||
tax_amount
|
||||
))
|
||||
|
|
@ -602,7 +602,7 @@ class RentalContract(models.Model):
|
|||
|
||||
# Update amounts (e.g., tax calculations) for each rent payment line
|
||||
for line in self.rent_payment_ids:
|
||||
line.write({'tax_id': self.tax_id.id})
|
||||
line.write({'tax_id': self.tax_id.id if self.tax_id else None})
|
||||
line.get_untaxed_amount()
|
||||
line.get_total_amount()
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ 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='')
|
||||
analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account')
|
||||
is_new = fields.Boolean(string="Is New Property?", default=False)
|
||||
suitability_for_residence = fields.Selection([
|
||||
('residential', 'Residential'),
|
||||
|
|
@ -383,4 +386,20 @@ class Property(models.Model):
|
|||
self.write({'unlock':False})
|
||||
else:
|
||||
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',)
|
||||
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')
|
||||
no_of_other_unit = fields.Integer(string='No of Other Units')
|
||||
description = fields.Char(string='Description')
|
||||
total = fields.Integer(string='Total', compute='_compute_total', store=True, readonly=True)
|
||||
|
||||
@api.depends('no_of_house', 'no_of_shop', 'no_of_other_unit')
|
||||
def _compute_total(self):
|
||||
for record in self:
|
||||
record.total = record.no_of_house + record.no_of_shop + record.no_of_other_unit
|
||||
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ access_realestate_internal_property,internal.property,model_internal_property,re
|
|||
access_realestate_re_unit,re.unit,model_re_unit,real_estate.group_real_estate_user,1,1,1,1
|
||||
access_realestate_configuration_property_sketchs,sketchs.sketchs,model_sketchs_sketchs,real_estate.group_real_estate_user,1,1,1,1
|
||||
access_realestate_role_property,role.property,model_property_role,,1,1,1,1
|
||||
access_realestate_floor_property,floor.property,model_floor_unit_details,,1,1,1,1
|
||||
|
||||
|
|
|
|||
|
|
|
@ -30,12 +30,14 @@
|
|||
</button>
|
||||
|
||||
<button class="oe_stat_button" name="get_unit" type="object" icon="fa-home">
|
||||
<field string="Units" name="unit_counts" widget="statinfo"/>
|
||||
</button>
|
||||
<field string="Units" name="unit_counts" widget="statinfo"/>
|
||||
</button>
|
||||
|
||||
<button class="oe_stat_button" string="Documents" name="get_attachments" type="object" icon="fa-file-text-o"/>
|
||||
<button name="action_view_maintenance" type="object" class="oe_stat_button" icon="fa-wrench">
|
||||
<field name="maintenance_count" widget="statinfo" string="Maintenance"/>
|
||||
<button class="oe_stat_button" string="Documents" name="get_attachments" type="object"
|
||||
icon="fa-file-text-o"/>
|
||||
<button name="action_view_maintenance" type="object" class="oe_stat_button"
|
||||
icon="fa-wrench">
|
||||
<field name="maintenance_count" widget="statinfo" string="Maintenance"/>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
|
@ -66,7 +68,7 @@
|
|||
<group>
|
||||
<field name="market_type"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="property_type_id" required="1"
|
||||
<field name="property_type_id" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="company_profit" required="1"/>
|
||||
<field name="company_profit_amount" required="1"/>
|
||||
|
|
@ -75,24 +77,29 @@
|
|||
</group>
|
||||
<group name="other_info" colspan="2" col="4">
|
||||
<field name="branch_manager_id" required="1"/>
|
||||
<field name="company_id" groups="base.group_multi_company" attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="company_id" groups="base.group_multi_company"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
</group>
|
||||
<group name="account" colspan="2" col="4">
|
||||
<field name="analytic_account_id"/>
|
||||
</group>
|
||||
<notebook>
|
||||
<page name="location_info" string="Property Face & Location">
|
||||
<group>
|
||||
<group col="4" colspan="2">
|
||||
<field name="city_id" required="1"
|
||||
<field name="city_id" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="district_id" required="1" domain="[('city_id','=',city_id)]"
|
||||
<field name="district_id" required="1" domain="[('city_id','=',city_id)]"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="street" required="1"
|
||||
<field name="street" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
|
||||
<field name="location" required="1" widget="url" attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
|
||||
<field name="property_no" required="1"
|
||||
<field name="location" required="1" widget="url"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="property_face_ids" widget="many2many_tags"
|
||||
|
||||
<field name="property_no" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="property_face_ids" widget="many2many_tags"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
</group>
|
||||
<group string="Building Length">
|
||||
|
|
@ -125,10 +132,11 @@
|
|||
<group>
|
||||
<group col="4" colspan="2">
|
||||
<field name="user_id" readonly="1"/>
|
||||
<field name="marketer_id" attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="marketer_id"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="block_no" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="licence_no" required="1"
|
||||
<field name="licence_no" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="plate_no"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
|
|
@ -186,60 +194,16 @@
|
|||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page name="unit_info" string="Unit Info">
|
||||
<group>
|
||||
<group>
|
||||
<field name="unit_floor_count" required="1" attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="property_unit_space" />
|
||||
<field name="uexternal_space" />
|
||||
<field name="uspace" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="room_no" readonly="1"/>
|
||||
<field name="hall_no" readonly="1"/>
|
||||
<field name="kitchen_no" readonly="1"/>
|
||||
<field name="bathroom_no" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="unit_ids">
|
||||
<tree>
|
||||
<field name="seq" readonly="1"/>
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="unit_type_id" readonly="1"/>
|
||||
<field name="action_type" readonly="1"/>
|
||||
<field name="space" readonly="1"/>
|
||||
<field name="state" readonly="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page name="prices" string="Prices">
|
||||
<group col="4" colspan="2">
|
||||
<field name="property_space" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
</group>
|
||||
<group col="4" colspan="2">
|
||||
<field name="pur_price"/>
|
||||
<field name="meter_price" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="rent_price"/>
|
||||
<field name="pur_meter_price"/>
|
||||
<field name="curr_price"/>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
<page name="other" string="Other Info">
|
||||
<group col="4" colspan="2">
|
||||
<field name="no_rented_units"/>
|
||||
|
||||
<field name="suitability_for_residence"/>
|
||||
<field name="is_new"/>
|
||||
<field name="no_available_units"/>
|
||||
<field name="no_reserved_units"/>
|
||||
<field name="is_new"/>
|
||||
|
||||
</group>
|
||||
<group colspan="2" col="4">
|
||||
<field name="property_age"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="floors_count" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
|
||||
<field name="appendices"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
|
|
@ -269,6 +233,73 @@
|
|||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
</group>
|
||||
</page>
|
||||
<page name="info_floor" string="Floor Info">
|
||||
<group>
|
||||
<group>
|
||||
<field name="floors_count" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
|
||||
</group>
|
||||
<group>
|
||||
<field name="is_unit_count_fixed"/>
|
||||
<field name="unit_floor_count" required="1" required="1"
|
||||
attrs="{'readonly': [('state', '!=', 'draft'), ('unlock', '=', True)],'invisible': [('is_unit_count_fixed', '=', False)]}"/>
|
||||
</group>
|
||||
<field name="unit_details_ids">
|
||||
<tree>
|
||||
<field name="no_of_house" sum="Total House"/>
|
||||
<field name="no_of_shop" sum="Total Shop"/>
|
||||
<field name="no_of_other_unit" sum="Total Other Units"/>
|
||||
<field name="description"/>
|
||||
<field name="total" readonly="1" sum="Total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</page>
|
||||
<page name="unit_info" string="Unit Info">
|
||||
<group>
|
||||
<group>
|
||||
<field name="no_rented_units"/>
|
||||
<field name="no_available_units"/>
|
||||
<field name="no_reserved_units"/>
|
||||
<field name="property_unit_space"/>
|
||||
<field name="uexternal_space"/>
|
||||
<field name="uspace"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="room_no" readonly="1"/>
|
||||
<field name="hall_no" readonly="1"/>
|
||||
<field name="kitchen_no" readonly="1"/>
|
||||
<field name="bathroom_no" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<field name="unit_ids">
|
||||
<tree>
|
||||
<field name="seq" readonly="1"/>
|
||||
<field name="name" readonly="1"/>
|
||||
<field name="unit_type_id" readonly="1"/>
|
||||
<field name="action_type" readonly="1"/>
|
||||
<field name="space" readonly="1"/>
|
||||
<field name="state" readonly="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
<page name="prices" string="Prices">
|
||||
<group col="4" colspan="2">
|
||||
<field name="property_space" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
</group>
|
||||
<group col="4" colspan="2">
|
||||
<field name="pur_price"/>
|
||||
<field name="meter_price" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="rent_price"/>
|
||||
<field name="pur_meter_price"/>
|
||||
<field name="curr_price"/>
|
||||
</group>
|
||||
</page>
|
||||
|
||||
|
||||
</notebook>
|
||||
|
||||
</sheet>
|
||||
|
|
|
|||
Loading…
Reference in New Issue