Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] pylint-odoo: Fix to calculate name of field, referrring to OCA/pylint-odoo#108 #108

Merged

Conversation

JesusZapata
Copy link

Referring to OCA#108

@@ -390,6 +390,12 @@ def colon_list_to_dict(self, colon_list):
"""
return dict([item.split(":") for item in colon_list])

def _convert_value_to_name(self, attribute):
"""Convert 'Field Case SENSITIVE' to 'field_case_sENSITIVE' """
parts = [(part[0].lower() + part[1:]) for part in attribute.split(' ')]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about use title and capitalize builtin functions?
screen shot 2017-01-24 at 3 20 42 pm

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be converted from 'Field Case SENSITIVE' to 'field_case_sENSITIVE'

Is not there a function for that?

Already the word comes in capitalize!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need emit the message just for the following cases:

# E.g. of odoo field: field_name = fields.Type(string='field string')
field_name = field_name.replace('_', ' ')
if field_string in [field_name.capitalize(), field_name.title()]:
    self.add_message(...)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moylop260
I have refactored the code!
Thanks!

@JesusZapata JesusZapata force-pushed the master-pylint-odoo-issue-108-jesuszapata branch from f3d6dcc to 7804514 Compare January 25, 2017 14:30
@JesusZapata JesusZapata force-pushed the master-pylint-odoo-issue-108-jesuszapata branch from 7804514 to 799d637 Compare January 25, 2017 14:41
@moylop260
Copy link

Could you run this new change from addons-vauxoo project, please?

@JesusZapata
Copy link
Author

@moylop260
The output of the command

pylint -r n --disable all --enable attribute-string-redundant --load-plugins=pylint-odoo addons-vauxoo/

************* Module addons-vauxoo.default_warehouse_from_sale_team.models.sales_team
W: 10,24: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.stock_quant_cost_segmentation.model.stock
W:114,20: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:117,22: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:120,26: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:123,18: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.stock_quant_cost_segmentation.model.product
W: 28,20: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 30,22: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 32,26: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 34,18: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.partner_credit_limit.model.partner
W: 15,24: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.stock_card.model.stock_card
W:418,21: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:422,26: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:426,14: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:434,11: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.account_voucher_tax_sat.model.account_voucher_tax_sat
W: 37,11: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.product_do_merge.model.product
W: 31,18: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.product_do_merge.wizard.base_product_merge
W: 61,12: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 72,19: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 74,17: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.purchase_changeless_move_lines.model.purchase
W: 33,21: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.purchase_changeless_move_lines.model.stock_picking
W: 33,21: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.stock_picking_invoice_validation.model.stock_transfer_details
W: 25,24: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.sale_block_cancellation.models.sale
W: 63,19: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.aging_due_report.wizard.wizard
W: 56,15: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 57,11: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 58,10: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 59,12: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 60,14: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 61,15: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:139,11: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:152,12: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:154,14: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:157,15: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:160,14: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:220,15: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:223,14: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:248,20: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:262,11: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W:290,16: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.hr_timesheet_reports.model.hr_timesheet_reports
W:358,14: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.test_sale_team_warehouse.models.test_model
W: 17,16: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 32,16: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.payment_term_type.models.payment_term
W: 35,19: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.website_product_availability.models.product
W: 77,16: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.purchase_incoming_qty.model.product
W: 34,28: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 57,28: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.partner_foreign.model.res_partner
W: 91,14: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.website_rate_product.models.mail_message
W: 30,13: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
W: 66,13: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.purchase_order_line_sequence.model.purchase
W: 54,15: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)
************* Module addons-vauxoo.account_refund_early_payment.wizard.refund_early_payments
W: 76,14: The attribute string is redundant. String parameter equal to name of variable (attribute-string-redundant)

@@ -411,11 +411,13 @@ def visit_call(self, node):
for argument in args:
argument_aux = argument
# Check this 'name = fields.Char("name")'
field_name = \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid use backslash better use (

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@moylop260
Done!

@moylop260 moylop260 merged commit bccb6a8 into Vauxoo:master Jan 26, 2017
@moylop260 moylop260 deleted the master-pylint-odoo-issue-108-jesuszapata branch January 26, 2017 14:26
@moylop260
Copy link

Fix for OCA please

@JesusZapata
Copy link
Author

@moylop260
Done in the PR OCA#100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants