Browse Source
Merge pull request #46 from robinkeunen/9.0-custom-product-view
[ADD] custom beesdoo product view
pull/58/head
Robin Keunen
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
84 additions and
0 deletions
-
beesdoo_custom/__init__.py
-
beesdoo_custom/__openerp__.py
-
beesdoo_custom/models/__init__.py
-
beesdoo_custom/models/beesdoo_product.py
-
beesdoo_custom/views/beesdoo_product.xml
|
@ -0,0 +1 @@ |
|
|
|
|
|
from . import models |
|
@ -0,0 +1,27 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
{ |
|
|
|
|
|
'name': "beesdoo_custom", |
|
|
|
|
|
|
|
|
|
|
|
'summary': """ |
|
|
|
|
|
View and field definition specific to BEES' needs. |
|
|
|
|
|
""", |
|
|
|
|
|
|
|
|
|
|
|
'author': "Beescoop - Cellule IT", |
|
|
|
|
|
'website': "https://github.com/beescoop/Obeesdoo", |
|
|
|
|
|
|
|
|
|
|
|
# Categories can be used to filter modules in modules listing |
|
|
|
|
|
# Check https://github.com/odoo/odoo/blob/master/openerp/addons/base/module/module_data.xml |
|
|
|
|
|
# for the full list |
|
|
|
|
|
'category': 'Sales Management', |
|
|
|
|
|
'version': '0.1', |
|
|
|
|
|
|
|
|
|
|
|
# any module necessary for this one to work correctly |
|
|
|
|
|
'depends': [ |
|
|
|
|
|
'beesdoo_product', |
|
|
|
|
|
], |
|
|
|
|
|
|
|
|
|
|
|
# always loaded |
|
|
|
|
|
'data': [ |
|
|
|
|
|
'views/beesdoo_product.xml', |
|
|
|
|
|
], |
|
|
|
|
|
} |
|
@ -0,0 +1 @@ |
|
|
|
|
|
from . import beesdoo_product |
|
@ -0,0 +1,29 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
from openerp import models, fields, api |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BeesdooProduct(models.Model): |
|
|
|
|
|
_inherit = "product.template" |
|
|
|
|
|
|
|
|
|
|
|
main_supplierinfo = fields.Many2one( |
|
|
|
|
|
'product.supplierinfo', |
|
|
|
|
|
string='Main Supplier Information', |
|
|
|
|
|
compute='_compute_main_supplierinfo' |
|
|
|
|
|
) |
|
|
|
|
|
main_price = fields.Float( |
|
|
|
|
|
string='Price', |
|
|
|
|
|
compute='_compute_main_supplierinfo', |
|
|
|
|
|
) |
|
|
|
|
|
main_minimum_qty = fields.Float( |
|
|
|
|
|
string='Minimum Quantity', |
|
|
|
|
|
compute='_compute_main_supplierinfo', |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
@api.multi |
|
|
|
|
|
@api.depends('seller_ids') |
|
|
|
|
|
def _compute_main_supplierinfo(self): |
|
|
|
|
|
for product in self: |
|
|
|
|
|
supplierinfo = product._get_main_supplier_info() |
|
|
|
|
|
product.main_supplierinfo = supplierinfo |
|
|
|
|
|
product.main_price = supplierinfo.price |
|
|
|
|
|
product.main_minimum_qty = supplierinfo.min_qty |
|
@ -0,0 +1,26 @@ |
|
|
|
|
|
<?xml version="1.0" encoding="utf-8"?> |
|
|
|
|
|
<odoo> |
|
|
|
|
|
|
|
|
|
|
|
<record model="ir.ui.view" id="beesdoo_product_tree"> |
|
|
|
|
|
<field name="name">bees.product.template.tree</field> |
|
|
|
|
|
<field name="model">product.template</field> |
|
|
|
|
|
<field name="priority">14</field> |
|
|
|
|
|
<field name="arch" type="xml"> |
|
|
|
|
|
<tree> |
|
|
|
|
|
<field name="name"/> |
|
|
|
|
|
<field name="categ_id"/> |
|
|
|
|
|
<field name="main_seller_id" string="Main Seller"/> |
|
|
|
|
|
<field name="weight"/> |
|
|
|
|
|
<field name="main_price"/> |
|
|
|
|
|
<field name="main_minimum_qty"/> |
|
|
|
|
|
<field name="uom_po_id"/> |
|
|
|
|
|
<field name="qty_available"/> |
|
|
|
|
|
<field name="virtual_available"/> |
|
|
|
|
|
<field name="estimated_stock_coverage"/> |
|
|
|
|
|
<field name="average_consumption"/> |
|
|
|
|
|
<field name="total_consumption"/> |
|
|
|
|
|
</tree> |
|
|
|
|
|
</field> |
|
|
|
|
|
</record> |
|
|
|
|
|
|
|
|
|
|
|
</odoo> |