Browse Source

[MERGE][S0012bis] Gestion d'impression des étiquettes des articles

pull/13/head
Thibault Francois 9 years ago
parent
commit
03a19c3b3b
  1. 1
      beesdoo_product/__init__.py
  2. 1
      beesdoo_product/__openerp__.py
  3. 4
      beesdoo_product/models/beesdoo_product.py
  4. 2
      beesdoo_product/views/beesdoo_product.xml
  5. 1
      beesdoo_product/wizard/__init__.py
  6. 21
      beesdoo_product/wizard/label_printing_utils.py
  7. 55
      beesdoo_product/wizard/views/label_printing_utils.xml

1
beesdoo_product/__init__.py

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

1
beesdoo_product/__openerp__.py

@ -26,6 +26,7 @@
'data': [ 'data': [
'data/product_label.xml', 'data/product_label.xml',
'views/beesdoo_product.xml', 'views/beesdoo_product.xml',
'wizard/views/label_printing_utils.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',
], ],
# only loaded in demonstration mode # only loaded in demonstration mode

4
beesdoo_product/models/beesdoo_product.py

@ -21,6 +21,10 @@ class BeesdooProduct(models.Model):
total_with_vat_by_unit = fields.Float(compute='_get_total', store=True, string="Total Sales Price with VAT by Reference Unit") total_with_vat_by_unit = fields.Float(compute='_get_total', store=True, string="Total Sales Price with VAT by Reference Unit")
total_deposit = fields.Float(compute='_get_total', store=True, string="Deposit Price") total_deposit = fields.Float(compute='_get_total', store=True, string="Deposit Price")
label_to_be_printed = fields.Boolean('Print label?')
label_last_printed = fields.Datetime('Label last printed on')
@api.one @api.one
@api.depends('seller_ids', 'seller_ids.date_start') @api.depends('seller_ids', 'seller_ids.date_start')
def _compute_main_seller_id(self): def _compute_main_seller_id(self):

2
beesdoo_product/views/beesdoo_product.xml

@ -39,6 +39,8 @@
<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 name="label_to_be_printed"/>
<field name="label_last_printed"/>
</group> </group>
</group> </group>

1
beesdoo_product/wizard/__init__.py

@ -0,0 +1 @@
import label_printing_utils

21
beesdoo_product/wizard/label_printing_utils.py

@ -0,0 +1,21 @@
# -*- 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):
self.product_ids.write({'label_to_be_printed' : True})
@api.one
def set_as_printed(self):
self.product_ids.write({'label_to_be_printed' : False, 'label_last_printed' : fields.Datetime.now()})

55
beesdoo_product/wizard/views/label_printing_utils.xml

@ -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>
Loading…
Cancel
Save