gregoire
9 years ago
2 changed files with 128 additions and 36 deletions
@ -1,18 +1,54 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
from openerp import models, fields, api |
from openerp import models, fields, api |
||||
|
|
||||
|
|
||||
class BeesdooProduct(models.Model): |
class BeesdooProduct(models.Model): |
||||
_inherit = "product.template" |
|
||||
|
_inherit = 'product.template' |
||||
|
|
||||
eco_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'eco')]) |
eco_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'eco')]) |
||||
local_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'local')]) |
local_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'local')]) |
||||
fair_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'fair')]) |
fair_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'fair')]) |
||||
origin_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'delivery')]) |
origin_label = fields.Many2one('beesdoo.product.label', domain=[('type', '=', 'delivery')]) |
||||
|
|
||||
|
display_unit = fields.Char() |
||||
|
default_reference_unit = fields.Char() |
||||
|
display_weight = fields.Integer(compute='get_display_weight') |
||||
|
|
||||
|
total = fields.Float(compute='get_total') |
||||
|
total_with_vat = fields.Float(compute='get_total_with_vat') |
||||
|
|
||||
|
def get_display_weight(self): |
||||
|
pass |
||||
|
|
||||
|
|
||||
|
|
||||
|
def get_total(self): |
||||
|
price_ht = self.env['product.pricelist'].search([])[0].price_get(self.id, 1)[1] |
||||
|
self.total = price_ht |
||||
|
|
||||
|
# grand_total_by_unit = fields.Float(compute='get_grand_total_by_unit') |
||||
|
# |
||||
|
# grand_total = fields.Float(compute='get_grand_total') |
||||
|
# |
||||
|
# def get_grand_total(self): |
||||
|
# self.grand_total = self.env['sale.order.line'] * self.price |
||||
|
# |
||||
|
# def get_grand_total_by_unit(self): |
||||
|
# self.grand_total_by_unit = self.grand_total * self.unit_price |
||||
|
# product.supplierinfo |
||||
|
|
||||
|
def get_total_with_vat(self): |
||||
|
tax_amount_sum = 0.0 |
||||
|
for tax in self.taxes_id: |
||||
|
tax_amount_sum = tax_amount_sum + tax.amount |
||||
|
self.total_with_vat = self.total * (100.0 + tax_amount_sum) / 100 |
||||
|
|
||||
|
|
||||
|
|
||||
class BeesdooProductLabel(models.Model): |
class BeesdooProductLabel(models.Model): |
||||
_name = "beesdoo.product.label" |
|
||||
|
_name = 'beesdoo.product.label' |
||||
|
|
||||
name = fields.Char() |
name = fields.Char() |
||||
type = fields.Selection([('eco', 'Écologique'), ('local', 'Local'), ('fair', 'Équitable'), ('delivery', 'Distribution')]) |
|
||||
|
type = fields.Selection( |
||||
|
[('eco', 'Écologique'), ('local', 'Local'), ('fair', 'Équitable'), ('delivery', 'Distribution')]) |
||||
color_code = fields.Char() |
color_code = fields.Char() |
||||
|
|
@ -1,30 +1,86 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<odoo> |
<odoo> |
||||
<record model="ir.ui.view" id="beesdoo_product_form"> |
|
||||
<field name="name">bees.product.template.form</field> |
|
||||
|
|
||||
|
|
||||
|
<!--<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>--> |
||||
|
|
||||
|
<!--<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>--> |
||||
|
|
||||
|
<record model="ir.ui.view" id="product_template_form_view"> |
||||
|
<field name="name">bees.product</field> |
||||
<field name="model">product.template</field> |
<field name="model">product.template</field> |
||||
<field name="inherit_id" ref="product.product_template_only_form_view" /> |
|
||||
|
<field name="inherit_id" ref="product.product_template_form_view"/> |
||||
<field name="arch" type="xml"> |
<field name="arch" type="xml"> |
||||
<field name="barcode" position="after"> |
|
||||
|
<xpath expr="//group[@name='inventory']/.." position="after"> |
||||
|
<page string="Étiquette"> |
||||
|
<group name="label"> |
||||
|
<field name="default_reference_unit"/> |
||||
|
<field name="total"/> |
||||
|
<field name="total_with_vat"/> |
||||
<field name="eco_label"/> |
<field name="eco_label"/> |
||||
<field name="local_label"/> |
<field name="local_label"/> |
||||
<field name="fair_label"/> |
<field name="fair_label"/> |
||||
<field name="origin_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> |
||||
<group> |
<group> |
||||
<field name="name" /> |
|
||||
<field name="type" /> |
|
||||
<field name="color_code" /> |
|
||||
|
<field name="display_weight"/> |
||||
</group> |
</group> |
||||
</form> |
|
||||
|
</page> |
||||
|
</xpath> |
||||
</field> |
</field> |
||||
</record> |
</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> |
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue