[REF] *: use the new decimal precision syntax
Since previous commit moved decimal_precision module's feature into base,
use the new syntax for fields declaration
Remove the imports to the removed module
Remove the module from dependency in manifest
sed -i "s|digits=dp.get_precision('\([A-Z a-z]*\)')|digits='\1'|" **.py
sed -i "/from odoo.tools import decimal_precision as dp/d" **py
This commit is contained in:
committed by
Martin Trigaux
parent
82be146954
commit
9d710df076
@@ -4,7 +4,6 @@ from odoo import api, fields, models, _
|
||||
from odoo.exceptions import RedirectWarning, UserError, ValidationError
|
||||
from odoo.tools import float_is_zero, float_compare, safe_eval, date_utils
|
||||
from odoo.tools.misc import formatLang, format_date
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from collections import OrderedDict
|
||||
from datetime import date
|
||||
@@ -2111,11 +2110,11 @@ class AccountMoveLine(models.Model):
|
||||
sequence = fields.Integer(default=10)
|
||||
name = fields.Char(string='Label')
|
||||
quantity = fields.Float(string='Quantity',
|
||||
default=1.0, digits=dp.get_precision('Product Unit of Measure'),
|
||||
default=1.0, digits='Product Unit of Measure',
|
||||
help="The optional quantity expressed by this line, eg: number of product sold."
|
||||
"The quantity is not a legal requirement but is very useful for some reports.")
|
||||
price_unit = fields.Float(string='Unit Price', digits=dp.get_precision('Product Price'))
|
||||
discount = fields.Float(string='Discount (%)', digits=dp.get_precision('Discount'), default=0.0)
|
||||
price_unit = fields.Float(string='Unit Price', digits='Product Price')
|
||||
discount = fields.Float(string='Discount (%)', digits='Discount', default=0.0)
|
||||
debit = fields.Monetary(string='Debit', default=0.0, currency_field='company_currency_id')
|
||||
credit = fields.Monetary(string='Credit', default=0.0, currency_field='company_currency_id')
|
||||
balance = fields.Monetary(string='Balance', store=True,
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
from odoo import api, exceptions, fields, models, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
@@ -90,7 +89,7 @@ class AccountPaymentTermLine(models.Model):
|
||||
('fixed', 'Fixed Amount')
|
||||
], string='Type', required=True, default='balance',
|
||||
help="Select here the kind of valuation related to this payment terms line.")
|
||||
value_amount = fields.Float(string='Value', digits=dp.get_precision('Payment Terms'), help="For percent enter a ratio between 0-100.")
|
||||
value_amount = fields.Float(string='Value', digits='Payment Terms', help="For percent enter a ratio between 0-100.")
|
||||
days = fields.Integer(string='Number of Days', required=True, default=0)
|
||||
day_of_the_month = fields.Integer(string='Day of the month', help="Day of the month on which the invoice must come to its term. If zero or negative, this value will be ignored, and no specific day will be set. If greater than the last day of a month, this number will instead select the last day of this month.")
|
||||
option = fields.Selection([
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
'name' : 'Analytic Accounting',
|
||||
'version': '1.1',
|
||||
'category': 'Hidden/Dependency',
|
||||
'depends' : ['base', 'decimal_precision', 'mail', 'uom'],
|
||||
'depends' : ['base', 'mail', 'uom'],
|
||||
'description': """
|
||||
Module for defining analytic accounting object.
|
||||
===============================================
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
@@ -31,8 +30,8 @@ class PriceRule(models.Model):
|
||||
variable = fields.Selection([('weight', 'Weight'), ('volume', 'Volume'), ('wv', 'Weight * Volume'), ('price', 'Price'), ('quantity', 'Quantity')], required=True, default='weight')
|
||||
operator = fields.Selection([('==', '='), ('<=', '<='), ('<', '<'), ('>=', '>='), ('>', '>')], required=True, default='<=')
|
||||
max_value = fields.Float('Maximum Value', required=True)
|
||||
list_base_price = fields.Float(string='Sale Base Price', digits=dp.get_precision('Product Price'), required=True, default=0.0)
|
||||
list_price = fields.Float('Sale Price', digits=dp.get_precision('Product Price'), required=True, default=0.0)
|
||||
list_base_price = fields.Float(string='Sale Base Price', digits='Product Price', required=True, default=0.0)
|
||||
list_price = fields.Float('Sale Price', digits='Product Price', required=True, default=0.0)
|
||||
variable_factor = fields.Selection([('weight', 'Weight'), ('volume', 'Volume'), ('wv', 'Weight * Volume'), ('price', 'Price'), ('quantity', 'Quantity')], 'Variable Factor', required=True, default='weight')
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
@@ -147,7 +146,7 @@ class SaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
is_delivery = fields.Boolean(string="Is a Delivery", default=False)
|
||||
product_qty = fields.Float(compute='_compute_product_qty', string='Product Qty', digits=dp.get_precision('Product Unit of Measure'))
|
||||
product_qty = fields.Float(compute='_compute_product_qty', string='Product Qty', digits='Product Unit of Measure')
|
||||
recompute_delivery_price = fields.Boolean(related='order_id.recompute_delivery_price')
|
||||
|
||||
@api.depends('product_id', 'product_uom', 'product_uom_qty')
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
weight = fields.Float(compute='_cal_move_weight', digits=dp.get_precision('Stock Weight'), store=True)
|
||||
weight = fields.Float(compute='_cal_move_weight', digits='Stock Weight', store=True)
|
||||
|
||||
@api.depends('product_id', 'product_uom_qty', 'product_uom')
|
||||
def _cal_move_weight(self):
|
||||
|
||||
@@ -6,7 +6,6 @@ import json
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class StockQuantPackage(models.Model):
|
||||
@@ -76,7 +75,7 @@ class StockPicking(models.Model):
|
||||
delivery_type = fields.Selection(related='carrier_id.delivery_type', readonly=True)
|
||||
carrier_id = fields.Many2one("delivery.carrier", string="Carrier", domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]")
|
||||
volume = fields.Float(copy=False)
|
||||
weight = fields.Float(compute='_cal_weight', digits=dp.get_precision('Stock Weight'), store=True, help="Total weight of the products in the picking.")
|
||||
weight = fields.Float(compute='_cal_weight', digits='Stock Weight', store=True, help="Total weight of the products in the picking.")
|
||||
carrier_tracking_ref = fields.Char(string='Tracking Reference', copy=False)
|
||||
carrier_tracking_url = fields.Char(string='Tracking URL', compute='_compute_carrier_tracking_url')
|
||||
weight_uom_name = fields.Char(string='Weight unit of measure label', compute='_compute_weight_uom_name', readonly=True, default=_get_default_weight_uom)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.tools import float_is_zero
|
||||
|
||||
|
||||
@@ -77,11 +76,11 @@ class EventTicket(models.Model):
|
||||
required=True, domain=[("event_ok", "=", True)],
|
||||
default=_default_product_id)
|
||||
registration_ids = fields.One2many('event.registration', 'event_ticket_id', string='Registrations')
|
||||
price = fields.Float(string='Price', digits=dp.get_precision('Product Price'))
|
||||
price = fields.Float(string='Price', digits='Product Price')
|
||||
deadline = fields.Date(string="Sales End")
|
||||
is_expired = fields.Boolean(string='Is Expired', compute='_compute_is_expired')
|
||||
|
||||
price_reduce = fields.Float(string="Price Reduce", compute="_compute_price_reduce", digits=dp.get_precision('Product Price'))
|
||||
price_reduce = fields.Float(string="Price Reduce", compute="_compute_price_reduce", digits='Product Price')
|
||||
price_reduce_taxinc = fields.Float(compute='_get_price_reduce_tax', string='Price Reduce Tax inc')
|
||||
# seats fields
|
||||
seats_availability = fields.Selection([('limited', 'Limited'), ('unlimited', 'Unlimited')],
|
||||
|
||||
@@ -7,7 +7,6 @@ from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools import email_split, float_is_zero
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
class HrExpense(models.Model):
|
||||
|
||||
@@ -49,13 +48,13 @@ class HrExpense(models.Model):
|
||||
# product_id not required to allow create an expense without product via mail alias, but should be required on the view.
|
||||
product_id = fields.Many2one('product.product', string='Product', readonly=True, states={'draft': [('readonly', False)], 'reported': [('readonly', False)], 'refused': [('readonly', False)]}, domain=[('can_be_expensed', '=', True)])
|
||||
product_uom_id = fields.Many2one('uom.uom', string='Unit of Measure', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=_default_product_uom_id)
|
||||
unit_amount = fields.Float("Unit Price", readonly=True, required=True, states={'draft': [('readonly', False)], 'reported': [('readonly', False)], 'refused': [('readonly', False)]}, digits=dp.get_precision('Product Price'))
|
||||
quantity = fields.Float(required=True, readonly=True, states={'draft': [('readonly', False)], 'reported': [('readonly', False)], 'refused': [('readonly', False)]}, digits=dp.get_precision('Product Unit of Measure'), default=1)
|
||||
unit_amount = fields.Float("Unit Price", readonly=True, required=True, states={'draft': [('readonly', False)], 'reported': [('readonly', False)], 'refused': [('readonly', False)]}, digits='Product Price')
|
||||
quantity = fields.Float(required=True, readonly=True, states={'draft': [('readonly', False)], 'reported': [('readonly', False)], 'refused': [('readonly', False)]}, digits='Product Unit of Measure', default=1)
|
||||
tax_ids = fields.Many2many('account.tax', 'expense_tax', 'expense_id', 'tax_id', string='Taxes')
|
||||
untaxed_amount = fields.Float("Subtotal", store=True, compute='_compute_amount', digits=dp.get_precision('Account'))
|
||||
total_amount = fields.Monetary("Total", compute='_compute_amount', store=True, currency_field='currency_id', digits=dp.get_precision('Account'))
|
||||
untaxed_amount = fields.Float("Subtotal", store=True, compute='_compute_amount', digits='Account')
|
||||
total_amount = fields.Monetary("Total", compute='_compute_amount', store=True, currency_field='currency_id', digits='Account')
|
||||
company_currency_id = fields.Many2one('res.currency', string="Report Company Currency", related='sheet_id.currency_id', store=True, readonly=False)
|
||||
total_amount_company = fields.Monetary("Total (Company Currency)", compute='_compute_total_amount_company', store=True, currency_field='company_currency_id', digits=dp.get_precision('Account'))
|
||||
total_amount_company = fields.Monetary("Total (Company Currency)", compute='_compute_total_amount_company', store=True, currency_field='company_currency_id', digits='Account')
|
||||
company_id = fields.Many2one('res.company', string='Company', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=lambda self: self.env.company)
|
||||
currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, states={'draft': [('readonly', False)], 'refused': [('readonly', False)]}, default=lambda self: self.env.company.currency_id)
|
||||
analytic_account_id = fields.Many2one('account.analytic.account', string='Analytic Account', oldname='analytic_account')
|
||||
@@ -632,7 +631,7 @@ class HrExpenseSheet(models.Model):
|
||||
address_id = fields.Many2one('res.partner', string="Employee Home Address")
|
||||
payment_mode = fields.Selection(related='expense_line_ids.payment_mode', default='own_account', readonly=True, string="Paid By")
|
||||
user_id = fields.Many2one('res.users', 'Manager', readonly=True, copy=False, states={'draft': [('readonly', False)]}, tracking=True, oldname='responsible_id')
|
||||
total_amount = fields.Monetary('Total Amount', currency_field='currency_id', compute='_compute_amount', store=True, digits=dp.get_precision('Account'))
|
||||
total_amount = fields.Monetary('Total Amount', currency_field='currency_id', compute='_compute_amount', store=True, digits='Account')
|
||||
company_id = fields.Many2one('res.company', string='Company', readonly=True, states={'draft': [('readonly', False)]}, default=lambda self: self.env.company)
|
||||
currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, states={'draft': [('readonly', False)]}, default=lambda self: self.env.company.currency_id)
|
||||
attachment_number = fields.Integer(compute='_compute_attachment_number', string='Number of Attachments')
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
'name': 'Lunch',
|
||||
'sequence': 120,
|
||||
'version': '1.0',
|
||||
'depends': ['decimal_precision', 'mail'],
|
||||
'depends': ['mail'],
|
||||
'category': 'Human Resources/Lunch',
|
||||
'summary': 'Handle lunch orders of your employees',
|
||||
'description': """
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class LunchOrder(models.Model):
|
||||
@@ -29,7 +28,7 @@ class LunchOrder(models.Model):
|
||||
default=lambda self: self.env.uid)
|
||||
note = fields.Text('Notes')
|
||||
price = fields.Float('Total Price', compute='_compute_total_price', readonly=True, store=True,
|
||||
digits=dp.get_precision('Account'))
|
||||
digits='Account')
|
||||
active = fields.Boolean('Active', default=True)
|
||||
state = fields.Selection([('new', 'To Order'),
|
||||
('ordered', 'Ordered'),
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
from odoo import api, fields, models, tools
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.tools import formatLang
|
||||
|
||||
|
||||
@@ -69,7 +68,7 @@ class LunchTopping(models.Model):
|
||||
name = fields.Char('Name', required=True)
|
||||
company_id = fields.Many2one('res.company', default=lambda self: self.env.company)
|
||||
currency_id = fields.Many2one('res.currency', related='company_id.currency_id')
|
||||
price = fields.Float('Price', digits=dp.get_precision('Account'), required=True)
|
||||
price = fields.Float('Price', digits='Account', required=True)
|
||||
category_id = fields.Many2one('lunch.product.category')
|
||||
topping_category = fields.Integer('Topping Category', help="This field is a technical field", required=True, default=1)
|
||||
|
||||
@@ -91,7 +90,7 @@ class LunchProduct(models.Model):
|
||||
name = fields.Char('Product Name', required=True)
|
||||
category_id = fields.Many2one('lunch.product.category', 'Product Category', required=True)
|
||||
description = fields.Text('Description')
|
||||
price = fields.Float('Price', digits=dp.get_precision('Account'), required=True)
|
||||
price = fields.Float('Price', digits='Account', required=True)
|
||||
supplier_id = fields.Many2one('lunch.supplier', 'Vendor', required=True)
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
STATE = [
|
||||
('none', 'Non Member'),
|
||||
@@ -29,7 +28,7 @@ class MembershipLine(models.Model):
|
||||
date = fields.Date(string='Join Date',
|
||||
help="Date on which member has joined the membership")
|
||||
member_price = fields.Float(string='Membership Fee',
|
||||
digits=dp.get_precision('Product Price'), required=True,
|
||||
digits='Product Price', required=True,
|
||||
help='Amount for the membership')
|
||||
account_invoice_line = fields.Many2one('account.move.line', string='Account Invoice line', readonly=True, ondelete='cascade')
|
||||
account_invoice_id = fields.Many2one('account.move', related='account_invoice_line.move_id', string='Invoice', readonly=True)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class MembershipInvoice(models.TransientModel):
|
||||
@@ -10,7 +9,7 @@ class MembershipInvoice(models.TransientModel):
|
||||
_description = "Membership Invoice"
|
||||
|
||||
product_id = fields.Many2one('product.product', string='Membership', required=True)
|
||||
member_price = fields.Float(string='Member Price', digits= dp.get_precision('Product Price'), required=True)
|
||||
member_price = fields.Float(string='Member Price', digits='Product Price', required=True)
|
||||
|
||||
@api.onchange('product_id')
|
||||
def onchange_product(self):
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
from collections import defaultdict
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_compare, float_round, float_is_zero
|
||||
|
||||
@@ -15,7 +14,7 @@ class MrpAbstractWorkorder(models.AbstractModel):
|
||||
|
||||
production_id = fields.Many2one('mrp.production', 'Manufacturing Order', required=True)
|
||||
product_id = fields.Many2one(related='production_id.product_id', readonly=True, store=True)
|
||||
qty_producing = fields.Float(string='Currently Produced Quantity', digits=dp.get_precision('Product Unit of Measure'))
|
||||
qty_producing = fields.Float(string='Currently Produced Quantity', digits='Product Unit of Measure')
|
||||
product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure', required=True, readonly=True)
|
||||
finished_lot_id = fields.Many2one('stock.production.lot', string='Lot/Serial Number', domain="[('product_id', '=', product_id)]", oldname='final_lot_id')
|
||||
product_tracking = fields.Selection(related="product_id.tracking")
|
||||
@@ -306,10 +305,10 @@ class MrpAbstractWorkorderLine(models.AbstractModel):
|
||||
product_id = fields.Many2one('product.product', 'Product', required=True)
|
||||
product_tracking = fields.Selection(related="product_id.tracking")
|
||||
lot_id = fields.Many2one('stock.production.lot', 'Lot/Serial Number')
|
||||
qty_to_consume = fields.Float('To Consume', digits=dp.get_precision('Product Unit of Measure'))
|
||||
qty_to_consume = fields.Float('To Consume', digits='Product Unit of Measure')
|
||||
product_uom_id = fields.Many2one('uom.uom', string='Unit of Measure')
|
||||
qty_done = fields.Float('Consumed', digits=dp.get_precision('Product Unit of Measure'))
|
||||
qty_reserved = fields.Float('Reserved', digits=dp.get_precision('Product Unit of Measure'))
|
||||
qty_done = fields.Float('Consumed', digits='Product Unit of Measure')
|
||||
qty_reserved = fields.Float('Reserved', digits='Product Unit of Measure')
|
||||
|
||||
@api.onchange('lot_id')
|
||||
def _onchange_lot_id(self):
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools import float_round
|
||||
|
||||
@@ -39,7 +38,7 @@ class MrpBom(models.Model):
|
||||
byproduct_ids = fields.One2many('mrp.bom.byproduct', 'bom_id', 'By-products', copy=True)
|
||||
product_qty = fields.Float(
|
||||
'Quantity', default=1.0,
|
||||
digits=dp.get_precision('Unit of Measure'), required=True)
|
||||
digits='Unit of Measure', required=True)
|
||||
product_uom_id = fields.Many2one(
|
||||
'uom.uom', 'Product Unit of Measure',
|
||||
default=_get_default_product_uom_id, oldname='product_uom', required=True,
|
||||
@@ -229,7 +228,7 @@ class MrpBomLine(models.Model):
|
||||
product_tmpl_id = fields.Many2one('product.template', 'Product Template', related='product_id.product_tmpl_id', readonly=False)
|
||||
product_qty = fields.Float(
|
||||
'Quantity', default=1.0,
|
||||
digits=dp.get_precision('Product Unit of Measure'), required=True)
|
||||
digits='Product Unit of Measure', required=True)
|
||||
product_uom_id = fields.Many2one(
|
||||
'uom.uom', 'Product Unit of Measure',
|
||||
default=_get_default_product_uom_id,
|
||||
@@ -369,7 +368,7 @@ class MrpByProduct(models.Model):
|
||||
product_id = fields.Many2one('product.product', 'By-product', required=True)
|
||||
product_qty = fields.Float(
|
||||
'Quantity',
|
||||
default=1.0, digits=dp.get_precision('Product Unit of Measure'), required=True)
|
||||
default=1.0, digits='Product Unit of Measure', required=True)
|
||||
product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure', required=True)
|
||||
bom_id = fields.Many2one('mrp.bom', 'BoM', ondelete='cascade')
|
||||
operation_id = fields.Many2one('mrp.routing.workcenter', 'Produced in Operation')
|
||||
|
||||
@@ -5,7 +5,6 @@ import datetime
|
||||
from itertools import groupby
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import AccessError, UserError
|
||||
from odoo.tools import date_utils, float_round, float_is_zero
|
||||
|
||||
@@ -65,7 +64,7 @@ class MrpProduction(models.Model):
|
||||
product_tmpl_id = fields.Many2one('product.template', 'Product Template', related='product_id.product_tmpl_id')
|
||||
product_qty = fields.Float(
|
||||
'Quantity To Produce',
|
||||
default=1.0, digits=dp.get_precision('Product Unit of Measure'),
|
||||
default=1.0, digits='Product Unit of Measure',
|
||||
readonly=True, required=True, tracking=True,
|
||||
states={'draft': [('readonly', False)]})
|
||||
product_uom_id = fields.Many2one(
|
||||
|
||||
@@ -8,7 +8,6 @@ from collections import defaultdict
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_compare, float_round
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class MrpWorkorder(models.Model):
|
||||
@@ -34,11 +33,11 @@ class MrpWorkorder(models.Model):
|
||||
related='production_id.state',
|
||||
help='Technical: used in views only.')
|
||||
qty_production = fields.Float('Original Production Quantity', readonly=True, related='production_id.product_qty')
|
||||
qty_remaining = fields.Float('Quantity To Be Produced', compute='_compute_qty_remaining', digits=dp.get_precision('Product Unit of Measure'))
|
||||
qty_remaining = fields.Float('Quantity To Be Produced', compute='_compute_qty_remaining', digits='Product Unit of Measure')
|
||||
qty_produced = fields.Float(
|
||||
'Quantity', default=0.0,
|
||||
readonly=True,
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
digits='Product Unit of Measure',
|
||||
help="The number of products already handled by this work order")
|
||||
is_produced = fields.Boolean(string="Has Been Produced",
|
||||
compute='_compute_is_produced')
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
from odoo import api, exceptions, fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_compare, float_round
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class StockMoveLine(models.Model):
|
||||
@@ -14,7 +13,7 @@ class StockMoveLine(models.Model):
|
||||
production_id = fields.Many2one('mrp.production', 'Production Order')
|
||||
lot_produced_ids = fields.Many2many('stock.production.lot', string='Finished Lot/Serial Number')
|
||||
lot_produced_qty = fields.Float(
|
||||
'Quantity Finished Product', digits=dp.get_precision('Product Unit of Measure'),
|
||||
'Quantity Finished Product', digits='Product Unit of Measure',
|
||||
help="Informative, not used in matching")
|
||||
done_move = fields.Boolean('Move Done', related='move_id.is_done', readonly=False, store=True) # TDE FIXME: naming
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_is_zero, float_round
|
||||
|
||||
@@ -15,7 +14,7 @@ class ChangeProductionQty(models.TransientModel):
|
||||
mo_id = fields.Many2one('mrp.production', 'Manufacturing Order', required=True)
|
||||
product_qty = fields.Float(
|
||||
'Quantity To Produce',
|
||||
digits=dp.get_precision('Product Unit of Measure'), required=True)
|
||||
digits='Product Unit of Measure', required=True)
|
||||
|
||||
@api.model
|
||||
def default_get(self, fields):
|
||||
|
||||
@@ -11,7 +11,6 @@ from odoo import api, fields, models, tools, _
|
||||
from odoo.tools import float_is_zero
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.http import request
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.osv.expression import AND
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -1022,7 +1021,7 @@ class PosOrderLine(models.Model):
|
||||
notice = fields.Char(string='Discount Notice')
|
||||
product_id = fields.Many2one('product.product', string='Product', domain=[('sale_ok', '=', True)], required=True, change_default=True)
|
||||
price_unit = fields.Float(string='Unit Price', digits=0)
|
||||
qty = fields.Float('Quantity', digits=dp.get_precision('Product Unit of Measure'), default=1)
|
||||
qty = fields.Float('Quantity', digits='Product Unit of Measure', default=1)
|
||||
price_subtotal = fields.Float(string='Subtotal w/o Tax', digits=0,
|
||||
readonly=True, required=True)
|
||||
price_subtotal_incl = fields.Float(string='Subtotal', digits=0,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
'name': 'Products & Pricelists',
|
||||
'version': '1.2',
|
||||
'category': 'Sales',
|
||||
'depends': ['base', 'decimal_precision', 'mail', 'uom'],
|
||||
'depends': ['base', 'mail', 'uom'],
|
||||
'description': """
|
||||
This is the base module for managing products and pricelists in Odoo.
|
||||
========================================================================
|
||||
|
||||
@@ -8,7 +8,6 @@ from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.osv import expression
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from odoo.tools import float_compare
|
||||
|
||||
@@ -73,16 +72,16 @@ class ProductProduct(models.Model):
|
||||
# price: total price, context dependent (partner, pricelist, quantity)
|
||||
price = fields.Float(
|
||||
'Price', compute='_compute_product_price',
|
||||
digits=dp.get_precision('Product Price'), inverse='_set_product_price')
|
||||
digits='Product Price', inverse='_set_product_price')
|
||||
# price_extra: catalog extra value only, sum of variant extra attributes
|
||||
price_extra = fields.Float(
|
||||
'Variant Price Extra', compute='_compute_product_price_extra',
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits='Product Price',
|
||||
help="This is the sum of the extra price of all attributes")
|
||||
# lst_price: catalog value + extra, context dependent (uom)
|
||||
lst_price = fields.Float(
|
||||
'Public Price', compute='_compute_product_lst_price',
|
||||
digits=dp.get_precision('Product Price'), inverse='_set_product_lst_price',
|
||||
digits='Product Price', inverse='_set_product_lst_price',
|
||||
help="The sale price is managed from the product template. Click on the 'Configure Variants' button to set the extra attribute prices.")
|
||||
|
||||
default_code = fields.Char('Internal Reference', index=True)
|
||||
@@ -106,13 +105,13 @@ class ProductProduct(models.Model):
|
||||
|
||||
standard_price = fields.Float(
|
||||
'Cost', company_dependent=True,
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits='Product Price',
|
||||
groups="base.group_user",
|
||||
help = "Cost used for stock valuation in standard price and as a first price to set in average/fifo. "
|
||||
"Also used as a base price for pricelists. "
|
||||
"Expressed in the default unit of measure of the product.")
|
||||
volume = fields.Float('Volume')
|
||||
weight = fields.Float('Weight', digits=dp.get_precision('Stock Weight'))
|
||||
weight = fields.Float('Weight', digits='Stock Weight')
|
||||
|
||||
pricelist_item_ids = fields.Many2many(
|
||||
'product.pricelist.item', 'Pricelist Items', compute='_get_pricelist_items')
|
||||
@@ -772,7 +771,7 @@ class SupplierInfo(models.Model):
|
||||
'Quantity', default=0.0, required=True,
|
||||
help="The quantity to purchase from this vendor to benefit from the price, expressed in the vendor Product Unit of Measure if not any, in the default unit of measure of the product otherwise.")
|
||||
price = fields.Float(
|
||||
'Price', default=0.0, digits=dp.get_precision('Product Price'),
|
||||
'Price', default=0.0, digits='Product Price',
|
||||
required=True, help="The price to purchase a product")
|
||||
company_id = fields.Many2one(
|
||||
'res.company', 'Company',
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.osv import expression
|
||||
|
||||
@@ -243,7 +242,7 @@ class ProductTemplateAttributeValue(models.Model):
|
||||
price_extra = fields.Float(
|
||||
string='Attribute Price Extra',
|
||||
default=0.0,
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits='Product Price',
|
||||
help="""Price Extra: Extra price for the variant with
|
||||
this attribute value on sale price. eg. 200 price extra, 1000 + 200 = 1200.""")
|
||||
exclude_for = fields.One2many(
|
||||
|
||||
@@ -6,7 +6,6 @@ from itertools import chain
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class Pricelist(models.Model):
|
||||
@@ -424,19 +423,19 @@ class PricelistItem(models.Model):
|
||||
base_pricelist_id = fields.Many2one('product.pricelist', 'Other Pricelist')
|
||||
pricelist_id = fields.Many2one('product.pricelist', 'Pricelist', index=True, ondelete='cascade')
|
||||
price_surcharge = fields.Float(
|
||||
'Price Surcharge', digits=dp.get_precision('Product Price'),
|
||||
'Price Surcharge', digits='Product Price',
|
||||
help='Specify the fixed amount to add or substract(if negative) to the amount calculated with the discount.')
|
||||
price_discount = fields.Float('Price Discount', default=0, digits=(16, 2))
|
||||
price_round = fields.Float(
|
||||
'Price Rounding', digits=dp.get_precision('Product Price'),
|
||||
'Price Rounding', digits='Product Price',
|
||||
help="Sets the price so that it is a multiple of this value.\n"
|
||||
"Rounding is applied after the discount and before the surcharge.\n"
|
||||
"To have prices that end in 9.99, set rounding 10, surcharge -0.01")
|
||||
price_min_margin = fields.Float(
|
||||
'Min. Price Margin', digits=dp.get_precision('Product Price'),
|
||||
'Min. Price Margin', digits='Product Price',
|
||||
help='Specify the minimum amount of margin over the base price.')
|
||||
price_max_margin = fields.Float(
|
||||
'Max. Price Margin', digits=dp.get_precision('Product Price'),
|
||||
'Max. Price Margin', digits='Product Price',
|
||||
help='Specify the maximum amount of margin over the base price.')
|
||||
company_id = fields.Many2one(
|
||||
'res.company', 'Company',
|
||||
@@ -450,7 +449,7 @@ class PricelistItem(models.Model):
|
||||
('fixed', 'Fix Price'),
|
||||
('percentage', 'Percentage (discount)'),
|
||||
('formula', 'Formula')], index=True, default='fixed')
|
||||
fixed_price = fields.Float('Fixed Price', digits=dp.get_precision('Product Price'))
|
||||
fixed_price = fields.Float('Fixed Price', digits='Product Price')
|
||||
percent_price = fields.Float('Percentage Price')
|
||||
# functional fields used for usability purposes
|
||||
name = fields.Char(
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
import itertools
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import ValidationError, RedirectWarning, UserError
|
||||
@@ -69,27 +68,27 @@ class ProductTemplate(models.Model):
|
||||
# price: total template price, context dependent (partner, pricelist, quantity)
|
||||
price = fields.Float(
|
||||
'Price', compute='_compute_template_price', inverse='_set_template_price',
|
||||
digits=dp.get_precision('Product Price'))
|
||||
digits='Product Price')
|
||||
# list_price: catalog price, user defined
|
||||
list_price = fields.Float(
|
||||
'Sale Price', default=1.0,
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits='Product Price',
|
||||
help="Price at which the product is sold to customers.")
|
||||
# lst_price: catalog price for template, but including extra for variants
|
||||
lst_price = fields.Float(
|
||||
'Public Price', related='list_price', readonly=False,
|
||||
digits=dp.get_precision('Product Price'))
|
||||
digits='Product Price')
|
||||
standard_price = fields.Float(
|
||||
'Cost', compute='_compute_standard_price',
|
||||
inverse='_set_standard_price', search='_search_standard_price',
|
||||
digits=dp.get_precision('Product Price'), groups="base.group_user",
|
||||
digits='Product Price', groups="base.group_user",
|
||||
help = "Cost used for stock valuation in standard price and as a first price to set in average/FIFO.")
|
||||
|
||||
volume = fields.Float(
|
||||
'Volume', compute='_compute_volume', inverse='_set_volume', digits=dp.get_precision('Volume'), store=True)
|
||||
'Volume', compute='_compute_volume', inverse='_set_volume', digits='Volume', store=True)
|
||||
volume_uom_name = fields.Char(string='Volume unit of measure label', compute='_compute_volume_uom_name', default=_get_default_volume_uom)
|
||||
weight = fields.Float(
|
||||
'Weight', compute='_compute_weight', digits=dp.get_precision('Stock Weight'),
|
||||
'Weight', compute='_compute_weight', digits='Stock Weight',
|
||||
inverse='_set_weight', store=True)
|
||||
weight_uom_name = fields.Char(string='Weight unit of measure label', compute='_compute_weight_uom_name', readonly=True, default=_get_default_weight_uom)
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
||||
from odoo.tools.float_utils import float_compare
|
||||
from odoo.exceptions import UserError, AccessError
|
||||
from odoo.tools.misc import formatLang
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
@@ -430,7 +429,7 @@ class PurchaseOrderLine(models.Model):
|
||||
|
||||
name = fields.Text(string='Description', required=True)
|
||||
sequence = fields.Integer(string='Sequence', default=10)
|
||||
product_qty = fields.Float(string='Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True)
|
||||
product_qty = fields.Float(string='Quantity', digits='Product Unit of Measure', required=True)
|
||||
product_uom_qty = fields.Float(string='Total Quantity', compute='_compute_product_uom_qty', store=True)
|
||||
date_planned = fields.Datetime(string='Scheduled Date', required=True, index=True)
|
||||
taxes_id = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)])
|
||||
@@ -438,7 +437,7 @@ class PurchaseOrderLine(models.Model):
|
||||
product_uom_category_id = fields.Many2one(related='product_id.uom_id.category_id')
|
||||
product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], change_default=True, required=True)
|
||||
product_type = fields.Selection(related='product_id.type', readonly=True)
|
||||
price_unit = fields.Float(string='Unit Price', required=True, digits=dp.get_precision('Product Price'))
|
||||
price_unit = fields.Float(string='Unit Price', required=True, digits='Product Price')
|
||||
|
||||
price_subtotal = fields.Monetary(compute='_compute_amount', string='Subtotal', store=True)
|
||||
price_total = fields.Monetary(compute='_compute_amount', string='Total', store=True)
|
||||
@@ -453,14 +452,14 @@ class PurchaseOrderLine(models.Model):
|
||||
invoice_lines = fields.One2many('account.move.line', 'purchase_line_id', string="Bill Lines", readonly=True, copy=False)
|
||||
|
||||
# Replace by invoiced Qty
|
||||
qty_invoiced = fields.Float(compute='_compute_qty_invoiced', string="Billed Qty", digits=dp.get_precision('Product Unit of Measure'), store=True)
|
||||
qty_invoiced = fields.Float(compute='_compute_qty_invoiced', string="Billed Qty", digits='Product Unit of Measure', store=True)
|
||||
|
||||
qty_received_method = fields.Selection([('manual', 'Manual')], string="Received Qty Method", compute='_compute_qty_received_method', store=True,
|
||||
help="According to product configuration, the recieved quantity can be automatically computed by mechanism :\n"
|
||||
" - Manual: the quantity is set manually on the line\n"
|
||||
" - Stock Moves: the quantity comes from confirmed pickings\n")
|
||||
qty_received = fields.Float("Received Qty", compute='_compute_qty_received', inverse='_inverse_qty_received', compute_sudo=True, store=True, digits=dp.get_precision('Product Unit of Measure'))
|
||||
qty_received_manual = fields.Float("Manual Received Qty", digits=dp.get_precision('Product Unit of Measure'), copy=False)
|
||||
qty_received = fields.Float("Received Qty", compute='_compute_qty_received', inverse='_inverse_qty_received', compute_sudo=True, store=True, digits='Product Unit of Measure')
|
||||
qty_received_manual = fields.Float("Manual Received Qty", digits='Product Unit of Measure', copy=False)
|
||||
|
||||
partner_id = fields.Many2one('res.partner', related='order_id.partner_id', string='Partner', readonly=True, store=True)
|
||||
currency_id = fields.Many2one(related='order_id.currency_id', store=True, string='Currency', readonly=True)
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
from datetime import datetime, time
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
@@ -177,8 +176,8 @@ class PurchaseRequisitionLine(models.Model):
|
||||
product_id = fields.Many2one('product.product', string='Product', domain=[('purchase_ok', '=', True)], required=True)
|
||||
product_uom_id = fields.Many2one('uom.uom', string='Product Unit of Measure', domain="[('category_id', '=', product_uom_category_id)]")
|
||||
product_uom_category_id = fields.Many2one(related='product_id.uom_id.category_id')
|
||||
product_qty = fields.Float(string='Quantity', digits=dp.get_precision('Product Unit of Measure'))
|
||||
price_unit = fields.Float(string='Unit Price', digits=dp.get_precision('Product Price'))
|
||||
product_qty = fields.Float(string='Quantity', digits='Product Unit of Measure')
|
||||
price_unit = fields.Float(string='Unit Price', digits='Product Price')
|
||||
qty_ordered = fields.Float(compute='_compute_ordered_qty', string='Ordered Quantities')
|
||||
requisition_id = fields.Many2one('purchase.requisition', required=True, string='Purchase Agreement', ondelete='cascade')
|
||||
company_id = fields.Many2one('res.company', related='requisition_id.company_id', string='Company', store=True, readonly=True, default= lambda self: self.env.company)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools import float_compare
|
||||
|
||||
@@ -36,7 +35,7 @@ class Repair(models.Model):
|
||||
readonly=True, required=True, states={'draft': [('readonly', False)]})
|
||||
product_qty = fields.Float(
|
||||
'Product Quantity',
|
||||
default=1.0, digits=dp.get_precision('Product Unit of Measure'),
|
||||
default=1.0, digits='Product Unit of Measure',
|
||||
readonly=True, required=True, states={'draft': [('readonly', False)]})
|
||||
product_uom = fields.Many2one(
|
||||
'uom.uom', 'Product Unit of Measure',
|
||||
@@ -560,13 +559,13 @@ class RepairLine(models.Model):
|
||||
('remove', 'Remove')], 'Type', required=True)
|
||||
product_id = fields.Many2one('product.product', 'Product', required=True)
|
||||
invoiced = fields.Boolean('Invoiced', copy=False, readonly=True)
|
||||
price_unit = fields.Float('Unit Price', required=True, digits=dp.get_precision('Product Price'))
|
||||
price_unit = fields.Float('Unit Price', required=True, digits='Product Price')
|
||||
price_subtotal = fields.Float('Subtotal', compute='_compute_price_subtotal', store=True, digits=0)
|
||||
tax_id = fields.Many2many(
|
||||
'account.tax', 'repair_operation_line_tax', 'repair_operation_line_id', 'tax_id', 'Taxes')
|
||||
product_uom_qty = fields.Float(
|
||||
'Quantity', default=1.0,
|
||||
digits=dp.get_precision('Product Unit of Measure'), required=True)
|
||||
digits='Product Unit of Measure', required=True)
|
||||
product_uom = fields.Many2one(
|
||||
'uom.uom', 'Product Unit of Measure',
|
||||
required=True, domain="[('category_id', '=', product_uom_category_id)]")
|
||||
@@ -680,7 +679,7 @@ class RepairFee(models.Model):
|
||||
index=True, ondelete='cascade', required=True)
|
||||
name = fields.Text('Description', index=True, required=True)
|
||||
product_id = fields.Many2one('product.product', 'Product')
|
||||
product_uom_qty = fields.Float('Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True, default=1.0)
|
||||
product_uom_qty = fields.Float('Quantity', digits='Product Unit of Measure', required=True, default=1.0)
|
||||
price_unit = fields.Float('Unit Price', required=True)
|
||||
product_uom = fields.Many2one('uom.uom', 'Product Unit of Measure', required=True, domain="[('category_id', '=', product_uom_category_id)]")
|
||||
product_uom_category_id = fields.Many2one(related='product_id.uom_id.category_id')
|
||||
|
||||
@@ -12,7 +12,6 @@ from odoo.osv import expression
|
||||
from odoo.tools import float_is_zero, float_compare
|
||||
|
||||
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from werkzeug.urls import url_encode
|
||||
|
||||
@@ -1117,23 +1116,23 @@ class SaleOrderLine(models.Model):
|
||||
('to invoice', 'To Invoice'),
|
||||
('no', 'Nothing to Invoice')
|
||||
], string='Invoice Status', compute='_compute_invoice_status', store=True, readonly=True, default='no')
|
||||
price_unit = fields.Float('Unit Price', required=True, digits=dp.get_precision('Product Price'), default=0.0)
|
||||
price_unit = fields.Float('Unit Price', required=True, digits='Product Price', default=0.0)
|
||||
|
||||
price_subtotal = fields.Monetary(compute='_compute_amount', string='Subtotal', readonly=True, store=True)
|
||||
price_tax = fields.Float(compute='_compute_amount', string='Total Tax', readonly=True, store=True)
|
||||
price_total = fields.Monetary(compute='_compute_amount', string='Total', readonly=True, store=True)
|
||||
|
||||
price_reduce = fields.Float(compute='_get_price_reduce', string='Price Reduce', digits=dp.get_precision('Product Price'), readonly=True, store=True)
|
||||
price_reduce = fields.Float(compute='_get_price_reduce', string='Price Reduce', digits='Product Price', readonly=True, store=True)
|
||||
tax_id = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)])
|
||||
price_reduce_taxinc = fields.Monetary(compute='_get_price_reduce_tax', string='Price Reduce Tax inc', readonly=True, store=True)
|
||||
price_reduce_taxexcl = fields.Monetary(compute='_get_price_reduce_notax', string='Price Reduce Tax excl', readonly=True, store=True)
|
||||
|
||||
discount = fields.Float(string='Discount (%)', digits=dp.get_precision('Discount'), default=0.0)
|
||||
discount = fields.Float(string='Discount (%)', digits='Discount', default=0.0)
|
||||
|
||||
product_id = fields.Many2one('product.product', string='Product', domain=[('sale_ok', '=', True)], change_default=True, ondelete='restrict')
|
||||
product_template_id = fields.Many2one('product.template', string='Product Template', related="product_id.product_tmpl_id", domain=[('sale_ok', '=', True)])
|
||||
product_updatable = fields.Boolean(compute='_compute_product_updatable', string='Can Edit Product', readonly=True, default=True)
|
||||
product_uom_qty = fields.Float(string='Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True, default=1.0)
|
||||
product_uom_qty = fields.Float(string='Quantity', digits='Product Unit of Measure', required=True, default=1.0)
|
||||
product_uom = fields.Many2one('uom.uom', string='Unit of Measure')
|
||||
product_custom_attribute_value_ids = fields.One2many('product.attribute.custom.value', 'sale_order_line_id', string='User entered custom product attribute values')
|
||||
|
||||
@@ -1155,14 +1154,14 @@ class SaleOrderLine(models.Model):
|
||||
" - Analytic From expenses: the quantity is the quantity sum from posted expenses\n"
|
||||
" - Timesheet: the quantity is the sum of hours recorded on tasks linked to this sale line\n"
|
||||
" - Stock Moves: the quantity comes from confirmed pickings\n")
|
||||
qty_delivered = fields.Float('Delivered Quantity', copy=False, compute='_compute_qty_delivered', inverse='_inverse_qty_delivered', compute_sudo=True, store=True, digits=dp.get_precision('Product Unit of Measure'), default=0.0)
|
||||
qty_delivered_manual = fields.Float('Delivered Manually', copy=False, digits=dp.get_precision('Product Unit of Measure'), default=0.0)
|
||||
qty_delivered = fields.Float('Delivered Quantity', copy=False, compute='_compute_qty_delivered', inverse='_inverse_qty_delivered', compute_sudo=True, store=True, digits='Product Unit of Measure', default=0.0)
|
||||
qty_delivered_manual = fields.Float('Delivered Manually', copy=False, digits='Product Unit of Measure', default=0.0)
|
||||
qty_to_invoice = fields.Float(
|
||||
compute='_get_to_invoice_qty', string='To Invoice Quantity', store=True, readonly=True,
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits='Product Unit of Measure')
|
||||
qty_invoiced = fields.Float(
|
||||
compute='_get_invoice_qty', string='Invoiced Quantity', store=True, readonly=True,
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits='Product Unit of Measure')
|
||||
|
||||
untaxed_amount_invoiced = fields.Monetary("Untaxed Invoiced Amount", compute='_compute_untaxed_amount_invoiced', compute_sudo=True, store=True)
|
||||
untaxed_amount_to_invoice = fields.Monetary("Untaxed Amount To Invoice", compute='_compute_untaxed_amount_to_invoice', compute_sudo=True, store=True)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
import time
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
@@ -51,7 +50,7 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
product_id = fields.Many2one('product.product', string='Down Payment Product', domain=[('type', '=', 'service')],
|
||||
default=_default_product_id)
|
||||
count = fields.Integer(default=_count, string='Order Count')
|
||||
amount = fields.Float('Down Payment Amount', digits=dp.get_precision('Account'), help="The amount to be invoiced in advance, taxes excluded.")
|
||||
amount = fields.Float('Down Payment Amount', digits='Account', help="The amount to be invoiced in advance, taxes excluded.")
|
||||
deposit_account_id = fields.Many2one("account.account", string="Income Account", domain=[('deprecated', '=', False)],
|
||||
help="Account used for deposits", default=_default_deposit_account_id)
|
||||
deposit_taxes_id = fields.Many2many("account.tax", string="Customer Taxes", help="Taxes used for deposits", default=_default_deposit_taxes_id)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
@@ -158,10 +157,10 @@ class SaleOrderOption(models.Model):
|
||||
line_id = fields.Many2one('sale.order.line', ondelete="set null")
|
||||
name = fields.Text('Description', required=True)
|
||||
product_id = fields.Many2one('product.product', 'Product', required=True, domain=[('sale_ok', '=', True)])
|
||||
price_unit = fields.Float('Unit Price', required=True, digits=dp.get_precision('Product Price'))
|
||||
discount = fields.Float('Discount (%)', digits=dp.get_precision('Discount'))
|
||||
price_unit = fields.Float('Unit Price', required=True, digits='Product Price')
|
||||
discount = fields.Float('Discount (%)', digits='Discount')
|
||||
uom_id = fields.Many2one('uom.uom', 'Unit of Measure ', required=True)
|
||||
quantity = fields.Float('Quantity', required=True, digits=dp.get_precision('Product UoS'), default=1)
|
||||
quantity = fields.Float('Quantity', required=True, digits='Product UoS', default=1)
|
||||
sequence = fields.Integer('Sequence', help="Gives the sequence order when displaying a list of optional products.")
|
||||
|
||||
@api.onchange('product_id', 'uom_id')
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
@@ -51,9 +50,9 @@ class SaleOrderTemplateLine(models.Model):
|
||||
ondelete='cascade', index=True)
|
||||
name = fields.Text('Description', required=True, translate=True)
|
||||
product_id = fields.Many2one('product.product', 'Product', domain=[('sale_ok', '=', True)])
|
||||
price_unit = fields.Float('Unit Price', required=True, digits=dp.get_precision('Product Price'))
|
||||
discount = fields.Float('Discount (%)', digits=dp.get_precision('Discount'), default=0.0)
|
||||
product_uom_qty = fields.Float('Quantity', required=True, digits=dp.get_precision('Product UoS'), default=1)
|
||||
price_unit = fields.Float('Unit Price', required=True, digits='Product Price')
|
||||
discount = fields.Float('Discount (%)', digits='Discount', default=0.0)
|
||||
product_uom_qty = fields.Float('Quantity', required=True, digits='Product UoS', default=1)
|
||||
product_uom_id = fields.Many2one('uom.uom', 'Unit of Measure')
|
||||
|
||||
display_type = fields.Selection([
|
||||
@@ -109,10 +108,10 @@ class SaleOrderTemplateOption(models.Model):
|
||||
index=True, required=True)
|
||||
name = fields.Text('Description', required=True, translate=True)
|
||||
product_id = fields.Many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], required=True)
|
||||
price_unit = fields.Float('Unit Price', required=True, digits=dp.get_precision('Product Price'))
|
||||
discount = fields.Float('Discount (%)', digits=dp.get_precision('Discount'))
|
||||
price_unit = fields.Float('Unit Price', required=True, digits='Product Price')
|
||||
discount = fields.Float('Discount (%)', digits='Discount')
|
||||
uom_id = fields.Many2one('uom.uom', 'Unit of Measure ', required=True)
|
||||
quantity = fields.Float('Quantity', required=True, digits=dp.get_precision('Product UoS'), default=1)
|
||||
quantity = fields.Float('Quantity', required=True, digits='Product UoS', default=1)
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product_id(self):
|
||||
|
||||
@@ -2,14 +2,13 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = "sale.order.line"
|
||||
|
||||
margin = fields.Float(compute='_product_margin', digits=dp.get_precision('Product Price'), store=True)
|
||||
purchase_price = fields.Float(string='Cost', digits=dp.get_precision('Product Price'))
|
||||
margin = fields.Float(compute='_product_margin', digits='Product Price', store=True)
|
||||
purchase_price = fields.Float(string='Cost', digits='Product Price')
|
||||
|
||||
def _compute_margin(self, order_id, product_id, product_uom_id):
|
||||
frm_cur = self.env.company.currency_id
|
||||
@@ -67,7 +66,7 @@ class SaleOrderLine(models.Model):
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = "sale.order"
|
||||
|
||||
margin = fields.Monetary(compute='_product_margin', help="It gives profitability by calculating the difference between the Unit Price and the cost.", currency_field='currency_id', digits=dp.get_precision('Product Price'), store=True)
|
||||
margin = fields.Monetary(compute='_product_margin', help="It gives profitability by calculating the difference between the Unit Price and the cost.", currency_field='currency_id', digits='Product Price', store=True)
|
||||
|
||||
@api.depends('order_line.margin')
|
||||
def _product_margin(self):
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class ProjectCreateSalesOrder(models.TransientModel):
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.osv import expression
|
||||
from odoo.tools.float_utils import float_round
|
||||
@@ -25,7 +24,7 @@ class Product(models.Model):
|
||||
stock_move_ids = fields.One2many('stock.move', 'product_id', help='Technical: used to compute quantities.')
|
||||
qty_available = fields.Float(
|
||||
'Quantity On Hand', compute='_compute_quantities', search='_search_qty_available',
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
digits='Product Unit of Measure',
|
||||
help="Current quantity of products.\n"
|
||||
"In a context with a single Stock Location, this includes "
|
||||
"goods stored at this Location, or any of its children.\n"
|
||||
@@ -38,7 +37,7 @@ class Product(models.Model):
|
||||
"with 'internal' type.")
|
||||
virtual_available = fields.Float(
|
||||
'Forecast Quantity', compute='_compute_quantities', search='_search_virtual_available',
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
digits='Product Unit of Measure',
|
||||
help="Forecast quantity (computed as Quantity On Hand "
|
||||
"- Outgoing + Incoming)\n"
|
||||
"In a context with a single Stock Location, this includes "
|
||||
@@ -50,7 +49,7 @@ class Product(models.Model):
|
||||
"with 'internal' type.")
|
||||
incoming_qty = fields.Float(
|
||||
'Incoming', compute='_compute_quantities', search='_search_incoming_qty',
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
digits='Product Unit of Measure',
|
||||
help="Quantity of planned incoming products.\n"
|
||||
"In a context with a single Stock Location, this includes "
|
||||
"goods arriving to this Location, or any of its children.\n"
|
||||
@@ -61,7 +60,7 @@ class Product(models.Model):
|
||||
"Location with 'internal' type.")
|
||||
outgoing_qty = fields.Float(
|
||||
'Outgoing', compute='_compute_quantities', search='_search_outgoing_qty',
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
digits='Product Unit of Measure',
|
||||
help="Quantity of planned outgoing products.\n"
|
||||
"In a context with a single Stock Location, this includes "
|
||||
"goods leaving this Location, or any of its children.\n"
|
||||
@@ -498,16 +497,16 @@ class ProductTemplate(models.Model):
|
||||
description_pickingin = fields.Text('Description on Receptions', translate=True)
|
||||
qty_available = fields.Float(
|
||||
'Quantity On Hand', compute='_compute_quantities', search='_search_qty_available',
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits='Product Unit of Measure')
|
||||
virtual_available = fields.Float(
|
||||
'Forecasted Quantity', compute='_compute_quantities', search='_search_virtual_available',
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits='Product Unit of Measure')
|
||||
incoming_qty = fields.Float(
|
||||
'Incoming', compute='_compute_quantities', search='_search_incoming_qty',
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits='Product Unit of Measure')
|
||||
outgoing_qty = fields.Float(
|
||||
'Outgoing', compute='_compute_quantities', search='_search_outgoing_qty',
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits='Product Unit of Measure')
|
||||
# The goal of these fields is not to be able to search a location_id/warehouse_id but
|
||||
# to properly make these fields "dummy": only used to put some keys in context from
|
||||
# the search view in order to influence computed field
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.osv import expression
|
||||
from odoo.tools import float_compare, float_is_zero
|
||||
@@ -286,7 +285,7 @@ class InventoryLine(models.Model):
|
||||
required=True, readonly=True)
|
||||
product_qty = fields.Float(
|
||||
'Counted Quantity',
|
||||
digits=dp.get_precision('Product Unit of Measure'), default=0)
|
||||
digits='Product Unit of Measure', default=0)
|
||||
categ_id = fields.Many2one(related='product_id.categ_id', store=True)
|
||||
location_id = fields.Many2one(
|
||||
'stock.location', 'Location',
|
||||
@@ -303,10 +302,10 @@ class InventoryLine(models.Model):
|
||||
state = fields.Selection('Status', related='inventory_id.state')
|
||||
theoretical_qty = fields.Float(
|
||||
'Theoretical Quantity',
|
||||
digits=dp.get_precision('Product Unit of Measure'), readonly=True)
|
||||
digits='Product Unit of Measure', readonly=True)
|
||||
difference_qty = fields.Float('Difference', compute='_compute_difference',
|
||||
help="Indicates the gap between the product's theoretical quantity and its newest quantity.",
|
||||
readonly=True, digits=dp.get_precision('Product Unit of Measure'))
|
||||
readonly=True, digits='Product Unit of Measure')
|
||||
inventory_date = fields.Datetime('Inventory Date', readonly=True,
|
||||
default=fields.Datetime.now,
|
||||
help="Last date at which the On Hand Quantity has been computed.")
|
||||
|
||||
@@ -8,7 +8,6 @@ from operator import itemgetter
|
||||
from re import search as regex_search, split as regex_split
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.osv import expression
|
||||
from odoo.tools.float_utils import float_compare, float_round, float_is_zero
|
||||
@@ -53,7 +52,7 @@ class StockMove(models.Model):
|
||||
help='Quantity in the default UoM of the product')
|
||||
product_uom_qty = fields.Float(
|
||||
'Initial Demand',
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
digits='Product Unit of Measure',
|
||||
default=0.0, required=True, states={'done': [('readonly', True)]},
|
||||
help="This is the quantity of products from an inventory "
|
||||
"point of view. For moves in the state 'done', this is the "
|
||||
@@ -139,7 +138,7 @@ class StockMove(models.Model):
|
||||
returned_move_ids = fields.One2many('stock.move', 'origin_returned_move_id', 'All returned moves', help='Optional: all returned moves created from this move')
|
||||
reserved_availability = fields.Float(
|
||||
'Quantity Reserved', compute='_compute_reserved_availability',
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
digits='Product Unit of Measure',
|
||||
readonly=True, help='Quantity that has already been reserved for this move')
|
||||
availability = fields.Float(
|
||||
'Forecasted Quantity', compute='_compute_product_availability',
|
||||
@@ -151,7 +150,7 @@ class StockMove(models.Model):
|
||||
route_ids = fields.Many2many('stock.location.route', 'stock_location_route_move', 'move_id', 'route_id', 'Destination route', help="Preferred route")
|
||||
warehouse_id = fields.Many2one('stock.warehouse', 'Warehouse', help="Technical field depicting the warehouse to consider for the route selection on the next procurement (if any).")
|
||||
has_tracking = fields.Selection(related='product_id.tracking', string='Product with Tracking')
|
||||
quantity_done = fields.Float('Quantity Done', compute='_quantity_done_compute', digits=dp.get_precision('Product Unit of Measure'), inverse='_quantity_done_set')
|
||||
quantity_done = fields.Float('Quantity Done', compute='_quantity_done_compute', digits='Product Unit of Measure', inverse='_quantity_done_set')
|
||||
show_operations = fields.Boolean(related='picking_id.picking_type_id.show_operations', readonly=False)
|
||||
show_details_visible = fields.Boolean('Details Visible', compute='_compute_show_details_visible')
|
||||
show_reserved_availability = fields.Boolean('From Supplier', compute='_compute_show_reserved_availability')
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
from collections import Counter
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools.float_utils import float_round, float_compare, float_is_zero
|
||||
|
||||
@@ -27,8 +26,8 @@ class StockMoveLine(models.Model):
|
||||
product_qty = fields.Float(
|
||||
'Real Reserved Quantity', digits=0,
|
||||
compute='_compute_product_qty', inverse='_set_product_qty', store=True)
|
||||
product_uom_qty = fields.Float('Reserved', default=0.0, digits=dp.get_precision('Product Unit of Measure'), required=True)
|
||||
qty_done = fields.Float('Done', default=0.0, digits=dp.get_precision('Product Unit of Measure'), copy=False)
|
||||
product_uom_qty = fields.Float('Reserved', default=0.0, digits='Product Unit of Measure', required=True)
|
||||
qty_done = fields.Float('Done', default=0.0, digits='Product Unit of Measure', copy=False)
|
||||
package_id = fields.Many2one('stock.quant.package', 'Source Package', ondelete='restrict')
|
||||
package_level_id = fields.Many2one('stock.package_level', 'Package Level')
|
||||
lot_id = fields.Many2one('stock.production.lot', 'Lot/Serial Number')
|
||||
|
||||
@@ -6,7 +6,6 @@ from datetime import datetime
|
||||
from dateutil import relativedelta
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
|
||||
from odoo.osv import expression
|
||||
@@ -961,15 +960,15 @@ class Orderpoint(models.Model):
|
||||
readonly=True, required=True,
|
||||
default=lambda self: self._context.get('product_uom', False))
|
||||
product_min_qty = fields.Float(
|
||||
'Minimum Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True,
|
||||
'Minimum Quantity', digits='Product Unit of Measure', required=True,
|
||||
help="When the virtual stock equals to or goes below the Min Quantity specified for this field, Odoo generates "
|
||||
"a procurement to bring the forecasted quantity to the Max Quantity.")
|
||||
product_max_qty = fields.Float(
|
||||
'Maximum Quantity', digits=dp.get_precision('Product Unit of Measure'), required=True,
|
||||
'Maximum Quantity', digits='Product Unit of Measure', required=True,
|
||||
help="When the virtual stock goes below the Min Quantity, Odoo generates "
|
||||
"a procurement to bring the forecasted quantity to the Quantity specified as Max Quantity.")
|
||||
qty_multiple = fields.Float(
|
||||
'Qty Multiple', digits=dp.get_precision('Product Unit of Measure'),
|
||||
'Qty Multiple', digits='Product Unit of Measure',
|
||||
default=1, required=True,
|
||||
help="The procurement quantity will be rounded up to this multiple. If it is 0, the exact quantity will be used.")
|
||||
group_id = fields.Many2one(
|
||||
|
||||
@@ -16,7 +16,7 @@ class ProductChangeQuantity(models.TransientModel):
|
||||
related='product_tmpl_id.product_variant_count', readonly=False)
|
||||
new_quantity = fields.Float(
|
||||
'New Quantity on Hand', default=1,
|
||||
digits=dp.get_precision('Product Unit of Measure'), required=True,
|
||||
digits='Product Unit of Measure', required=True,
|
||||
help='This quantity is expressed in the Default Unit of Measure of the product.')
|
||||
|
||||
@api.onchange('product_id')
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See ICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools.float_utils import float_round
|
||||
|
||||
@@ -13,7 +12,7 @@ class ReturnPickingLine(models.TransientModel):
|
||||
_description = 'Return Picking Line'
|
||||
|
||||
product_id = fields.Many2one('product.product', string="Product", required=True, domain="[('id', '=', product_id)]")
|
||||
quantity = fields.Float("Quantity", digits=dp.get_precision('Product Unit of Measure'), required=True)
|
||||
quantity = fields.Float("Quantity", digits='Product Unit of Measure', required=True)
|
||||
uom_id = fields.Many2one('uom.uom', string='Unit of Measure', related='move_id.product_uom', readonly=False)
|
||||
wizard_id = fields.Many2one('stock.return.picking', string="Wizard")
|
||||
move_id = fields.Many2one('stock.move', "Move")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import float_is_zero
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class StockChangeStandardPrice(models.TransientModel):
|
||||
@@ -10,7 +9,7 @@ class StockChangeStandardPrice(models.TransientModel):
|
||||
_description = "Change Standard Price"
|
||||
|
||||
new_price = fields.Float(
|
||||
'Price', digits=dp.get_precision('Product Price'), required=True,
|
||||
'Price', digits='Product Price', required=True,
|
||||
help="If cost price is increased, stock variation account will be debited "
|
||||
"and stock output account will be credited with the value = (difference of amount * quantity available).\n"
|
||||
"If cost price is decreased, stock variation account will be creadited and stock input account will be debited.")
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
from collections import defaultdict
|
||||
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.addons.stock_landed_costs.models import product
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
@@ -171,7 +170,7 @@ class LandedCost(models.Model):
|
||||
AdjustementLines = self.env['stock.valuation.adjustment.lines']
|
||||
AdjustementLines.search([('cost_id', 'in', self.ids)]).unlink()
|
||||
|
||||
digits = dp.get_precision('Product Price')(self._cr)
|
||||
digits = self.env['decimal.precision'].precision_get('Product Price')
|
||||
towrite_dict = {}
|
||||
for cost in self.filtered(lambda cost: cost.picking_ids):
|
||||
total_qty = 0.0
|
||||
@@ -190,7 +189,7 @@ class LandedCost(models.Model):
|
||||
|
||||
former_cost = val_line_values.get('former_cost', 0.0)
|
||||
# round this because former_cost on the valuation lines is also rounded
|
||||
total_cost += tools.float_round(former_cost, precision_digits=digits[1]) if digits else former_cost
|
||||
total_cost += tools.float_round(former_cost, precision_digits=digits) if digits else former_cost
|
||||
|
||||
total_line += 1
|
||||
|
||||
@@ -217,7 +216,7 @@ class LandedCost(models.Model):
|
||||
value = (line.price_unit / total_line)
|
||||
|
||||
if digits:
|
||||
value = tools.float_round(value, precision_digits=digits[1], rounding_method='UP')
|
||||
value = tools.float_round(value, precision_digits=digits, rounding_method='UP')
|
||||
fnc = min if line.price_unit > 0 else max
|
||||
value = fnc(value, line.price_unit - value_split)
|
||||
value_split += value
|
||||
@@ -246,7 +245,7 @@ class LandedCostLine(models.Model):
|
||||
'stock.landed.cost', 'Landed Cost',
|
||||
required=True, ondelete='cascade')
|
||||
product_id = fields.Many2one('product.product', 'Product', required=True)
|
||||
price_unit = fields.Float('Cost', digits=dp.get_precision('Product Price'), required=True)
|
||||
price_unit = fields.Float('Cost', digits='Product Price', required=True)
|
||||
split_method = fields.Selection(product.SPLIT_METHOD, string='Split Method', required=True)
|
||||
account_id = fields.Many2one('account.account', 'Account', domain=[('deprecated', '=', False)])
|
||||
|
||||
@@ -278,17 +277,17 @@ class AdjustmentLines(models.Model):
|
||||
digits=0, required=True)
|
||||
weight = fields.Float(
|
||||
'Weight', default=1.0,
|
||||
digits=dp.get_precision('Stock Weight'))
|
||||
digits='Stock Weight')
|
||||
volume = fields.Float(
|
||||
'Volume', default=1.0)
|
||||
former_cost = fields.Float(
|
||||
'Former Cost', digits=dp.get_precision('Product Price'))
|
||||
'Former Cost', digits='Product Price')
|
||||
former_cost_per_unit = fields.Float(
|
||||
'Former Cost(Per Unit)', compute='_compute_former_cost_per_unit',
|
||||
digits=0, store=True)
|
||||
additional_landed_cost = fields.Float(
|
||||
'Additional Landed Cost',
|
||||
digits=dp.get_precision('Product Price'))
|
||||
digits='Product Price')
|
||||
final_cost = fields.Float(
|
||||
'Final Cost', compute='_compute_final_cost',
|
||||
digits=0, store=True)
|
||||
|
||||
Reference in New Issue
Block a user