Your Name
9 years ago
12 changed files with 317 additions and 0 deletions
-
3beesdoo_product/__init__.py
-
37beesdoo_product/__openerp__.py
-
20beesdoo_product/controllers.py
-
17beesdoo_product/data/label_color.xml
-
65beesdoo_product/data/product_label.xml
-
30beesdoo_product/demo.xml
-
2beesdoo_product/models/__init__.py
-
25beesdoo_product/models/beesdoo_product.py
-
2beesdoo_product/security/ir.model.access.csv
-
22beesdoo_product/templates.xml
-
60beesdoo_product/views.xml
-
34beesdoo_product/views/beesdoo_product.xml
@ -0,0 +1,3 @@ |
|||
# -*- coding: utf-8 -*- |
|||
import controllers |
|||
import models |
@ -0,0 +1,37 @@ |
|||
# -*- coding: utf-8 -*- |
|||
{ |
|||
'name': "beesdoo_product", |
|||
|
|||
'summary': """ |
|||
SOOO5 - Ajout de label bio/ethique/provenance""", |
|||
|
|||
'description': """ |
|||
Long description of module's purpose |
|||
""", |
|||
|
|||
'author': "My Company", |
|||
'website': "http://www.yourcompany.com", |
|||
|
|||
# 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': 'Uncategorized', |
|||
'version': '0.1', |
|||
|
|||
# any module necessary for this one to work correctly |
|||
'depends': ['base', 'product'], |
|||
|
|||
# always loaded |
|||
'data': [ |
|||
# 'security/ir.model.access.csv', |
|||
'views.xml', |
|||
'templates.xml', |
|||
'data/product_label.xml', |
|||
'data/label_color.xml', |
|||
'views/beesdoo_product.xml' |
|||
], |
|||
# only loaded in demonstration mode |
|||
'demo': [ |
|||
'demo.xml', |
|||
], |
|||
} |
@ -0,0 +1,20 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from openerp import http |
|||
|
|||
# class BeesdooLabel(http.Controller): |
|||
# @http.route('/beesdoo_product/beesdoo_product/', auth='public') |
|||
# def index(self, **kw): |
|||
# return "Hello, world" |
|||
|
|||
# @http.route('/beesdoo_product/beesdoo_product/objects/', auth='public') |
|||
# def list(self, **kw): |
|||
# return http.request.render('beesdoo_product.listing', { |
|||
# 'root': '/beesdoo_product/beesdoo_product', |
|||
# 'objects': http.request.env['beesdoo_product.beesdoo_product'].search([]), |
|||
# }) |
|||
|
|||
# @http.route('/beesdoo_product/beesdoo_product/objects/<model("beesdoo_product.beesdoo_product"):obj>/', auth='public') |
|||
# def object(self, obj, **kw): |
|||
# return http.request.render('beesdoo_product.object', { |
|||
# 'object': obj |
|||
# }) |
@ -0,0 +1,17 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<record model="beesdoo.label.color" id="green"> |
|||
<field name="name">Vert</field> |
|||
<field name="color_code">#40ff00</field> |
|||
</record> |
|||
|
|||
<record model="beesdoo.label.color" id="orange"> |
|||
<field name="name">Orange</field> |
|||
<field name="color_code">#ffa200</field> |
|||
</record> |
|||
|
|||
<record model="beesdoo.label.color" id="red"> |
|||
<field name="name">Rouge</field> |
|||
<field name="color_code">#ff4000</field> |
|||
</record> |
|||
</odoo> |
@ -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">green</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">orange</field> --> |
|||
</record> |
|||
<record model="beesdoo.product.label" id="eco_red"> |
|||
<field name="name">Conventionnel</field> |
|||
<field name="type">eco</field> |
|||
<field name="color" ref="red"/> |
|||
</record> |
|||
<record model="beesdoo.product.label" id="local_green"> |
|||
<field name="name">Belgique</field> |
|||
<field name="type">local</field> |
|||
<!-- <field name="color">green</field> --> |
|||
</record> |
|||
<record model="beesdoo.product.label" id="local_orange"> |
|||
<field name="name">Europe</field> |
|||
<field name="type">local</field> |
|||
<!-- <field name="color">orange</field> --> |
|||
</record> |
|||
<record model="beesdoo.product.label" id="local_red"> |
|||
<field name="name">Monde</field> |
|||
<field name="type">local</field> |
|||
<!-- <field name="color">red</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">green</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">orange</field> --> |
|||
</record> |
|||
<record model="beesdoo.product.label" id="fair_red"> |
|||
<field name="name">Aucune garantie</field> |
|||
<field name="type">fair</field> |
|||
<!-- <field name="color">red</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">green</field> --> |
|||
</record> |
|||
<record model="beesdoo.product.label" id="delivery_orange"> |
|||
<field name="name">Grossiste biologique</field> |
|||
<field name="type">delivery</field> |
|||
<!-- <field name="color">orange</field> --> |
|||
</record> |
|||
<record model="beesdoo.product.label" id="delivery_red"> |
|||
<field name="name">Grossiste industriel</field> |
|||
<field name="type">delivery</field> |
|||
<!-- <field name="color">red</field> --> |
|||
</record> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,30 @@ |
|||
<openerp> |
|||
<data> |
|||
<!-- --> |
|||
<!-- <record id="object0" model="beesdoo_label.beesdoo_label"> --> |
|||
<!-- <field name="name">Object 0</field> --> |
|||
<!-- <field name="value">0</field> --> |
|||
<!-- </record> --> |
|||
<!-- --> |
|||
<!-- <record id="object1" model="beesdoo_label.beesdoo_label"> --> |
|||
<!-- <field name="name">Object 1</field> --> |
|||
<!-- <field name="value">10</field> --> |
|||
<!-- </record> --> |
|||
<!-- --> |
|||
<!-- <record id="object2" model="beesdoo_label.beesdoo_label"> --> |
|||
<!-- <field name="name">Object 2</field> --> |
|||
<!-- <field name="value">20</field> --> |
|||
<!-- </record> --> |
|||
<!-- --> |
|||
<!-- <record id="object3" model="beesdoo_label.beesdoo_label"> --> |
|||
<!-- <field name="name">Object 3</field> --> |
|||
<!-- <field name="value">30</field> --> |
|||
<!-- </record> --> |
|||
<!-- --> |
|||
<!-- <record id="object4" model="beesdoo_label.beesdoo_label"> --> |
|||
<!-- <field name="name">Object 4</field> --> |
|||
<!-- <field name="value">40</field> --> |
|||
<!-- </record> --> |
|||
<!-- --> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,2 @@ |
|||
# -*- coding: utf-8 -*- |
|||
import beesdoo_product |
@ -0,0 +1,25 @@ |
|||
# -*- 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 = fields.Many2one('beesdoo.label.color') |
|||
|
|||
class BeesdooLabelColor(models.Model): |
|||
_name = 'beesdoo.label.color' |
|||
|
|||
name = fields.Char() |
|||
color_code = fields.Char() |
|||
|
|||
|
@ -0,0 +1,2 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
access_beesdoo_label_beesdoo_label,beesdoo_label.beesdoo_label,model_beesdoo_label_beesdoo_label,,1,0,0,0 |
@ -0,0 +1,22 @@ |
|||
<openerp> |
|||
<data> |
|||
<!-- <template id="listing"> --> |
|||
<!-- <ul> --> |
|||
<!-- <li t-foreach="objects" t-as="object"> --> |
|||
<!-- <a t-attf-href="#{ root }/objects/#{ object.id }"> --> |
|||
<!-- <t t-esc="object.display_name"/> --> |
|||
<!-- </a> --> |
|||
<!-- </li> --> |
|||
<!-- </ul> --> |
|||
<!-- </template> --> |
|||
<!-- <template id="object"> --> |
|||
<!-- <h1><t t-esc="object.display_name"/></h1> --> |
|||
<!-- <dl> --> |
|||
<!-- <t t-foreach="object._fields" t-as="field"> --> |
|||
<!-- <dt><t t-esc="field"/></dt> --> |
|||
<!-- <dd><t t-esc="object[field]"/></dd> --> |
|||
<!-- </t> --> |
|||
<!-- </dl> --> |
|||
<!-- </template> --> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,60 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<!-- explicit list view definition --> |
|||
<!-- |
|||
<record model="ir.ui.view" id="beesdoo_label.list"> |
|||
<field name="name">beesdoo_label list</field> |
|||
<field name="model">beesdoo_label.beesdoo_label</field> |
|||
<field name="arch" type="xml"> |
|||
<tree> |
|||
<field name="name"/> |
|||
<field name="value"/> |
|||
<field name="value2"/> |
|||
</tree> |
|||
</field> |
|||
</record> |
|||
--> |
|||
|
|||
<!-- actions opening views on models --> |
|||
<!-- |
|||
<record model="ir.actions.act_window" id="beesdoo_label.action_window"> |
|||
<field name="name">beesdoo_label window</field> |
|||
<field name="res_model">beesdoo_label.beesdoo_label</field> |
|||
<field name="view_mode">tree,form</field> |
|||
</record> |
|||
--> |
|||
|
|||
<!-- server action to the one above --> |
|||
<!-- |
|||
<record model="ir.actions.server" id="beesdoo_label.action_server"> |
|||
<field name="name">beesdoo_label server</field> |
|||
<field name="model_id" ref="model_beesdoo_label_beesdoo_label"/> |
|||
<field name="code"> |
|||
action = { |
|||
"type": "ir.actions.act_window", |
|||
"view_mode": "tree,form", |
|||
"res_model": self._name, |
|||
} |
|||
</field> |
|||
</record> |
|||
--> |
|||
|
|||
<!-- Top menu item --> |
|||
<!-- |
|||
<menuitem name="beesdoo_label" id="beesdoo_label.menu_root"/> |
|||
--> |
|||
<!-- menu categories --> |
|||
<!-- |
|||
<menuitem name="Menu 1" id="beesdoo_label.menu_1" parent="beesdoo_label.menu_root"/> |
|||
<menuitem name="Menu 2" id="beesdoo_label.menu_2" parent="beesdoo_label.menu_root"/> |
|||
--> |
|||
<!-- actions --> |
|||
<!-- |
|||
<menuitem name="List" id="beesdoo_label.menu_1_list" parent="beesdoo_label.menu_1" |
|||
action="beesdoo_label.action_window"/> |
|||
<menuitem name="Server to list" id="beesdoo_label" parent="beesdoo_label.menu_2" |
|||
action="beesdoo_label.action_server"/> |
|||
--> |
|||
</data> |
|||
</openerp> |
@ -0,0 +1,34 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<record model="ir.ui.view" id="beesdoo_product_form"> |
|||
<field name="name">bees.product.template</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="invoice_policy" 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="product_category_form_inherit"> |
|||
<field name="name">bees.product.category</field> |
|||
<field name="model">product.category</field> |
|||
<field name="inherit_id" ref="product.product_category_form_view" /> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//form" position="inside"> |
|||
<group string="Label"> |
|||
<field name="bio" options="{'no_create': True}" /> |
|||
<field name="local" options="{'no_create': True}" /> |
|||
<field name="fair_trade" options="{'no_create': True}" /> |
|||
|
|||
</group> |
|||
</xpath> |
|||
</field> |
|||
</record> --> |
|||
|
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue