IMP add filter Not company on supplierinfo

This commit is contained in:
David Beal
2016-11-30 12:14:42 +01:00
parent 891c64bb1f
commit b41f188eb4
5 changed files with 69 additions and 48 deletions

View File

@@ -1,2 +1,2 @@
# -*- encoding: utf-8 -*-
from . import purchase from . import purchase
from . import supplierinfo

View File

@@ -26,6 +26,7 @@ for any help or question about this module.
'depends': ['purchase'], 'depends': ['purchase'],
'data': [ 'data': [
'purchase_view.xml', 'purchase_view.xml',
'supplierinfo_view.xml',
], ],
'active': False, 'active': False,
} }

View File

@@ -69,51 +69,5 @@
</record> </record>
<!-- Product Supplier Info -->
<record id="product_supplierinfo_view_tree" model="ir.ui.view">
<field name="model">product.supplierinfo</field>
<field name="arch" type="xml">
<tree>
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="product_name"/>
<field name="product_code" string="Supplier Code"/>
<field name="min_qty"/>
<field name="delay"/>
<field name="product_uom"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</tree>
</field>
</record>
<record id="product_supplierinfo_view_filter" model="ir.ui.view">
<field name="model">product.supplierinfo</field>
<field name="arch" type="xml">
<search string="Product">
<field name="name" string="Product (code or name)"
filter_domain="['|',('product_code','ilike',self),('product_name','ilike',self)]"/>
<field name="name" string="Supplier" filter_domain="[('name','ilike',self)]"/>
<group expand='0' string='Group by...'>
<filter string='Supplier' domain="[]" context="{'group_by' : 'name'}"/>
<filter string='Quantity' domain="[]" context="{'group_by' : 'min_qty'}"/>
<filter string='Delay' domain="[]" context="{'group_by' : 'delay'}"/>
</group>
</search>
</field>
</record>
<record id="product_supplierinfo_action" model="ir.actions.act_window">
<field name="name">Product Supplier Info</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.supplierinfo</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="product_supplierinfo_menu"
name="Product Supplier"
parent="purchase.menu_procurement_management_product"
action="product_supplierinfo_action"
sequence="50"/>
</data> </data>
</openerp> </openerp>

View File

@@ -0,0 +1,12 @@
# coding: utf-8
# © 2015 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
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')

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_supplierinfo_view_tree" model="ir.ui.view">
<field name="model">product.supplierinfo</field>
<field name="arch" type="xml">
<tree>
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="product_name"/>
<field name="product_code" string="Supplier Code"/>
<field name="min_qty"/>
<field name="delay"/>
<field name="product_uom"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</tree>
</field>
</record>
<record id="product_supplierinfo_view_filter" model="ir.ui.view">
<field name="model">product.supplierinfo</field>
<field name="arch" type="xml">
<search string="Product">
<field name="name" string="Product (code or name)"
filter_domain="['|',('product_code','ilike',self),('product_name','ilike',self)]"/>
<field name="name" string="Supplier" filter_domain="[('name','ilike',self)]"/>
<filter name="supplier_not_company" string="Supplier is not a company" domain="[('supplier_is_company','=',False)]"/>
<group expand='0' string='Group by...'>
<filter string='Supplier' domain="[]" context="{'group_by' : 'name'}"/>
<filter string='Quantity' domain="[]" context="{'group_by' : 'min_qty'}"/>
<filter string='Delay' domain="[]" context="{'group_by' : 'delay'}"/>
</group>
</search>
</field>
</record>
<record id="product_supplierinfo_action" model="ir.actions.act_window">
<field name="name">Product Supplier Info</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.supplierinfo</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="product_supplierinfo_menu"
name="Product Supplier"
parent="purchase.menu_procurement_management_product"
action="product_supplierinfo_action"
sequence="50"/>
</data>
</openerp>