[IMP] stock config: move field 'decimal_precision' from module delivery to stock

bzr revid: rco@openerp.com-20120509132330-bq3ydzaze3kaj0qq
This commit is contained in:
Raphael Collet 2012-05-09 15:23:30 +02:00
parent ca067be9e7
commit 429e48a5fd
6 changed files with 15 additions and 68 deletions

View File

@ -25,7 +25,6 @@ import wizard
import report
import sale
import stock
import res_config
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -41,8 +41,7 @@ When creating invoices from picking, OpenERP is able to add and compute the ship
'wizard/delivery_sale_order_view.xml',
'delivery_report.xml',
'delivery_view.xml',
'partner_view.xml',
'res_config_view.xml'
'partner_view.xml'
],
'demo_xml': ['delivery_demo.xml'],
'test': [

View File

@ -1,45 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
class delivery_configuration(osv.osv_memory):
_inherit = 'stock.config.settings'
_columns = {
'decimal_precision_stock': fields.integer('Decimal Precision on Stock Weight'),
}
def get_default_dp(self, cr, uid, fields, context=None):
stock_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'product', 'decimal_stock_weight')[1]
dec_id =self.pool.get('decimal.precision').browse(cr, uid, stock_id, context=context)
return {
'decimal_precision_stock': dec_id.digits,
}
def set_default_dp(self, cr, uid, ids, context=None):
config = self.browse(cr, uid, ids[0], context)
stock_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'product', 'decimal_stock_weight')[1]
dec_id =self.pool.get('decimal.precision').browse(cr, uid, stock_id, context=context)
dec_id.write({
'digits': config.decimal_precision_stock,
})
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_stock_config_inherit" model="ir.ui.view">
<field name="name">delivery settings</field>
<field name="model">stock.config.settings</field>
<field name="type">form</field>
<field name="inherit_id" ref="stock.view_stock_config_settings"/>
<field name="arch" type="xml">
<field name="module_stock_invoice_directly" position="after">
<field name="decimal_precision_stock"/>
</field>
</field>
</record>
</data>
</openerp>

View File

@ -74,6 +74,16 @@ class stock_config_settings(osv.osv_memory):
'group_product_variant': fields.boolean("Product Variant",
implied_group='product.group_product_variant',
help="""This allows to configure and use Product Variant."""),
'decimal_precision': fields.integer('Decimal Precision on Stock Weight'),
}
def get_default_dp(self, cr, uid, fields, context=None):
dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product', 'decimal_stock_weight')
return {'decimal_precision': dp.digits}
def set_default_dp(self, cr, uid, ids, context=None):
config = self.browse(cr, uid, ids[0], context)
dp = self.pool.get('ir.model.data').get_object(cr, uid, 'product', 'decimal_stock_weight')
dp.write({'digits': config.decimal_precision})
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -24,13 +24,15 @@
<field name="group_stock_multiple_locations"/>
<field name="module_stock_location"/>
<field name="module_stock_invoice_directly"/>
<field name="decimal_precision"/>
<separator string="Products" colspan="4"/>
<field name="group_stock_packaging"/>
<field name="group_stock_inventory_valuation"/>
<field name="group_uom"/>
<field name="group_uos"/>
<field name="group_product_variant"/>
<separator string="Partners" colspan="4"/>
<field name="module_claim_from_delivery"/>
</sheet>