[REF] stock: refactoring of recompute stock operation links
[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 res_company(osv.osv):
25     _inherit = "res.company"
26     _columns = {
27         'propagation_minimum_delta': fields.integer('Minimum Delta for Propagation of a Date Change on moves linked together'),
28     }
29
30     _defaults = {
31         'propagation_minimum_delta': 1,
32     }
33
34 class stock_config_settings(osv.osv_memory):
35     _name = 'stock.config.settings'
36     _inherit = 'res.config.settings'
37
38     _columns = {
39         'company_id': fields.many2one('res.company', 'Company', required=True),
40         'module_mrp_jit': fields.boolean("Generate procurement in real time",
41             help="""This allows Just In Time computation of procurement orders.
42                 All procurement orders will be processed immediately, which could in some
43                 cases entail a small performance impact.
44                 This installs the module mrp_jit."""),
45         'module_claim_from_delivery': fields.boolean("Allow claim on deliveries",
46             help='Adds a Claim link to the delivery order.\n'
47                  '-This installs the module claim_from_delivery.'),
48         'module_stock_invoice_directly': fields.boolean("Create and open the invoice when the user finish a delivery order",
49             help='This allows to automatically launch the invoicing wizard if the delivery is '
50                  'to be invoiced when you send or deliver goods.\n'
51                  '-This installs the module stock_invoice_directly.'),
52         'module_product_expiry': fields.boolean("Expiry date on serial numbers",
53             help="""Track different dates on products and serial numbers.
54 The following dates can be tracked:
55     - end of life
56     - best before date
57     - removal date
58     - alert date.
59 This installs the module product_expiry."""),
60         'group_uom': fields.boolean("Manage different units of measure for products",
61             implied_group='product.group_uom',
62             help="""Allows you to select and maintain different units of measure for products."""),
63         'group_uos': fields.boolean("Invoice products in a different unit of measure than the sales order",
64             implied_group='product.group_uos',
65             help='Allows you to sell units of a product, but invoice based on a different unit of measure.\n'
66                  'For instance, you can sell pieces of meat that you invoice based on their weight.'),
67         'group_stock_packaging': fields.boolean("Allow to define several packaging methods on products",
68             implied_group='product.group_stock_packaging',
69             help="""Allows you to create and manage your packaging dimensions and types you want to be maintained in your system."""),
70         'group_stock_production_lot': fields.boolean("Track lots or serial numbers",
71             implied_group='stock.group_production_lot',
72             help="""This allows you to assign a lot (or serial number) to the pickings and moves.  This can make it possible to know which production lot was sent to a certain client, ..."""),
73         'group_stock_tracking_lot': fields.boolean("Use packages: pallets, boxes, ...",
74             implied_group='stock.group_tracking_lot',
75             help="""This allows you to manage products by using serial numbers. When you select a serial number on product moves, you can get the traceability of that product."""),
76         'group_stock_tracking_owner': fields.boolean("Manage owner on stock", 
77             implied_group='stock.group_tracking_owner', 
78             help="""This way you can receive products attributed to a certain owner. """), 
79         'module_stock_account': fields.boolean("Generate accounting entries per stock movement",
80             help="""Allows to configure inventory valuations on products and product categories."""),
81         'group_stock_multiple_locations': fields.boolean("Manage multiple locations and warehouses",
82             implied_group='stock.group_locations',
83             help="""This allows to configure and use multiple stock locations and warehouses,
84                 instead of having a single default one."""),
85         'group_stock_adv_location': fields.boolean("Active Push and Pull inventory flows",
86             implied_group='stock.group_adv_location',
87             help="""This option supplements the warehouse application by effectively implementing Push and Pull inventory flows. """),
88         '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."),
89         'propagation_minimum_delta': fields.related('company_id', 'propagation_minimum_delta', type='integer', string="Minimum days to trigger a propagation of date change in pushed/pull flows."),
90         'module_stock_dropshipping': fields.boolean("Manage dropshipping",
91             help='\nCreates the dropship route and add more complex tests'
92                  '-This installs the module stock_dropshipping.'),
93         'module_stock_picking_wave': fields.boolean('Manage picking wave', help='Install the picking wave module which will help you grouping your pickings and processing them in batch'),
94     }
95
96     def _default_company(self, cr, uid, context=None):
97         user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
98         return user.company_id.id
99
100     def get_default_dp(self, cr, uid, fields, context=None):
101         dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product', 'decimal_stock_weight')
102         return {'decimal_precision': dp.digits}
103
104     def set_default_dp(self, cr, uid, ids, context=None):
105         config = self.browse(cr, uid, ids[0], context)
106         dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product', 'decimal_stock_weight')
107         dp.write({'digits': config.decimal_precision})
108
109     _defaults = {
110         'company_id': _default_company,
111     }
112
113 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: