Skip to content
This repository has been archived by the owner on Apr 28, 2022. It is now read-only.

Commit

Permalink
Flake8 fixes (#47)
Browse files Browse the repository at this point in the history
* Flake8 fixes
  • Loading branch information
PCatinean committed Mar 30, 2017
1 parent 10b6b39 commit 8b4f8a6
Show file tree
Hide file tree
Showing 29 changed files with 97 additions and 119 deletions.
16 changes: 1 addition & 15 deletions product_configurator/__manifest__.py
@@ -1,23 +1,9 @@
# -*- coding: utf-8 -*-

{
'name': 'Product Configurator Base',
'version': '1.0',
'version': '10.0.1.0.0',
'category': 'Generic Modules/Base',
'summary': 'Base for product configuration interface modules',
'description': """
Base module offering configurable template products as a
set of instructions for configuration wizards/forms.
Features offered include:
- Inhibition of automatically created variants
- Extension of attribute lines to offer required, custom and multiple
selection
- Configuration / Compatibility rules between attributes
- Images for intermediate and final configurations
- Set of helper methods required for any Odoo configuration module
""",
'author': 'Pledra',
'license': 'AGPL-3',
'website': 'http://www.pledra.com/',
Expand Down
2 changes: 1 addition & 1 deletion product_configurator/data/menu_configurable_product.xml
Expand Up @@ -86,4 +86,4 @@
parent="menu_product_configurable" sequence="50"/>

</data>
</openerp>
</openerp>
2 changes: 1 addition & 1 deletion product_configurator/data/product_attribute.xml
Expand Up @@ -14,4 +14,4 @@
</record>

</data>
</openerp>
</openerp>
2 changes: 1 addition & 1 deletion product_configurator/demo/config_image_ids.xml
Expand Up @@ -88,4 +88,4 @@
])]"/>
</record>

</odoo>
</odoo>
2 changes: 1 addition & 1 deletion product_configurator/demo/product_attribute.xml
Expand Up @@ -339,4 +339,4 @@
<field name="multi" eval="True"/>
</record>

</odoo>
</odoo>
2 changes: 1 addition & 1 deletion product_configurator/demo/product_config_domain.xml
Expand Up @@ -67,4 +67,4 @@
ref('product_attribute_value_220d_xdrive')])]"/>
</record>

</odoo>
</odoo>
2 changes: 1 addition & 1 deletion product_configurator/demo/product_config_lines.xml
Expand Up @@ -44,4 +44,4 @@
<field name="domain_id" ref="product_config_domain_luxury_lines"/>
</record>

</odoo>
</odoo>
14 changes: 7 additions & 7 deletions product_configurator/demo/product_config_step.xml
Expand Up @@ -3,9 +3,9 @@

<!-- Configuration Steps -->

<record id="config_step_engine" model="product.config.step">
<field name="name">Engine</field>
</record>
<record id="config_step_engine" model="product.config.step">
<field name="name">Engine</field>
</record>

<record id="config_step_body" model="product.config.step">
<field name="name">Body</field>
Expand All @@ -19,9 +19,9 @@
<field name="name">Interior</field>
</record>

<record id="config_step_extras" model="product.config.step">
<field name="name">Extras</field>
</record>
<record id="config_step_extras" model="product.config.step">
<field name="name">Extras</field>
</record>

<!-- Configuration Lines -->

Expand Down Expand Up @@ -63,4 +63,4 @@
ref('product_attribute_line_2_series_options')])]"/>
</record>

</odoo>
</odoo>
18 changes: 9 additions & 9 deletions product_configurator/demo/product_template.xml
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="product_category_bmw" model="product.category">
<record id="product_category_bmw" model="product.category">
<field name="parent_id" ref="product.product_category_all"/>
<field name="name">BMW</field>
</record>

<record id="bmw_2_series" model="product.template">
<field name="name">2 Series</field>
<field name="config_ok" eval="True"/>
<field name="type">product</field>
<field name="categ_id" ref="product_category_bmw"/>
<record id="bmw_2_series" model="product.template">
<field name="name">2 Series</field>
<field name="config_ok" eval="True"/>
<field name="type">product</field>
<field name="categ_id" ref="product_category_bmw"/>
<field name="list_price" eval="25000"/>
<field name="image" type="base64" file="product_configurator/static/img/2-series-coupe.jpg"/>
</record>
<field name="image" type="base64" file="product_configurator/static/img/2-series-coupe.jpg"/>
</record>

<record id="product_bmw_sport_line" model="product.product">
<field name="name">Sport Line</field>
Expand Down Expand Up @@ -169,4 +169,4 @@
<field name="image" type="base64" file="product_configurator/static/img/product-paint-silver.jpg"/>
</record>

</odoo>
</odoo>
2 changes: 1 addition & 1 deletion product_configurator/models/account.py
Expand Up @@ -3,7 +3,7 @@
from odoo import models, fields


class account_invoice_line(models.Model):
class AccountInvoiceLine(models.Model):
_inherit = 'account.invoice.line'

product_id = fields.Many2one(domain=[('config_ok', '=', False)])
4 changes: 2 additions & 2 deletions product_configurator/models/product_attribute.py
Expand Up @@ -237,7 +237,7 @@ class ProductAttributeValueCustom(models.Model):

@api.multi
@api.depends('attribute_id', 'attribute_id.uom_id')
def compute_val_name(self):
def _compute_val_name(self):
for attr_val_custom in self:
uom = attr_val_custom.attribute_id.uom_id.name
attr_val_custom.name = '%s%s' % (attr_val_custom.value, uom or '')
Expand All @@ -247,7 +247,7 @@ def compute_val_name(self):
name = fields.Char(
string='Name',
readonly=True,
compute="compute_val_name",
compute="_compute_val_name",
store=True,
)
product_id = fields.Many2one(
Expand Down
9 changes: 5 additions & 4 deletions product_configurator/models/product_config.py
Expand Up @@ -174,8 +174,9 @@ def check_value_attributes(self):
value_attributes = line.value_ids.mapped('attribute_id')
if value_attributes != line.attribute_line_id.attribute_id:
raise ValidationError(
"Values must belong to the attribute of the corresponding "
"attribute_line set on the configuration line"
_("Values must belong to the attribute of the "
"corresponding attribute_line set on the configuration "
"line")
)


Expand Down Expand Up @@ -273,7 +274,7 @@ class ProductConfigSession(models.Model):

@api.multi
@api.depends('value_ids')
def _get_cfg_price(self):
def _compute_cfg_price(self):
for session in self:
custom_vals = session._get_custom_vals_dict()
price = session.product_tmpl_id.get_cfg_price(
Expand Down Expand Up @@ -316,7 +317,7 @@ def _get_custom_vals_dict(self):
string='Custom Values'
)
price = fields.Float(
compute='_get_cfg_price',
compute='_compute_cfg_price',
string='Price',
store=True,
)
Expand Down
8 changes: 4 additions & 4 deletions product_configurator/security/configurator_security.xml
Expand Up @@ -2,9 +2,9 @@
<openerp>
<data>

<record id="product_config_category" model="ir.module.category">
<field name="name">Product Configurator</field>
</record>
<record id="product_config_category" model="ir.module.category">
<field name="name">Product Configurator</field>
</record>

<record id="group_product_configurator" model="res.groups">
<field name="name">Products</field>
Expand All @@ -14,4 +14,4 @@
</record>

</data>
</openerp>
</openerp>
2 changes: 1 addition & 1 deletion product_configurator/views/assets.xml
Expand Up @@ -7,4 +7,4 @@
</xpath>
</template>

</odoo>
</odoo>
2 changes: 1 addition & 1 deletion product_configurator/views/product_attribute_view.xml
Expand Up @@ -102,4 +102,4 @@
</field>
</record>

</odoo>
</odoo>
2 changes: 1 addition & 1 deletion product_configurator/views/product_config_view.xml
Expand Up @@ -145,4 +145,4 @@
</field>
</record>

</odoo>
</odoo>
2 changes: 1 addition & 1 deletion product_configurator/views/product_view.xml
Expand Up @@ -124,4 +124,4 @@
</field>
</record>

</odoo>
</odoo>
40 changes: 20 additions & 20 deletions product_configurator/views/sale_view.xml
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="sale_order_line_form_view" model="ir.ui.view">
<field name="name">product.configurator.sale.order.line.form.view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<record id="sale_order_line_form_view" model="ir.ui.view">
<field name="name">product.configurator.sale.order.line.form.view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">

<xpath expr="//form//notebook//field[@name='order_line']/form/field[@name='name']" position="after">
<div groups="product_configurator.group_product_configurator">
<label for="custom_value_ids"/>
<field name="custom_value_ids">
<tree>
<field name="attribute_id"/>
<field name="name"/>
<field name="attachment_ids" widget="many2many_tags"/>
</tree>
</field>
</div>
</xpath>
<xpath expr="//form//notebook//field[@name='order_line']/form/field[@name='name']" position="after">
<div groups="product_configurator.group_product_configurator">
<label for="custom_value_ids"/>
<field name="custom_value_ids">
<tree>
<field name="attribute_id"/>
<field name="name"/>
<field name="attachment_ids" widget="many2many_tags"/>
</tree>
</field>
</div>
</xpath>

</field>
</record>
</field>
</record>

</odoo>
</odoo>
3 changes: 1 addition & 2 deletions product_configurator_mrp/__manifest__.py
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
{
'name': 'Product Configurator Manufacturing',
'version': '1.0',
'version': '10.0.1.0.0',
'category': 'Manufacturing',
'summary': 'BOM Support for configurable products',
'description': """Add boms to configured products""",
'author': 'Pledra',
'license': 'AGPL-3',
'website': 'http://www.pledra.com/',
Expand Down
Expand Up @@ -8,4 +8,4 @@
<field name="users" eval="[(4, ref('base.user_root'))]"/>
</record>

</odoo>
</odoo>
10 changes: 1 addition & 9 deletions product_configurator_wizard/__manifest__.py
@@ -1,17 +1,9 @@
# -*- coding: utf-8 -*-
{
'name': 'Product Configurator Wizard',
'version': '1.0',
'version': '10.0.1.0.0',
'category': 'Generic Modules/Base',
'summary': 'Back-end Product Configurator',
'description': """
This module provides a backend configuration wizard for generating
products directly from any Odoo standard model such as Sale Order,
Production Order etc.
The view is dynamically generated using the information provided
on the configurable template.
""",
'author': 'Pledra',
'license': 'AGPL-3',
'website': 'http://www.pledra.com/',
Expand Down
2 changes: 1 addition & 1 deletion product_configurator_wizard/views/assets.xml
Expand Up @@ -7,4 +7,4 @@
</xpath>
</template>

</odoo>
</odoo>
2 changes: 1 addition & 1 deletion product_configurator_wizard/views/sale_view.xml
Expand Up @@ -46,4 +46,4 @@
</field>
</record>

</odoo>
</odoo>

0 comments on commit 8b4f8a6

Please sign in to comment.