Browse Source

beesdoo_product module : migration to version 11.0 and 12.0

pull/128/head
Manuel Claeys Bouuaert 5 years ago
committed by Rémy Taymans
parent
commit
1421460e96
  1. 5
      beesdoo_product/__init__.py
  2. 3
      beesdoo_product/__manifest__.py
  3. 3
      beesdoo_product/models/__init__.py
  4. 9
      beesdoo_product/models/beesdoo_product.py
  5. 31
      beesdoo_product/views/beesdoo_product.xml
  6. 2
      beesdoo_product/wizard/__init__.py
  7. 1
      beesdoo_product/wizard/label_printing_utils.py

5
beesdoo_product/__init__.py

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

3
beesdoo_product/__manifest__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
{ {
'name': "beesdoo_product", 'name': "beesdoo_product",
@ -20,7 +19,7 @@
'version': '0.1', 'version': '0.1',
# any module necessary for this one to work correctly # any module necessary for this one to work correctly
'depends': ['beesdoo_base', 'product', 'point_of_sale','pos_price_to_weight'],
'depends': ['beesdoo_base', 'product', 'sale', 'point_of_sale', 'pos_price_to_weight'],
# always loaded # always loaded
'data': [ 'data': [

3
beesdoo_product/models/__init__.py

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

9
beesdoo_product/models/beesdoo_product.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api from odoo import models, fields, api
from odoo.tools.translate import _ from odoo.tools.translate import _
from odoo.exceptions import UserError, ValidationError from odoo.exceptions import UserError, ValidationError
@ -15,8 +14,8 @@ class BeesdooProduct(models.Model):
main_seller_id = fields.Many2one('res.partner', string='Main Seller', compute='_compute_main_seller_id', store=True) 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_unit = fields.Many2one('uom.uom')
default_reference_unit = fields.Many2one('uom.uom')
display_weight = fields.Float(compute='_get_display_weight', store=True) 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 = fields.Float(compute='_get_total', store=True, string="Total Sales Price with VAT")
@ -81,7 +80,7 @@ class BeesdooProduct(models.Model):
while(self.search_count([('barcode', '=', bc)]) > 1): while(self.search_count([('barcode', '=', bc)]) > 1):
ean = rule.pattern + str(uuid.uuid4().fields[-1])[:size] ean = rule.pattern + str(uuid.uuid4().fields[-1])[:size]
bc = ean[0:12] + str(self.env['barcode.nomenclature'].ean_checksum(ean)) bc = ean[0:12] + str(self.env['barcode.nomenclature'].ean_checksum(ean))
print 'barcode :', bc
print('barcode :', bc)
self.barcode = bc self.barcode = bc
@api.one @api.one
@ -176,7 +175,7 @@ class BeesdooProductSupplierInfo(models.Model):
price = fields.Float('exVAT Price') price = fields.Float('exVAT Price')
class BeesdooUOMCateg(models.Model): class BeesdooUOMCateg(models.Model):
_inherit = 'product.uom.categ'
_inherit = 'uom.category'
type = fields.Selection([('unit','Unit'), type = fields.Selection([('unit','Unit'),
('weight','Weight'), ('weight','Weight'),

31
beesdoo_product/views/beesdoo_product.xml

@ -11,18 +11,12 @@
<field name="list_price" position="after"> <field name="list_price" position="after">
<field name="suggested_price" widget='monetary' options="{'currency_field': 'currency_id'}" /> <field name="suggested_price" widget='monetary' options="{'currency_field': 'currency_id'}" />
</field> </field>
<field name="invoice_policy" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="purchase_method" position="attributes"> <field name="purchase_method" position="attributes">
<attribute name="invisible">1</attribute> <attribute name="invisible">1</attribute>
</field> </field>
<field name="route_ids" position="attributes"> <field name="route_ids" position="attributes">
<attribute name="invisible">1</attribute> <attribute name="invisible">1</attribute>
</field> </field>
<group name="sale_condition" position="attributes">
<attribute name="invisible">1</attribute>
</group>
<field name="property_account_creditor_price_difference" <field name="property_account_creditor_price_difference"
position="attributes"> position="attributes">
<attribute name="invisible">1</attribute> <attribute name="invisible">1</attribute>
@ -72,6 +66,17 @@
</field> </field>
</record> </record>
<record model="ir.ui.view" id="beesdoo_product_sales_form">
<field name="name">bees.product.sales.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="sale.product_template_form_view_invoice_policy" />
<field name="arch" type="xml">
<field name="invoice_policy" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>
<record model="ir.ui.view" id="beesdoo_product_label_form"> <record model="ir.ui.view" id="beesdoo_product_label_form">
<field name="name">bees.product.label.form</field> <field name="name">bees.product.label.form</field>
<field name="model">beesdoo.product.label</field> <field name="model">beesdoo.product.label</field>
@ -91,7 +96,7 @@
<field name="name">bees.product.label.tree</field> <field name="name">bees.product.label.tree</field>
<field name="model">beesdoo.product.label</field> <field name="model">beesdoo.product.label</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree editable="Top">
<tree editable="top">
<field name="name" /> <field name="name" />
<field name="type" /> <field name="type" />
<field name="color_code" /> <field name="color_code" />
@ -105,7 +110,7 @@
<field name="model">product.category</field> <field name="model">product.category</field>
<field name="inherit_id" ref="product.product_category_list_view" /> <field name="inherit_id" ref="product.product_category_list_view" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="complete_name" position="after">
<field name="display_name" position="after">
<field name="profit_margin"></field> <field name="profit_margin"></field>
</field> </field>
</field> </field>
@ -139,13 +144,13 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>
<menuitem id="label_configuration_menu" name="Labels" parent="product.prod_config_main"
<menuitem id="label_configuration_menu" name="Labels" parent="sale.prod_config_main"
action="action_labels" sequence="20"/> action="action_labels" sequence="20"/>
<record id="beesdoo_product_uom_categ_form" model="ir.ui.view"> <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="name">uom.category.form</field>
<field name="model">uom.category</field>
<field name="inherit_id" ref="uom.product_uom_categ_form_view" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="name" position="after"> <field name="name" position="after">
<field name="type"/> <field name="type"/>
@ -183,6 +188,6 @@
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
</record> </record>
<menuitem id="scale_categories_configuration_menu" name="Scale categories" parent="product.prod_config_main"
<menuitem id="scale_categories_configuration_menu" name="Scale categories" parent="sale.prod_config_main"
action="action_scale_categories" sequence="15"/> action="action_scale_categories" sequence="15"/>
</odoo> </odoo>

2
beesdoo_product/wizard/__init__.py

@ -1 +1 @@
import label_printing_utils
from . import label_printing_utils

1
beesdoo_product/wizard/label_printing_utils.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from odoo import models, fields, api from odoo import models, fields, api
class RequestLabelPrintingWizard(models.TransientModel): class RequestLabelPrintingWizard(models.TransientModel):

Loading…
Cancel
Save