Skip to content

Commit

Permalink
[ADD] product_supplierinfo_expand_view
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-CA committed Nov 17, 2015
1 parent a1a147f commit 793f654
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 0 deletions.
16 changes: 16 additions & 0 deletions product_supplierinfo_expand_view/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:alt: License: AGPL-3
================================
Product supplierinfo expand view
================================
This module expands product_supplierinfo view to show partner reference and
also product data on product procurements tab tree view.

Credits
=======

Contributors
------------
* Daniel Campos <danielcampos@avanzosc.es>
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
* Ana Juaristi <ajuaristio@gmail.com>
5 changes: 5 additions & 0 deletions product_supplierinfo_expand_view/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# (c) 2015 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import models
18 changes: 18 additions & 0 deletions product_supplierinfo_expand_view/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# (c) 2015 Daniel Campos - Avanzosc S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

{
"name": "Product Supplierinfo expand view",
"version": "1.0",
'author': 'OdooMRP team',
'website': "http://www.odoomrp.com",
'contributors': ["Daniel Campos <danielcampos@avanzosc.es>",
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
"Ana Juaristi <ajuaristio@gmail.com>"],
"depends": ['product'],
"category": "Tools",
"data": ['views/product_supplierinfo_view.xml'
],
"installable": True
}
5 changes: 5 additions & 0 deletions product_supplierinfo_expand_view/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# (c) 2015 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import product_supplierinfo
44 changes: 44 additions & 0 deletions product_supplierinfo_expand_view/models/product_supplierinfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# (c) 2015 Daniel Campos - Avanzosc S.L.
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from openerp import models, fields, api


class ProductSupplierinfo(models.Model):
_inherit = 'product.supplierinfo'

partner_code = fields.Char(related='name.ref')

#
# @api.multi
# @api.onchange('name')
# def _supplier_code(self):
# res = {}
# if self.product_tmpl_id:
# res = {'default_code': self.name.ref}
# self.product_tmpl_id.default_code = self.name.ref
# return res
#
# @api.multi
# @api.onchange('type')
# def onchange_type(self):
# if self.type == 'supplier':
# return {'domain': {'name': [('supplier', '=', True)]}}
# elif self.type == 'customer':
# return {'domain': {'name': [('customer', '=', True)]}}
# return {'domain': {'name': []}}
#
# def search(self, cr, uid, args, offset=0, limit=None, order=None,
# context=None, count=False):
# """Add search argument for field type if the context says so. This
# should be in old API because context argument is not the last one.
# """
# if context is None:
# context = {}
# if not any(arg[0] == 'type' for arg in args):
# args += [('type', '=',
# context.get('supplierinfo_type', 'supplier'))]
# return super(ProductSupplierinfo, self).search(
# cr, uid, args, offset=offset, limit=limit, order=order,
# context=context, count=count)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="product_supplierinfo_form_view">
<field name="name">product.supplierinfo.form.view.ext</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_form_view" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="partner_code" string="Partner Reference" />
</field>
</field>
</record>
<record id="product_supplierinfo_tree_view" model="ir.ui.view">
<field name="name">product.supplierinfo.tree.view</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_tree_view" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="partner_code"/>
<field name="product_name"/>
<field name="product_code"/>
</field>
</field>
</record>
</data>
</openerp>

0 comments on commit 793f654

Please sign in to comment.