commit
42172f344b
|
|
@ -232,6 +232,7 @@
|
|||
<field name="date"/>
|
||||
<field name="contract_id"/>
|
||||
<field name="property_id"/>
|
||||
<field name="unit_ids" widget="many2many_tags"/>
|
||||
<field name="total_amount"/>
|
||||
|
||||
</tree>
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@
|
|||
<field name="contract_id"/>
|
||||
<field name="renter_id"/>
|
||||
<field name="property_id"/>
|
||||
<field name="unit_ids" widget="many2many_tags"/>
|
||||
<field name="due_date"/>
|
||||
<field name="paid_date"/>
|
||||
<field name="amount"/>
|
||||
|
|
@ -95,7 +96,7 @@
|
|||
<field name="due_date"/>
|
||||
<field name="state"/>
|
||||
<filter string="Due" name="due_payment" domain="[('state','=','due')]"/>
|
||||
<filter string="Not due" name="not_due_payment" domain="[('state','=','not')]"/>
|
||||
<filter string="Not due" name="not_due_payment" domain="[('state','=','draft')]"/>
|
||||
<filter string="Paid" name="paid_payment" domain="[('state','=','paid')]"/>
|
||||
<filter string="Cancelled" name="cancel_payment" domain="[('state','=','cancel')]"/>
|
||||
<separator/>
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
##############################################################################
|
||||
|
||||
import base64
|
||||
import json
|
||||
from lxml import etree
|
||||
import re
|
||||
from odoo import models, fields, api, exceptions, _
|
||||
from odoo.modules.module import get_module_resource
|
||||
|
|
@ -20,7 +22,25 @@ class Property(models.Model):
|
|||
|
||||
# Smart button to count related maintenance records
|
||||
maintenance_count = fields.Integer(string="Maintenance Count", compute='_compute_maintenance_count')
|
||||
is_new = fields.Boolean(string="Is New Property?", default=False)
|
||||
suitability_for_residence = fields.Selection([
|
||||
('residential', 'Residential'),
|
||||
('non_residential', 'Non-Residential'),
|
||||
], string="Property Suitability for Residence")
|
||||
|
||||
@api.model
|
||||
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
|
||||
res = super(PurchaseOrderCustom, self).fields_view_get(view_id=view_id, view_type=view_type, toolbar=toolbar,
|
||||
submenu=submenu)
|
||||
doc = etree.XML(res['arch'])
|
||||
if (view_type == 'form'):
|
||||
for node in doc.xpath("//field"):
|
||||
modifiers['readonly'] = [('state', 'in', ['approve'])]
|
||||
node.set("modifiers", json.dumps(modifiers))
|
||||
res['arch'] = etree.tostring(doc, encoding='unicode')
|
||||
return res
|
||||
|
||||
|
||||
def _compute_maintenance_count(self):
|
||||
for record in self:
|
||||
record.maintenance_count = self.env['property.management.maintenance'].search_count([
|
||||
|
|
@ -70,7 +90,7 @@ class Property(models.Model):
|
|||
('external_investment', 'External Investment'),
|
||||
('include', 'Include')], string="Management Type", default="internal_investment")
|
||||
market_type = fields.Selection([('residential', 'Residential'),
|
||||
('commercial', 'Commercial'),
|
||||
('commercial', 'Commercial'),('residential_commercial', 'Residential and Commercial'),
|
||||
('industrial', 'Industrial'),
|
||||
('other', 'Other')], string="Market Type", default="commercial")
|
||||
other_type = fields.Char(string="Other Type")
|
||||
|
|
|
|||
|
|
@ -9,14 +9,26 @@
|
|||
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")
|
||||
attach_nbr = fields.Integer(compute='get_attachments')
|
||||
active = fields.Boolean(default=True)
|
||||
role_id = fields.Many2one('property.role', string='Role')
|
||||
unlock = fields.Boolean(default=True, string="Unlock")
|
||||
name = fields.Char(string="Unit Name")
|
||||
color = fields.Integer(string='Color Index', compute="set_color")
|
||||
|
|
@ -74,6 +86,16 @@ class Unit(models.Model):
|
|||
]
|
||||
# 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['context'] = "{'default_res_model': '%s','default_res_id': %d}" % (self._name, self.id)
|
||||
return action
|
||||
def get_attachments(self):
|
||||
res = super(Unit, self).get_attachments()
|
||||
domain = [('res_model', '=', 're.unit'), ('res_id', '=', self.id)]
|
||||
self.attach_nbr = self.env['ir.attachment'].search_count(domain)
|
||||
return res
|
||||
|
||||
def _compute_maintenance_count(self):
|
||||
for record in self:
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ access_realestate_configuration_property_state,re.property.state,model_re_proper
|
|||
access_realestate_internal_property,internal.property,model_internal_property,real_estate.group_real_estate_user,1,1,1,1
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
|
@ -34,7 +34,7 @@
|
|||
</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">
|
||||
<button name="action_view_maintenance" type="object" class="oe_stat_button" icon="fa-wrench">
|
||||
<field name="maintenance_count" widget="statinfo" string="Maintenance"/>
|
||||
</button>
|
||||
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
<group>
|
||||
<field name="market_type"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="property_type_id" domain="[('market_type', '=', market_type)]" 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"/>
|
||||
|
|
@ -230,6 +230,8 @@
|
|||
<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"/>
|
||||
</group>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,12 @@
|
|||
<span class="o_stat_text" attrs="{'invisible': [('unlock', '=', True)]}">Lock</span>
|
||||
</button>
|
||||
<!-- Add your buttons here -->
|
||||
<button name="action_view_maintenance" type="object" class="oe_stat_button">
|
||||
<button name="get_attachments" type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-file-text-o">
|
||||
<field name="attach_nbr" widget="statinfo" string="Documents"/>
|
||||
</button>
|
||||
<button name="action_view_maintenance" type="object" icon="fa-wrench" class="oe_stat_button">
|
||||
<field name="maintenance_count" widget="statinfo" string="Maintenance"/>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -39,6 +44,7 @@
|
|||
</h4>
|
||||
<group name="general_info" colspan="2" col="4">
|
||||
<field name="unit_type_id" required="1" attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="unit_category"/>
|
||||
<field name="action_type" required="1" />
|
||||
<field name="company_id" groups="base.group_multi_company" attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="user_id" attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}" required="1"/>
|
||||
|
|
@ -49,6 +55,7 @@
|
|||
<field name="space" required="1"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
<field name="external_space"/>
|
||||
<field name="role_id"/>
|
||||
|
||||
<field name="mezzanine"
|
||||
attrs="{'readonly':[('state','!=','draft'),('unlock','=',True)]}"/>
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@
|
|||
|
||||
</div>
|
||||
<group col="4" colspan="2">
|
||||
<field name="market_type" required="1"/>
|
||||
<field name="market_type" invisible="1" required="0"/>
|
||||
<field name="name" required="1"/>
|
||||
<field name="is_land"/>
|
||||
<field name="is_land" invisible="1"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
</group>
|
||||
</sheet>
|
||||
|
|
@ -188,4 +188,4 @@
|
|||
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
</odoo>
|
||||
|
|
|
|||
Loading…
Reference in New Issue