Browse Source

Merge pull request #135 from beescoop/12.0-mig-obeesdoo-beesdoo_custom

[12.0] [MIG] beesdoo_custom
pull/152/head 12.0-2020-05-12.01
Rémy Taymans 5 years ago
committed by GitHub
parent
commit
ab7938d1c6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      beesdoo_product_usability/__init__.py
  2. 22
      beesdoo_product_usability/__manifest__.py
  3. 1
      beesdoo_product_usability/models/__init__.py
  4. 28
      beesdoo_product_usability/models/beesdoo_product.py
  5. 40
      beesdoo_product_usability/views/beesdoo_product.xml

1
beesdoo_product_usability/__init__.py

@ -0,0 +1 @@
from . import models

22
beesdoo_product_usability/__manifest__.py

@ -0,0 +1,22 @@
# Copyright 2017 - 2020 BEES coop SCRLfs
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "BEES coop Product Usability",
'description': """
Adapt the
""",
'author': "Beescoop - Cellule IT, Coop IT Easy",
'website': "https://github.com/beescoop/Obeesdoo",
'category': 'Sales Management',
'version': '12.0.1.0.0',
'depends': [
'beesdoo_product',
'beesdoo_stock_coverage',
'beesdoo_purchase',
],
'data': [
'views/beesdoo_product.xml',
],
}

1
beesdoo_product_usability/models/__init__.py

@ -0,0 +1 @@
from . import beesdoo_product

28
beesdoo_product_usability/models/beesdoo_product.py

@ -0,0 +1,28 @@
from odoo 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

40
beesdoo_product_usability/views/beesdoo_product.xml

@ -0,0 +1,40 @@
<?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="default_code"/>
<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="stock_coverage"/>
<field name="daily_sales"/>
<field name="range_sales"/>
</tree>
</field>
</record>
<record id="purchase.product_normal_action_puchased" model="ir.actions.act_window">
<field name="view_mode">tree,form,kanban</field>
</record>
<record id="product.product_template_action" model="ir.actions.act_window">
<field name="view_mode">tree,form,kanban</field>
</record>
<record id="stock.product_template_action_product" model="ir.actions.act_window">
<field name="view_mode">tree,form,kanban</field>
</record>
</odoo>
Loading…
Cancel
Save