[REF] replace purchase price precision by price unit and account precision. Remove purchase precision from config view
bzr revid: benoit.guillot@akretion.com.br-20120710122457-nv77lhcit0fxyu04
This commit is contained in:
parent
e67b4b6949
commit
1686d1ee3e
|
@ -190,15 +190,15 @@ class purchase_order(osv.osv):
|
|||
'purchase.order.line': (_get_order, ['date_planned'], 10),
|
||||
}
|
||||
),
|
||||
'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Purchase Price'), string='Untaxed Amount',
|
||||
'amount_untaxed': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Untaxed Amount',
|
||||
store={
|
||||
'purchase.order.line': (_get_order, None, 10),
|
||||
}, multi="sums", help="The amount without tax"),
|
||||
'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Purchase Price'), string='Taxes',
|
||||
'amount_tax': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Taxes',
|
||||
store={
|
||||
'purchase.order.line': (_get_order, None, 10),
|
||||
}, multi="sums", help="The tax amount"),
|
||||
'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Purchase Price'), string='Total',
|
||||
'amount_total': fields.function(_amount_all, digits_compute= dp.get_precision('Account'), string='Total',
|
||||
store={
|
||||
'purchase.order.line': (_get_order, None, 10),
|
||||
}, multi="sums",help="The total amount"),
|
||||
|
@ -804,8 +804,8 @@ class purchase_order_line(osv.osv):
|
|||
'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True),
|
||||
'move_ids': fields.one2many('stock.move', 'purchase_line_id', 'Reservation', readonly=True, ondelete='set null'),
|
||||
'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'),
|
||||
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Purchase Price')),
|
||||
'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Purchase Price')),
|
||||
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Price Unit')),
|
||||
'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Account')),
|
||||
'notes': fields.text('Notes'),
|
||||
'order_id': fields.many2one('purchase.order', 'Order Reference', select=True, required=True, ondelete='cascade'),
|
||||
'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',),
|
||||
|
|
|
@ -59,21 +59,12 @@ class purchase_config_settings(osv.osv_memory):
|
|||
help="""Purchase Requisitions are used when you want to request quotations from several suppliers for a given set of products.
|
||||
You can configure per product if you directly do a Request for Quotation
|
||||
to one supplier or if you want a purchase requisition to negotiate with several suppliers."""),
|
||||
'decimal_precision': fields.integer('Decimal Precision on Price',help="As an example, a decimal precision of 2 will allow prices like: 9.99 EUR, whereas a decimal precision of 4 will allow prices like: 0.0231 EUR per unit."),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'default_invoice_method': 'manual',
|
||||
}
|
||||
|
||||
def get_default_dp(self, cr, uid, fields, context=None):
|
||||
dp = self.pool.get('ir.model.data').get_object(cr,uid, 'product','decimal_purchase')
|
||||
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_purchase')
|
||||
dp.write({'digits': config.decimal_precision})
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</header>
|
||||
<group string="Invoicing">
|
||||
<field name="default_invoice_method"/>
|
||||
<field name="decimal_precision"/>
|
||||
|
||||
</group>
|
||||
<group string="Purchase Order">
|
||||
<group>
|
||||
|
|
Loading…
Reference in New Issue