Tolérance option
This commit is contained in:
@@ -279,6 +279,11 @@ class Purchase(metaclass=PoolMeta):
|
||||
tol_max_qt = fields.Numeric("Tol +")
|
||||
tolerance_used = fields.Function(
|
||||
fields.Numeric("Tolerance used"), 'get_tolerance_used')
|
||||
tolerance_option = fields.Selection([
|
||||
('no_option', "No option"),
|
||||
('buyer_option', "Buyer's option"),
|
||||
('seller_option', "Seller's option"),
|
||||
], "Tolerance option")
|
||||
tolerance_min = fields.Function(
|
||||
fields.Numeric("Tolerance min"), 'get_tolerance_min')
|
||||
tolerance_max = fields.Function(
|
||||
@@ -401,6 +406,10 @@ class Purchase(metaclass=PoolMeta):
|
||||
def default_tol_max(cls):
|
||||
return 0
|
||||
|
||||
@classmethod
|
||||
def default_tolerance_option(cls):
|
||||
return 'no_option'
|
||||
|
||||
def _line_quantity_in_unit(self, quantity, from_unit, to_unit):
|
||||
if not from_unit or not to_unit or from_unit == to_unit:
|
||||
return Decimal(str(quantity or 0))
|
||||
|
||||
@@ -251,6 +251,11 @@ class Sale(metaclass=PoolMeta):
|
||||
tol_max_qt = fields.Numeric("Tol +")
|
||||
tolerance_used = fields.Function(
|
||||
fields.Numeric("Tolerance used"), 'get_tolerance_used')
|
||||
tolerance_option = fields.Selection([
|
||||
('no_option', "No option"),
|
||||
('buyer_option', "Buyer's option"),
|
||||
('seller_option', "Seller's option"),
|
||||
], "Tolerance option")
|
||||
tolerance_min = fields.Function(
|
||||
fields.Numeric("Tolerance min"), 'get_tolerance_min')
|
||||
tolerance_max = fields.Function(
|
||||
@@ -365,6 +370,10 @@ class Sale(metaclass=PoolMeta):
|
||||
def default_tol_max(cls):
|
||||
return 0
|
||||
|
||||
@classmethod
|
||||
def default_tolerance_option(cls):
|
||||
return 'no_option'
|
||||
|
||||
def _line_quantity_in_unit(self, quantity, from_unit, to_unit):
|
||||
if not from_unit or not to_unit or from_unit == to_unit:
|
||||
return abs(Decimal(str(quantity or 0)))
|
||||
|
||||
@@ -1776,6 +1776,14 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
self.assertEqual(
|
||||
Purchase.operator.domain, [('categories.name', '=', 'OPERATOR')])
|
||||
|
||||
def test_sale_and_purchase_tolerance_option_defaults_to_no_option(self):
|
||||
'sale and purchase tolerance option defaults to no option'
|
||||
Sale = Pool().get('sale.sale')
|
||||
Purchase = Pool().get('purchase.purchase')
|
||||
|
||||
self.assertEqual(Sale.default_tolerance_option(), 'no_option')
|
||||
self.assertEqual(Purchase.default_tolerance_option(), 'no_option')
|
||||
|
||||
def test_sale_line_basis_price_and_progress_use_manual_summary_without_component(self):
|
||||
'sale line basis values use manual summary rows even without a component'
|
||||
SaleLine = Pool().get('sale.line')
|
||||
|
||||
@@ -36,6 +36,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="tolerance_used" widget="tolerance_gauge"
|
||||
min_field="tolerance_min" max_field="tolerance_max"
|
||||
xexpand="1" xfill="1"/>
|
||||
<label name="tolerance_option"/>
|
||||
<field name="tolerance_option"/>
|
||||
<field name="tolerance_min" invisible="1"/>
|
||||
<field name="tolerance_max" invisible="1"/>
|
||||
<newline/>
|
||||
|
||||
@@ -36,6 +36,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="tolerance_used" widget="tolerance_gauge"
|
||||
min_field="tolerance_min" max_field="tolerance_max"
|
||||
xexpand="1" xfill="1"/>
|
||||
<label name="tolerance_option"/>
|
||||
<field name="tolerance_option"/>
|
||||
<field name="tolerance_min" invisible="1"/>
|
||||
<field name="tolerance_max" invisible="1"/>
|
||||
<newline/>
|
||||
|
||||
Reference in New Issue
Block a user