[REF] Separate python objects in new files
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from . import product
|
from . import product
|
||||||
|
from . import product_template
|
||||||
|
from . import product_supplierinfo
|
||||||
|
from . import product_price_history
|
||||||
from . import pricelist
|
from . import pricelist
|
||||||
|
|||||||
@@ -1,41 +1,31 @@
|
|||||||
|
# © 2015-2016 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# @author Raphaël Valyi <rvalyi@akretion.com>
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, fields
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
class ProductTemplate(models.Model):
|
|
||||||
_inherit = 'product.template'
|
|
||||||
|
|
||||||
name = fields.Char(track_visibility='onchange')
|
|
||||||
type = fields.Selection(track_visibility='onchange')
|
|
||||||
categ_id = fields.Many2one(track_visibility='onchange')
|
|
||||||
list_price = fields.Float(track_visibility='onchange')
|
|
||||||
sale_ok = fields.Boolean(track_visibility='onchange')
|
|
||||||
purchase_ok = fields.Boolean(track_visibility='onchange')
|
|
||||||
active = fields.Boolean(track_visibility='onchange')
|
|
||||||
|
|
||||||
def show_product_price_history(self):
|
|
||||||
self.ensure_one()
|
|
||||||
products = self.env['product.product'].search(
|
|
||||||
[('product_tmpl_id', '=', self._context['active_id'])])
|
|
||||||
action = self.env['ir.actions.act_window'].for_xml_id(
|
|
||||||
'product_usability', 'product_price_history_action')
|
|
||||||
action.update({
|
|
||||||
'domain': "[('product_id', 'in', %s)]" % products.ids,
|
|
||||||
})
|
|
||||||
return action
|
|
||||||
|
|
||||||
|
|
||||||
class ProductProduct(models.Model):
|
class ProductProduct(models.Model):
|
||||||
_inherit = 'product.product'
|
_inherit = 'product.product'
|
||||||
|
|
||||||
default_code = fields.Char(track_visibility='onchange', copy=False)
|
default_code = fields.Char(
|
||||||
barcode = fields.Char(track_visibility='onchange', copy=False)
|
track_visibility='onchange',
|
||||||
weight = fields.Float(track_visibility='onchange')
|
copy=False)
|
||||||
active = fields.Boolean(track_visibility='onchange')
|
|
||||||
|
barcode = fields.Char(
|
||||||
|
track_visibility='onchange',
|
||||||
|
copy=False)
|
||||||
|
|
||||||
|
weight = fields.Float(
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
|
active = fields.Boolean(
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
price_history_ids = fields.One2many(
|
price_history_ids = fields.One2many(
|
||||||
'product.price.history', 'product_id',
|
comodel_name='product.price.history',
|
||||||
|
inverse_name='product_id',
|
||||||
string='Product Price History')
|
string='Product Price History')
|
||||||
|
|
||||||
_sql_constraints = [(
|
_sql_constraints = [(
|
||||||
@@ -50,24 +40,9 @@ class ProductProduct(models.Model):
|
|||||||
|
|
||||||
def show_product_price_history(self):
|
def show_product_price_history(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
action = self.env['ir.actions.act_window'].for_xml_id(
|
action = self.env.ref(['ir.actions.act_window'].for_xml_id(
|
||||||
'product_usability', 'product_price_history_action')
|
'product_usability', 'product_price_history_action')
|
||||||
action.update({
|
action.update({
|
||||||
'domain': "[('product_id', '=', %d)]" % self.ids[0],
|
'domain': "[('product_id', '=', %d)]" % self.ids[0],
|
||||||
})
|
})
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
|
||||||
class ProductSupplierinfo(models.Model):
|
|
||||||
_inherit = 'product.supplierinfo'
|
|
||||||
|
|
||||||
name = fields.Many2one(
|
|
||||||
domain=[('supplier', '=', True), ('parent_id', '=', False)])
|
|
||||||
|
|
||||||
|
|
||||||
class ProductPriceHistory(models.Model):
|
|
||||||
_inherit = 'product.price.history'
|
|
||||||
|
|
||||||
company_currency_id = fields.Many2one(
|
|
||||||
related='company_id.currency_id', readonly=True, compute_sudo=True,
|
|
||||||
string='Company Currency')
|
|
||||||
|
|||||||
16
product_usability/models/product_price_history.py
Normal file
16
product_usability/models/product_price_history.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# © 2015-2016 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# @author Raphaël Valyi <rvalyi@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class ProductPriceHistory(models.Model):
|
||||||
|
_inherit = 'product.price.history'
|
||||||
|
|
||||||
|
company_currency_id = fields.Many2one(
|
||||||
|
related='company_id.currency_id',
|
||||||
|
readonly=True,
|
||||||
|
compute_sudo=True,
|
||||||
|
string='Company Currency')
|
||||||
13
product_usability/models/product_supplierinfo.py
Normal file
13
product_usability/models/product_supplierinfo.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# © 2015-2016 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# @author Raphaël Valyi <rvalyi@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class ProductSupplierinfo(models.Model):
|
||||||
|
_inherit = 'product.supplierinfo'
|
||||||
|
|
||||||
|
name = fields.Many2one(
|
||||||
|
domain=[('supplier', '=', True), ('parent_id', '=', False)])
|
||||||
42
product_usability/models/product_template.py
Normal file
42
product_usability/models/product_template.py
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# © 2015-2016 Akretion (http://www.akretion.com)
|
||||||
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
|
# @author Raphaël Valyi <rvalyi@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from odoo import models, fields
|
||||||
|
|
||||||
|
|
||||||
|
class ProductTemplate(models.Model):
|
||||||
|
_inherit = 'product.template'
|
||||||
|
|
||||||
|
name = fields.Char(
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
|
type = fields.Selection(
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
|
categ_id = fields.Many2one(
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
|
list_price = fields.Float(
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
|
sale_ok = fields.Boolean(
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
|
purchase_ok = fields.Boolean(
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
|
active = fields.Boolean(
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
|
def show_product_price_history(self):
|
||||||
|
self.ensure_one()
|
||||||
|
products = self.env['product.product'].search(
|
||||||
|
[('product_tmpl_id', '=', self._context['active_id'])])
|
||||||
|
action = self.env['ir.actions.act_window'].for_xml_id(
|
||||||
|
'product_usability', 'product_price_history_action')
|
||||||
|
action.update({
|
||||||
|
'domain': "[('product_id', 'in', %s)]" % products.ids,
|
||||||
|
})
|
||||||
|
return action
|
||||||
Reference in New Issue
Block a user