Supplierinfo: remove field that is not usefull for everybody ; fix addition of supplier on products

This commit is contained in:
Alexis de Lattre
2017-02-09 22:23:36 +01:00
parent 4b26ab78be
commit 869c7176f7
2 changed files with 6 additions and 4 deletions

View File

@@ -8,5 +8,8 @@ from openerp import models, fields
class ProductSupplierinfo(models.Model):
_inherit = 'product.supplierinfo'
supplier_is_company = fields.Boolean(
comodel_name='res.partner', related='name.is_company')
# Change product_tmpl_id to required=False
# because I added that field to form view and it blocks when you save
# the product form with a new supplier info
# This field is now required in the form view
product_tmpl_id = fields.Many2one(required=False)

View File

@@ -9,7 +9,7 @@
<field name="inherit_id" ref="product.product_supplierinfo_form_view"/>
<field name="arch" type="xml">
<field name="name" position="before">
<field name="product_tmpl_id" invisible="not context.get('supplierinfo_main_view')"/>
<field name="product_tmpl_id" invisible="not context.get('supplierinfo_main_view')" required="context.get('supplierinfo_main_view')"/>
</field>
</field>
</record>
@@ -40,7 +40,6 @@
filter_domain="['|', ('product_name','ilike',self), ('product_tmpl_id', 'ilike', self)]"/>
<field name="product_code" string="Product Supplier Code"/>
<field name="name" string="Supplier"/>
<filter name="supplier_not_company" string="Supplier is not a company" domain="[('supplier_is_company','=',False)]"/>
<group expand="0" string="Group by" name="groupby">
<filter name="supplier_groupby" string="Supplier" context="{'group_by' : 'name'}"/>
<filter name="product_groupby" string="Product" context="{'group_by' : 'product_tmpl_id'}"/>