[MERGE] Sync with trunk, until revision 8927
[odoo/odoo.git] / addons / stock / res_config.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Business Applications
5 #    Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
6 #
7 #    This program is free software: you can redistribute it and/or modify
8 #    it under the terms of the GNU Affero General Public License as
9 #    published by the Free Software Foundation, either version 3 of the
10 #    License, or (at your option) any later version.
11 #
12 #    This program is distributed in the hope that it will be useful,
13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #    GNU Affero General Public License for more details.
16 #
17 #    You should have received a copy of the GNU Affero General Public License
18 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20 ##############################################################################
21
22 from openerp.osv import fields, osv
23
24 class stock_config_settings(osv.osv_memory):
25     _name = 'stock.config.settings'
26     _inherit = 'res.config.settings'
27
28     _columns = {
29         'module_claim_from_delivery': fields.boolean("Allow claim on deliveries",
30             help='Adds a Claim link to the delivery order.\n'
31                  '-This installs the module claim_from_delivery.'),
32         'module_stock_invoice_directly': fields.boolean("Create and open the invoice when the user finish a delivery order",
33             help='This allows to automatically launch the invoicing wizard if the delivery is '
34                  'to be invoiced when you send or deliver goods.\n'
35                  '-This installs the module stock_invoice_directly.'),
36         'module_product_expiry': fields.boolean("Expiry date on serial numbers",
37             help="""Track different dates on products and serial numbers.
38 The following dates can be tracked:
39     - end of life
40     - best before date
41     - removal date
42     - alert date.
43 This installs the module product_expiry."""),
44         'module_stock_location': fields.boolean("Create push/pull logistic rules",
45             help='Provide push and pull inventory flows. Typical uses of this feature are: '
46                  'manage product manufacturing chains, manage default locations per product, '
47                  'define routes within your warehouse according to business needs, etc.\n'
48                  '-This installs the module stock_location.'),
49         'group_uom': fields.boolean("Manage different units of measure for products",
50             implied_group='product.group_uom',
51             help="""Allows you to select and maintain different units of measure for products."""),
52         'group_uos': fields.boolean("Invoice products in a different unit of measure than the sales order",
53             implied_group='product.group_uos',
54             help='Allows you to sell units of a product, but invoice based on a different unit of measure.\n'
55                  'For instance, you can sell pieces of meat that you invoice based on their weight.'),
56         'group_stock_packaging': fields.boolean("Allow to define several packaging methods on products",
57             implied_group='product.group_stock_packaging',
58             help="""Allows you to create and manage your packaging dimensions and types you want to be maintained in your system."""),
59         'group_stock_production_lot': fields.boolean("Track serial number on products",
60             implied_group='stock.group_production_lot',
61             help="""This allows you to manage products by using serial numbers. When you select a serial number on product moves, you can get the upstream or downstream traceability of that product."""),
62         'group_stock_tracking_lot': fields.boolean("Track serial number on logistic units (pallets)",
63             implied_group='stock.group_tracking_lot',
64             help="""When you select a serial number on product moves, you can get the upstream or downstream traceability of that product."""),
65         'group_stock_inventory_valuation': fields.boolean("Generate accounting entries per stock movement",
66             implied_group='stock.group_inventory_valuation',
67             help="""Allows to configure inventory valuations on products and product categories."""),
68         'group_stock_multiple_locations': fields.boolean("Manage multiple locations and warehouses",
69             implied_group='stock.group_locations',
70             help='This allows to configure and use multiple stock locations and warehouses, '
71                  'instead of having a single default one.'),
72         'decimal_precision': fields.integer('Decimal precision on weight', help="As an example, a decimal precision of 2 will allow weights like: 9.99 kg, whereas a decimal precision of 4 will allow weights like:  0.0231 kg."),
73     }
74
75     def get_default_dp(self, cr, uid, fields, context=None):
76         dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product', 'decimal_stock_weight')
77         return {'decimal_precision': dp.digits}
78
79     def set_default_dp(self, cr, uid, ids, context=None):
80         config = self.browse(cr, uid, ids[0], context)
81         dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product', 'decimal_stock_weight')
82         dp.write({'digits': config.decimal_precision})
83
84 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: