Browse Source

Adding beesdoo_product module (version 9.0)

pull/128/head
Manuel Claeys Bouuaert 5 years ago
committed by Rémy Taymans
parent
commit
dcf7ce9a5c
  1. 3
      beesdoo_product/__init__.py
  2. 36
      beesdoo_product/__openerp__.py
  3. 13
      beesdoo_product/data/barcode_rule.xml
  4. 69
      beesdoo_product/data/product_label.xml
  5. 14
      beesdoo_product/data/product_sequence.xml
  6. 222
      beesdoo_product/i18n/fr_BE.po
  7. 2
      beesdoo_product/models/__init__.py
  8. 187
      beesdoo_product/models/beesdoo_product.py
  9. 5
      beesdoo_product/security/ir.model.access.csv
  10. 188
      beesdoo_product/views/beesdoo_product.xml
  11. 1
      beesdoo_product/wizard/__init__.py
  12. 21
      beesdoo_product/wizard/label_printing_utils.py
  13. 55
      beesdoo_product/wizard/views/label_printing_utils.xml

3
beesdoo_product/__init__.py

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

36
beesdoo_product/__openerp__.py

@ -0,0 +1,36 @@
# -*- 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', 'point_of_sale','pos_price_to_weight'],
# always loaded
'data': [
'data/product_label.xml',
'data/barcode_rule.xml',
'data/product_sequence.xml',
'views/beesdoo_product.xml',
'wizard/views/label_printing_utils.xml',
'security/ir.model.access.csv',
],
# only loaded in demonstration mode
'demo': [],
}

13
beesdoo_product/data/barcode_rule.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record model="barcode.rule" id="beesdoo_product_barcode_rule">
<field name="name">Beescoop Product Barcodes</field>
<field name="barcode_nomenclature_id">1</field>
<field name="type">product</field>
<field name="pattern">043</field>
<field name="sequence">45</field>
<field name="encoding">ean13</field>
</record>
</data>
</odoo>

69
beesdoo_product/data/product_label.xml

@ -0,0 +1,69 @@
<?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>
<record id="consignes_group_tax" model="account.tax.group">
<field name="name">Consignes</field>
<field name="sequence" eval="10" />
</record>
</data>
</odoo>

14
beesdoo_product/data/product_sequence.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="seq_ean_product_internal_ref" model="ir.sequence">
<field name="name">Internal reference</field>
<field name="code">product.internal.code</field>
<field name="prefix"></field>
<field name="padding">5</field>
<field name="suffix"></field>
<field name="number_next">1</field>
<!-- <field name="barcode_sequence" eval="True"/> -->
</record>
</data>
</odoo>

222
beesdoo_product/i18n/fr_BE.po

@ -0,0 +1,222 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * beesdoo_product
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-13 15:12+0000\n"
"PO-Revision-Date: 2016-11-13 15:12+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: beesdoo_product
#: model:ir.ui.view,arch_db:beesdoo_product.printing_label_request_wizard
#: model:ir.ui.view,arch_db:beesdoo_product.set_label_as_printed_wizard
msgid "Cancel"
msgstr "Annuler"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label_color_code
msgid "Color code"
msgstr "Code Couleur"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_note
msgid "Comments"
msgstr "Commentaires"
#. module: beesdoo_product
#: model:account.tax.group,name:beesdoo_product.consignes_group_tax
msgid "Consignes"
msgstr "Consignes"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label_create_uid
#: model:ir.model.fields,field_description:beesdoo_product.field_label_printing_wizard_create_uid
msgid "Created by"
msgstr "Créé par"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label_create_date
#: model:ir.model.fields,field_description:beesdoo_product.field_label_printing_wizard_create_date
msgid "Created on"
msgstr "Créé le"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_default_reference_unit
msgid "Default reference unit"
msgstr "Default reference unit"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_total_deposit
msgid "Deposit Price"
msgstr "Deposit Price"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label_display_name
#: model:ir.model.fields,field_description:beesdoo_product.field_label_printing_wizard_display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_display_unit
msgid "Display unit"
msgstr "Display unit"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_display_weight
msgid "Display weight"
msgstr "Display weight"
#. module: beesdoo_product
#: selection:beesdoo.product.label,type:0
msgid "Distribution"
msgstr "Distribution"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_eco_label
msgid "Eco label"
msgstr "Eco label"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_fair_label
msgid "Fair label"
msgstr "Fair label"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label_id
#: model:ir.model.fields,field_description:beesdoo_product.field_label_printing_wizard_id
msgid "ID"
msgstr "ID"
#. module: beesdoo_product
#: model:ir.ui.view,arch_db:beesdoo_product.beesdoo_product_form
msgid "Label"
msgstr "Label"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_label_last_printed
msgid "Label last printed on"
msgstr "Label last printed on"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label___last_update
#: model:ir.model.fields,field_description:beesdoo_product.field_label_printing_wizard___last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label_write_uid
#: model:ir.model.fields,field_description:beesdoo_product.field_label_printing_wizard_write_uid
msgid "Last Updated by"
msgstr "Mis à jour par"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label_write_date
#: model:ir.model.fields,field_description:beesdoo_product.field_label_printing_wizard_write_date
msgid "Last Updated on"
msgstr "Mis à jour le"
#. module: beesdoo_product
#: selection:beesdoo.product.label,type:0
msgid "Local"
msgstr "Local"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_local_label
msgid "Local label"
msgstr "Local label"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_main_seller_id
msgid "Main seller id"
msgstr "Main seller id"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label_name
msgid "Name"
msgstr "Nom"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_origin_label
msgid "Origin label"
msgstr "Origin label"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_label_to_be_printed
msgid "Print label?"
msgstr "Print label?"
#. module: beesdoo_product
#: model:ir.model,name:beesdoo_product.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_label_printing_wizard_product_ids
msgid "Product ids"
msgstr "Product ids"
#. module: beesdoo_product
#: code:addons/beesdoo_product/models/beesdoo_product.py:56
#, python-format
msgid "Reference Unit and Display Unit should belong to the same category"
msgstr "Reference Unit and Display Unit should belong to the same category"
#. module: beesdoo_product
#: model:ir.actions.act_window,name:beesdoo_product.beesdoo_product_action_request_label_printing
#: model:ir.ui.view,arch_db:beesdoo_product.printing_label_request_wizard
msgid "Request label printing"
msgstr "Request label printing"
#. module: beesdoo_product
#: model:ir.actions.act_window,name:beesdoo_product.beesdoo_product_action_set_label_as_printed
msgid "Set label as printed"
msgstr "Set label as printed"
#. module: beesdoo_product
#: model:ir.ui.view,arch_db:beesdoo_product.set_label_as_printed_wizard
msgid "Set labels as printed"
msgstr "Set labels as printed"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_total_with_vat
msgid "Total Sales Price with VAT"
msgstr "Total Sales Price with VAT"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_product_template_total_with_vat_by_unit
msgid "Total Sales Price with VAT by Reference Unit"
msgstr "Total Sales Price with VAT by Reference Unit"
#. module: beesdoo_product
#: model:ir.model.fields,field_description:beesdoo_product.field_beesdoo_product_label_type
msgid "Type"
msgstr "Type"
#. module: beesdoo_product
#: model:ir.model,name:beesdoo_product.model_beesdoo_product_label
msgid "beesdoo.product.label"
msgstr "beesdoo.product.label"
#. module: beesdoo_product
#: model:ir.model,name:beesdoo_product.model_label_printing_wizard
msgid "label.printing.wizard"
msgstr "label.printing.wizard"
#. module: beesdoo_product
#: selection:beesdoo.product.label,type:0
msgid "Écologique"
msgstr "Écologique"
#. module: beesdoo_product
#: selection:beesdoo.product.label,type:0
msgid "Équitable"
msgstr "Équitable"

2
beesdoo_product/models/__init__.py

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

187
beesdoo_product/models/beesdoo_product.py

@ -0,0 +1,187 @@
# -*- coding: utf-8 -*-
from openerp import models, fields, api
from openerp.tools.translate import _
from openerp.exceptions import UserError, ValidationError
import uuid
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')])
main_seller_id = fields.Many2one('res.partner', string='Main Seller', compute='_compute_main_seller_id', store=True)
display_unit = fields.Many2one('product.uom')
default_reference_unit = fields.Many2one('product.uom')
display_weight = fields.Float(compute='_get_display_weight', store=True)
total_with_vat = fields.Float(compute='_get_total', store=True, string="Total Sales Price with VAT")
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")
label_to_be_printed = fields.Boolean('Print label?')
label_last_printed = fields.Datetime('Label last printed on')
note = fields.Text('Comments')
# S0023 : List_price = Price HTVA, so add a suggested price
list_price = fields.Float(string='exVAT Price')
suggested_price = fields.Float(string='Suggested exVAT Price', compute='_compute_cost', readOnly=True)
deadline_for_sale = fields.Integer(string="Deadline for sale(days)")
deadline_for_consumption = fields.Integer(string="Deadline for consumption(days)")
ingredients = fields.Char(string="Ingredient")
scale_label_info_1 = fields.Char(string="Scale lable info 1")
scale_label_info_2 = fields.Char(string="Scale lable info 2")
scale_sale_unit = fields.Char(compute="_get_scale_sale_uom", string="Scale sale unit", store=True)
scale_category = fields.Many2one('beesdoo.scale.category', string="Scale Category")
scale_category_code = fields.Integer(related='scale_category.code', string="Scale category code", readonly=True, store=True)
@api.depends('uom_id','uom_id.category_id','uom_id.category_id.type')
@api.multi
def _get_scale_sale_uom(self):
for product in self:
if product.uom_id.category_id.type == 'unit':
product.scale_sale_unit = 'F'
elif product.uom_id.category_id.type == 'weight':
product.scale_sale_unit = 'P'
def _get_main_supplier_info(self):
suppliers = self.seller_ids.sorted(
key=lambda seller: seller.date_start,
reverse=True)
if suppliers:
return suppliers[0]
else:
return suppliers
@api.one
def generate_barcode(self):
if self.to_weight:
seq_internal_code = self.env.ref('beesdoo_product.seq_ean_product_internal_ref')
bc = ''
if not self.default_code:
rule = self.env['barcode.rule'].search([('name', '=', 'Price Barcodes (Computed Weight) 2 Decimals')])[0]
default_code = seq_internal_code.next_by_id()
while(self.search_count([('default_code', '=', default_code)]) > 1):
default_code = seq_internal_code.next_by_id()
self.default_code = default_code
ean = '02' + self.default_code[0:5] + '000000'
bc = ean[0:12] + str(self.env['barcode.nomenclature'].ean_checksum(ean))
else:
rule = self.env['barcode.rule'].search([('name', '=', 'Beescoop Product Barcodes')])[0]
size = 13 - len(rule.pattern)
ean = rule.pattern + str(uuid.uuid4().fields[-1])[:size]
bc = ean[0:12] + str(self.env['barcode.nomenclature'].ean_checksum(ean))
# Make sure there is no other active member with the same barcode
while(self.search_count([('barcode', '=', bc)]) > 1):
ean = rule.pattern + str(uuid.uuid4().fields[-1])[:size]
bc = ean[0:12] + str(self.env['barcode.nomenclature'].ean_checksum(ean))
print 'barcode :', bc
self.barcode = bc
@api.one
@api.depends('seller_ids', 'seller_ids.date_start')
def _compute_main_seller_id(self):
# Calcule le vendeur associé qui a la date de début la plus récente et plus petite qu’aujourd’hui
sellers_ids = self._get_main_supplier_info() # self.seller_ids.sorted(key=lambda seller: seller.date_start, reverse=True)
self.main_seller_id = sellers_ids and sellers_ids[0].name or False
@api.one
@api.depends('taxes_id', 'list_price', 'taxes_id.amount',
'taxes_id.tax_group_id', 'total_with_vat',
'display_weight', 'weight')
def _get_total(self):
consignes_group = self.env.ref('beesdoo_product.consignes_group_tax',
raise_if_not_found=False)
taxes_included = set(self.taxes_id.mapped('price_include'))
if len(taxes_included) == 0:
self.total_with_vat = self.list_price
return True
elif len(taxes_included) > 1:
raise ValidationError('Several tax strategies (price_include) defined for %s' % self.name)
elif taxes_included.pop():
self.total_with_vat = self.list_price
self.total_deposit = sum([tax._compute_amount(self.list_price, self.list_price) for tax in self.taxes_id if tax.tax_group_id == consignes_group])
else:
tax_amount_sum = sum([tax._compute_amount(self.list_price, self.list_price)
for tax in self.taxes_id
if tax.tax_group_id != consignes_group])
self.total_with_vat = self.list_price + tax_amount_sum
self.total_deposit = sum([tax._compute_amount(self.list_price, self.list_price)
for tax in self.taxes_id
if tax.tax_group_id == consignes_group])
if self.display_weight > 0:
self.total_with_vat_by_unit = self.total_with_vat / self.weight
@api.one
@api.depends('weight', 'display_unit')
def _get_display_weight(self):
self.display_weight = self.weight * self.display_unit.factor
@api.one
@api.constrains('display_unit', 'default_reference_unit')
def _unit_same_category(self):
if self.display_unit.category_id != self.default_reference_unit.category_id:
raise UserError(_('Reference Unit and Display Unit should belong to the same category'))
@api.one
@api.depends('seller_ids')
def _compute_cost(self):
suppliers = self._get_main_supplier_info()
if(len(suppliers) > 0):
self.suggested_price = (suppliers[0].price * self.uom_po_id.factor)* (1 + suppliers[0].product_tmpl_id.categ_id.profit_margin / 100)
class BeesdooScaleCategory(models.Model):
_name = "beesdoo.scale.category"
name = fields.Char(string="Scale name category")
code = fields.Integer(string="Category code")
_sql_constraints = [
('code_scale_categ_uniq', 'unique (code)', 'The code of the scale category must be unique !')
]
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()
active = fields.Boolean(default=True)
class BeesdooProductCategory(models.Model):
_inherit = "product.category"
profit_margin = fields.Float(default = '10.0', string = "Product Margin [%]")
@api.one
@api.constrains('profit_margin')
def _check_margin(self):
if (self.profit_margin < 0.0):
raise UserError(_('Percentages for Profit Margin must > 0.'))
class BeesdooProductSupplierInfo(models.Model):
_inherit = "product.supplierinfo"
price = fields.Float('exVAT Price')
class BeesdooUOMCateg(models.Model):
_inherit = 'product.uom.categ'
type = fields.Selection([('unit','Unit'),
('weight','Weight'),
('time','Time'),
('distance','Distance'),
('surface','Surface'),
('volume','Volume'),
('other','Other')],string='Category type',default='unit')

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

@ -0,0 +1,5 @@
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
beesdoo_scale_category_read_all,beesdoo.scale.category Read All,model_beesdoo_scale_category,,1,0,0,0
beesdoo_scale_categoryl_all_access_sale_manager,beesdoo.scale.category All Access Sale Manager,model_beesdoo_scale_category,base.group_sale_manager,1,1,1,0

188
beesdoo_product/views/beesdoo_product.xml

@ -0,0 +1,188 @@
<?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">
<button string="Generate Barcode" name="generate_barcode" type="object" colspan="2" attrs="{'invisible' : [('barcode','!=',False)]}" /> />
</field>
<field name="list_price" position="after">
<field name="suggested_price" widget='monetary' options="{'currency_field': 'currency_id'}" />
</field>
<field name="invoice_policy" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="purchase_method" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="route_ids" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<group name="sale_condition" position="attributes">
<attribute name="invisible">1</attribute>
</group>
<field name="property_account_creditor_price_difference"
position="attributes">
<attribute name="invisible">1</attribute>
</field>
<xpath expr="//group[@name='inventory']/.." position="after">
<page string="Label">
<group>
<group name="label">
<field name="total_with_vat"/>
<field name="display_weight"/>
<field name="display_unit"/>
<field name="default_reference_unit"/>
<field name="total_with_vat_by_unit" />
<field name="total_deposit" />
</group>
<group>
<field name="main_seller_id"/>
<field name="eco_label"/>
<field name="local_label"/>
<field name="fair_label"/>
<field name="origin_label"/>
<field name="label_to_be_printed"/>
<field name="label_last_printed"/>
</group>
</group>
<group>
<field name="note" />
</group>
</page>
<page string="Scale labels" attrs="{'invisible':[('to_weight','=',False)]}">
<group>
<group name="scale_label">
<field name="deadline_for_sale"/>
<field name="deadline_for_consumption"/>
<field name="ingredients"/>
<field name="scale_label_info_1"/>
<field name="scale_label_info_2"/>
</group>
<group>
<field name="scale_sale_unit"/>
<field name="scale_category" widget="selection"/>
<field name="scale_category_code"/>
</group>
</group>
</page>
</xpath>
</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" />
<field name="active" />
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_product_label_tree">
<field name="name">bees.product.label.tree</field>
<field name="model">beesdoo.product.label</field>
<field name="arch" type="xml">
<tree editable="Top">
<field name="name" />
<field name="type" />
<field name="color_code" />
<field name="active" />
</tree>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_product_category_list">
<field name="name">beesdoo.product.category.list</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_list_view" />
<field name="arch" type="xml">
<field name="complete_name" position="after">
<field name="profit_margin"></field>
</field>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_product_category_form">
<field name="name">beesdoo.product.category.form</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_form_view" />
<field name="arch" type="xml">
<field name="parent_id" position="after">
<field name="profit_margin"></field>
</field>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_product_supplierinfo_tree_view">
<field name="name">beesdoo.product.supplierinfo.tree</field>
<field name="model">product.supplierinfo</field>
<field name="inherit_id" ref="product.product_supplierinfo_tree_view" />
<field name="arch" type="xml">
<field name="price" position="replace">
<field name="price"></field>
</field>
</field>
</record>
<record model="ir.actions.act_window" id="action_labels">
<field name="name">Product Labels</field>
<field name="res_model">beesdoo.product.label</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="label_configuration_menu" name="Labels" parent="product.prod_config_main"
action="action_labels" sequence="20"/>
<record id="beesdoo_product_uom_categ_form" model="ir.ui.view">
<field name="name">product.uom.categ.form</field>
<field name="model">product.uom.categ</field>
<field name="inherit_id" ref="product.product_uom_categ_form_view" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="type"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_scale_category_list">
<field name="name">beesdoo.scale.category.list</field>
<field name="model">beesdoo.scale.category</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="code"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_scale_category_form">
<field name="name">beesdoo.scale.category.form</field>
<field name="model">beesdoo.scale.category</field>
<field name="arch" type="xml">
<form>
<group>
<field name="name"/>
<field name="code"/>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_scale_categories">
<field name="name">Scale categories</field>
<field name="res_model">beesdoo.scale.category</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem id="scale_categories_configuration_menu" name="Scale categories" parent="product.prod_config_main"
action="action_scale_categories" sequence="15"/>
</odoo>

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="Request label printing"
class="oe_highlight" />
<button special="cancel" string="Cancel" />
</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="Set labels as printed"
class="oe_highlight" />
<button special="cancel" string="Cancel" />
</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