Faircot cron
This commit is contained in:
@@ -117,6 +117,7 @@
|
||||
<name ns="">widget</name>
|
||||
<choice>
|
||||
<value>binary</value>
|
||||
<value>badge</value>
|
||||
<value>boolean</value>
|
||||
<value>callto</value>
|
||||
<value>char</value>
|
||||
@@ -145,6 +146,14 @@
|
||||
</attribute>
|
||||
</optional>
|
||||
</define>
|
||||
<define name="attlist.field" combine="interleave">
|
||||
<optional>
|
||||
<attribute>
|
||||
<name ns="">badge_colors</name>
|
||||
<text/>
|
||||
</attribute>
|
||||
</optional>
|
||||
</define>
|
||||
<define name="attlist.field" combine="interleave">
|
||||
<optional>
|
||||
<attribute a:defaultValue="0">
|
||||
|
||||
@@ -252,7 +252,10 @@ class AutomationCron(ModelSQL, ModelView):
|
||||
logger.info(
|
||||
"Shipment %s existe deja sans lots, verification freight_booking_lots",
|
||||
si_number)
|
||||
inv_date, inv_nb = shipment._create_lots_from_fintrade()
|
||||
with Transaction().set_context(
|
||||
_purchase_trade_skip_physical_lot_tolerance_warning=True):
|
||||
inv_date, inv_nb = (
|
||||
shipment._create_lots_from_fintrade())
|
||||
shipment = ShipmentIn(shipment.id)
|
||||
if shipment.incoming_moves:
|
||||
shipment.controller = shipment.get_controller()
|
||||
@@ -342,6 +345,8 @@ class AutomationCron(ModelSQL, ModelView):
|
||||
shipment.etad = shipment.bl_date + timedelta(days=20)
|
||||
|
||||
ShipmentIn.save([shipment])
|
||||
with Transaction().set_context(
|
||||
_purchase_trade_skip_physical_lot_tolerance_warning=True):
|
||||
inv_date, inv_nb = shipment._create_lots_from_fintrade()
|
||||
shipment.controller = shipment.get_controller()
|
||||
shipment.controller_target = controller
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<tree>
|
||||
<field name="bl_number"/>
|
||||
<field name="status"/>
|
||||
<field name="status" widget="badge"
|
||||
badge_colors="found:#16a34a,Found:#16a34a,error:#ef4444,Error:#ef4444"/>
|
||||
<field name="shipment"/>
|
||||
<field name="automation_document"/>
|
||||
</tree>
|
||||
|
||||
@@ -1996,6 +1996,9 @@ class LotQt(
|
||||
|
||||
@classmethod
|
||||
def _warn_physical_lot_tolerance(cls, lqt, vlots):
|
||||
if Transaction().context.get(
|
||||
'_purchase_trade_skip_physical_lot_tolerance_warning'):
|
||||
return
|
||||
Warning = Pool().get('res.user.warning')
|
||||
for line in cls._affected_lines_for_lqt(lqt):
|
||||
theoretical = cls._line_theoretical_quantity(line)
|
||||
|
||||
@@ -9223,6 +9223,26 @@ description</t></is></c>
|
||||
patch.object(lot_module.LotQt, 'search', return_value=[]):
|
||||
lot_module.LotQt.match_lots([purchase_lot], [])
|
||||
|
||||
def test_physical_lot_tolerance_warning_can_be_skipped_by_context(self):
|
||||
'physical lot tolerance warning can be skipped for automation cron'
|
||||
line = Mock(
|
||||
purchase=Mock(number='P-1'),
|
||||
sale=None,
|
||||
id=12,
|
||||
quantity_theorical=Decimal('100'),
|
||||
tol_max=Decimal('0'),
|
||||
inherit_tol=False,
|
||||
unit=None,
|
||||
lots=[],
|
||||
)
|
||||
lqt = Mock(lot_p=Mock(line=line), lot_s=None)
|
||||
physical_lot = Mock(lot_quantity=Decimal('120'), lot_unit_line=None)
|
||||
|
||||
with Transaction().set_context(
|
||||
_purchase_trade_skip_physical_lot_tolerance_warning=True):
|
||||
lot_module.LotQt._warn_physical_lot_tolerance(
|
||||
lqt, [physical_lot])
|
||||
|
||||
def test_lot_matching_gauge_uses_entered_quantity_to_match(self):
|
||||
'go to matching gauge projects tolerance from qt to match'
|
||||
matching_lot = lot_module.LotMatchingLot()
|
||||
|
||||
Reference in New Issue
Block a user