Skip to content

Commit

Permalink
[IMP]Improved code as per flake 8.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitavaghela committed Nov 28, 2019
1 parent 8aafeb4 commit bc66dae
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
54 changes: 36 additions & 18 deletions connector_alndata/models/crm_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def remove_data(self, model, datas, origin=''):
rec.ref not in datas:
removed_ids.append(rec.id)
rem += rec
rem.write({'active':False})
rem.write({'active': False})
return removed_ids

def get_state(self, obj, state_code):
Expand Down Expand Up @@ -153,7 +153,8 @@ def sync_market_data(self):
market = industry_obj.create(market_vals)
market_ids.append(market.id)
_logger.info('ALN Data Connector.Created Market Ids : %s', market_ids)
_logger.info('ALN Data Connector.Updated Market Ids : %s', updated_market_ids)
_logger.info('ALN Data Connector.Updated Market Ids : %s',
updated_market_ids)

@api.model
def sync_submarket_data(self):
Expand All @@ -180,8 +181,10 @@ def sync_submarket_data(self):
else:
available_submarket.write(submarket_vals)
updated_submarket_ids.append(available_submarket.id)
_logger.info('ALN Data Connector.Created SubMarket Ids : %s', submarket_ids)
_logger.info('ALN Data Connector.Updated SubMarket Ids : %s', updated_submarket_ids)
_logger.info(
'ALN Data Connector.Created SubMarket Ids : %s', submarket_ids)
_logger.info('ALN Data Connector.Updated SubMarket Ids : %s',
updated_submarket_ids)

@api.model
def sync_status_code_data(self):
Expand All @@ -202,7 +205,8 @@ def sync_status_code_data(self):
}
state = status_obj.create(state_vals)
stage_ids.append(state.id)
_logger.info('ALN Data Connector.Created FSM Stage Ids : %s', stage_ids)
_logger.info(
'ALN Data Connector.Created FSM Stage Ids : %s', stage_ids)

@api.model
def get_title(self, obj, title):
Expand Down Expand Up @@ -481,16 +485,21 @@ def sync_owner_contact_data(self, origin=''):
max_date = last_update_date and max(last_update_date) or 0

if origin == 'contact':
_logger.info('ALN Data Connector.Created Contacts : %s', contact_ids)
_logger.info('ALN Data Connector.Updated Contacts : %s', updated_contact_ids)
_logger.info('ALN Data Connector.Deleted Contacts : %s', removed_lead)
_logger.info(
'ALN Data Connector.Created Contacts : %s', contact_ids)
_logger.info('ALN Data Connector.Updated Contacts : %s',
updated_contact_ids)
_logger.info(
'ALN Data Connector.Deleted Contacts : %s', removed_lead)
if row_version:
config_obj.sudo().set_param(
'alndata.contacts.rowversion', row_version)
elif origin == 'owner':
_logger.info('ALN Data Connector.Created Owners : %s', owner_ids)
_logger.info('ALN Data Connector.Updated Owners : %s', updated_owner_ids)
_logger.info('ALN Data Connector.Deleted Owners : %s', removed_lead)
_logger.info('ALN Data Connector.Updated Owners : %s',
updated_owner_ids)
_logger.info(
'ALN Data Connector.Deleted Owners : %s', removed_lead)
elif origin == 'new_construction':
_logger.info('ALN Data Connector.Created New Constructions : %s',
construction_ids)
Expand All @@ -506,18 +515,25 @@ def sync_owner_contact_data(self, origin=''):
config_obj.sudo().set_param(
'alndata.managementcompanies.rowversion', row_version)
_logger.info(
'ALN Data Connector.Created Management Companies Partners : %s', partner_ids)
'ALN Data Connector.Created Management Companies Partners'
' : %s', partner_ids)
_logger.info(
'ALN Data Connector.Updated Management Companies Partners : %s',
'ALN Data Connector.Updated Management Companies Partners '
': %s',
updated_partner_ids)
_logger.info(
'ALN Data Connector.Deleted Management Companies Partners : %s',
'ALN Data Connector.Deleted Management Companies Partners '
': %s',
removed_partner)
_logger.info('ALN Data Connector.Created Management Companies Leads : %s', lead_ids)
_logger.info('ALN Data Connector.Updated Management Companies Leads : %s',
_logger.info(
'ALN Data Connector.Created Management Companies Leads '
': %s', lead_ids)
_logger.info('ALN Data Connector.Updated Management Companies '
'Leads : %s',
updated_lead_ids)
_logger.info(
'ALN Data Connector.Deleted Management Companies Leads : %s', removed_lead)
'ALN Data Connector.Deleted Management Companies Leads :'
' %s', removed_lead)

@api.model
def sync_apartment_data(self):
Expand Down Expand Up @@ -649,8 +665,10 @@ def sync_apartment_data(self):
'alndata.apartments.rowversion', row_version)
_logger.info(
'ALN Data Connector.Created Fsm Location : %s', create_apart_ids)
_logger.info('ALN Data Connector.Updated Fsm Location : %s', update_apart_ids)
_logger.info('ALN Data Connector.Deleted Fsm Location : %s', removed_apart_ids)
_logger.info(
'ALN Data Connector.Updated Fsm Location : %s', update_apart_ids)
_logger.info(
'ALN Data Connector.Deleted Fsm Location : %s', removed_apart_ids)

@api.model
def sync_aln_data_with_threading(self):
Expand Down
4 changes: 2 additions & 2 deletions connector_alndata/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ResPartner(models.Model):
_inherit = "res.partner"

@api.multi
def get_number_unit(self):
def _compute_number_unit(self):
"""Calculate Number of Units.
This method is used to calculate the number of units
Expand All @@ -29,5 +29,5 @@ def get_number_unit(self):
('new_construction', 'New Constructions')],
'Partner Type')
address_type = fields.Char('AddressType')
num_unit = fields.Integer(compute="get_number_unit",
num_unit = fields.Integer(compute="_compute_number_unit",
string="Number of Apartments")

0 comments on commit bc66dae

Please sign in to comment.