Browse Source

[ADD] S0005 : Produits - Labels bio/éthique/provenance

pull/1/head
Thibault Francois 9 years ago
parent
commit
a86c73f270
  1. 2
      beesdoo_product/__init__.py
  2. 33
      beesdoo_product/__openerp__.py
  3. 65
      beesdoo_product/data/product_label.xml
  4. 2
      beesdoo_product/models/__init__.py
  5. 18
      beesdoo_product/models/beesdoo_product.py
  6. 3
      beesdoo_product/security/ir.model.access.csv
  7. 30
      beesdoo_product/views/beesdoo_product.xml

2
beesdoo_product/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import models

33
beesdoo_product/__openerp__.py

@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
{
'name': "beesdoo_product",
'summary': """
Modification of product module for the needs of beescoop
- SOOO5 - Ajout de label bio/ethique/provenance""",
'description': """
""",
'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_base', 'product'],
# always loaded
'data': [
'data/product_label.xml',
'views/beesdoo_product.xml',
'security/ir.model.access.csv',
],
# only loaded in demonstration mode
'demo': [],
}

65
beesdoo_product/data/product_label.xml

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record model="beesdoo.product.label" id="eco_green">
<field name="name">Label Bio ou Confiance</field>
<field name="type">eco</field>
<field name="color_code">#40ff00</field>
</record>
<record model="beesdoo.product.label" id="eco_orange">
<field name="name">Agriculture raisonnée</field>
<field name="type">eco</field>
<field name="color_code">#ffa200</field>
</record>
<record model="beesdoo.product.label" id="eco_red">
<field name="name">Conventionnel</field>
<field name="type">eco</field>
<field name="color_code">#ff4000</field>
</record>
<record model="beesdoo.product.label" id="local_green">
<field name="name">Belgique</field>
<field name="type">local</field>
<field name="color_code">#40ff00</field>
</record>
<record model="beesdoo.product.label" id="local_orange">
<field name="name">Europe</field>
<field name="type">local</field>
<field name="color_code">#ffa200</field>
</record>
<record model="beesdoo.product.label" id="local_red">
<field name="name">Monde</field>
<field name="type">local</field>
<field name="color_code">#ff4000</field>
</record>
<record model="beesdoo.product.label" id="fair_green">
<field name="name">Label par tiers</field>
<field name="type">fair</field>
<field name="color_code">#40ff00</field>
</record>
<record model="beesdoo.product.label" id="fair_orange">
<field name="name">Préserve l’intérêt</field>
<field name="type">fair</field>
<field name="color_code">#ffa200</field>
</record>
<record model="beesdoo.product.label" id="fair_red">
<field name="name">Aucune garantie</field>
<field name="type">fair</field>
<field name="color_code">#ff4000</field>
</record>
<record model="beesdoo.product.label" id="delivery_green">
<field name="name">Intermédiaire coopératif</field>
<field name="type">delivery</field>
<field name="color_code">#40ff00</field>
</record>
<record model="beesdoo.product.label" id="delivery_orange">
<field name="name">Grossiste biologique</field>
<field name="type">delivery</field>
<field name="color_code">#ffa200</field>
</record>
<record model="beesdoo.product.label" id="delivery_red">
<field name="name">Grossiste industriel</field>
<field name="type">delivery</field>
<field name="color_code">#ff4000</field>
</record>
</data>
</odoo>

2
beesdoo_product/models/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import beesdoo_product

18
beesdoo_product/models/beesdoo_product.py

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
class BeesdooProduct(models.Model):
_inherit = "product.template"
eco_label = fields.Many2one('beesdoo.product.label', domain = [('type', '=', 'eco')])
local_label = fields.Many2one('beesdoo.product.label', domain = [('type', '=', 'local')])
fair_label = fields.Many2one('beesdoo.product.label', domain = [('type', '=', 'fair')])
origin_label = fields.Many2one('beesdoo.product.label', domain = [('type', '=', 'delivery')])
class BeesdooProductLabel(models.Model):
_name = "beesdoo.product.label"
name = fields.Char()
type = fields.Selection([('eco', 'Écologique'), ('local', 'Local'), ('fair', 'Équitable'), ('delivery', 'Distribution')])
color_code = fields.Char()

3
beesdoo_product/security/ir.model.access.csv

@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
beesdoo_product_label_read_all,beesdoo.product.label Read All,model_beesdoo_product_label,,1,0,0,0
beesdoo_product_label_all_access_sale_manager,beesdoo.product.label All Access Sale Manager,model_beesdoo_product_label,base.group_sale_manager,1,1,1,1

30
beesdoo_product/views/beesdoo_product.xml

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="beesdoo_product_form">
<field name="name">bees.product.template.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view" />
<field name="arch" type="xml">
<field name="barcode" position="after">
<field name="eco_label" />
<field name="local_label" />
<field name="fair_label" />
<field name="origin_label" />
</field>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_product_label_form">
<field name="name">bees.product.label.form</field>
<field name="model">beesdoo.product.label</field>
<field name="arch" type="xml">
<form>
<group>
<field name="name" />
<field name="type" />
<field name="color_code" />
</group>
</form>
</field>
</record>
</odoo>
Loading…
Cancel
Save