gregoire
9 years ago
7 changed files with 188 additions and 43 deletions
-
1beesdoo_product/__init__.py
-
1beesdoo_product/__openerp__.py
-
36beesdoo_product/models/beesdoo_product.py
-
109beesdoo_product/views/beesdoo_product.xml
-
1beesdoo_product/wizard/__init__.py
-
22beesdoo_product/wizard/label_printing_utils.py
-
55beesdoo_product/wizard/views/label_printing_utils.xml
@ -1,2 +1,3 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
import models |
import models |
||||
|
import wizard |
@ -1,43 +1,74 @@ |
|||||
<?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> |
|
||||
<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" /> |
|
||||
|
<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_form2"> |
||||
|
<field name="name">bees.product.template.form2</field> |
||||
|
<field name="model">product.template</field> |
||||
|
<field name="inherit_id" ref="product.product_template_form_view" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<div name="weight" position="after"> |
||||
|
<field name="main_seller_id" string="Fournisseur Principal" /> |
||||
|
</div> |
||||
|
</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> |
</field> |
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record model="ir.ui.view" id="beesdoo_product_form2"> |
|
||||
<field name="name">bees.product.template.form2</field> |
|
||||
<field name="model">product.template</field> |
|
||||
<field name="inherit_id" ref="product.product_template_form_view" /> |
|
||||
<field name="arch" type="xml"> |
|
||||
<div name="weight" position="after"> |
|
||||
<field name="main_seller_id" string="Fournisseur Principal" /> |
|
||||
</div> |
|
||||
</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> |
||||
|
<record model="ir.ui.view" id="product_template_form_view"> |
||||
|
<field name="name">bees.product</field> |
||||
|
<field name="model">product.template</field> |
||||
|
<field name="inherit_id" ref="product.product_template_form_view"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//group[@name='inventory']/.." position="after"> |
||||
|
<page string="Price tag"> |
||||
|
<group> |
||||
|
<field name="label_to_be_printed"/> |
||||
|
<field name="label_last_printed"/> |
||||
|
</group> |
||||
|
<group name="label" col="4"> |
||||
|
<group col="2"> |
||||
|
<separator string="Amount" colspan="4"/> |
||||
|
<field name="display_weight"/> |
||||
|
<field name="display_unit"/> |
||||
|
<field name="default_reference_unit"/> |
||||
|
<separator string="Price" colspan="4"/> |
||||
|
<field name="total_with_vat"/> |
||||
|
<field name="total_with_vat_by_unit"/> |
||||
|
</group> |
||||
|
<group col="2"> |
||||
|
<separator string="Bobo-level" colspan="4"/> |
||||
|
<field name="eco_label"/> |
||||
|
<field name="local_label"/> |
||||
|
<field name="fair_label"/> |
||||
|
<field name="origin_label"/> |
||||
|
<separator string="Origin" colspan="4"/> |
||||
|
<field name="main_seller_id"/> |
||||
|
</group> |
||||
|
</group> |
||||
|
</page> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
</odoo> |
</odoo> |
@ -0,0 +1 @@ |
|||||
|
import label_printing_utils |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from openerp import models, fields, api |
||||
|
|
||||
|
class RequestLabelPrintingWizard(models.TransientModel): |
||||
|
|
||||
|
_name = 'label.printing.wizard' |
||||
|
|
||||
|
def _get_selected_products(self): |
||||
|
return self.env.context['active_ids'] |
||||
|
|
||||
|
product_ids = fields.Many2many('product.template', default=_get_selected_products) |
||||
|
|
||||
|
|
||||
|
@api.one |
||||
|
def request_printing(self): |
||||
|
for product in self.product_ids: |
||||
|
product._request_label_printing() |
||||
|
|
||||
|
@api.one |
||||
|
def set_as_printed(self): |
||||
|
for product in self.product_ids: |
||||
|
product._set_label_as_printed() |
@ -0,0 +1,55 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<record id="printing_label_request_wizard" model="ir.ui.view"> |
||||
|
<field name="name">Request Label Printing Wizard</field> |
||||
|
<field name="model">label.printing.wizard</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form> |
||||
|
<field name="product_ids" /> |
||||
|
<footer> |
||||
|
<button |
||||
|
type="object" |
||||
|
name="request_printing" |
||||
|
string="Demander l'impression d'un label" |
||||
|
class="oe_highlight" /> |
||||
|
<button special="cancel" string="Annuler" /> |
||||
|
</footer> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
<act_window name="Request label printing" |
||||
|
res_model="label.printing.wizard" |
||||
|
src_model="product.template" |
||||
|
view_mode="form" |
||||
|
target="new" |
||||
|
view_id="printing_label_request_wizard" |
||||
|
key2="client_action_multi" |
||||
|
id="beesdoo_product_action_request_label_printing" |
||||
|
/> |
||||
|
<record id="set_label_as_printed_wizard" model="ir.ui.view"> |
||||
|
<field name="name">Request Label Printing Wizard</field> |
||||
|
<field name="model">label.printing.wizard</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form> |
||||
|
<field name="product_ids" /> |
||||
|
<footer> |
||||
|
<button |
||||
|
type="object" |
||||
|
name="set_as_printed" |
||||
|
string="Marquer les labels comme imprimés" |
||||
|
class="oe_highlight" /> |
||||
|
<button special="cancel" string="Annuler" /> |
||||
|
</footer> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
<act_window name="Set label as printed" |
||||
|
res_model="label.printing.wizard" |
||||
|
src_model="product.template" |
||||
|
view_mode="form" |
||||
|
view_id="set_label_as_printed_wizard" |
||||
|
target="new" |
||||
|
key2="client_action_multi" |
||||
|
id="beesdoo_product_action_set_label_as_printed" |
||||
|
/> |
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue