fix: approving a reviewed quote no longer sends the acceptance stamps back

A quote held for review whose customer accepted the residue or the
stroke warning failed with "Confira os campos (422)" (DTF-WEB-8): the
server stamps residue_accepted_at and stroke_choice_at on the draft's
items, the Kanban sent the items back whole, and the item model forbids
extra fields. The metres field also showed the float noise of the draft
(212,32800000000012); it now shows up to three decimals.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-12 15:20:12 -03:00
parent 9cf4da0dea
commit 057643e167

View File

@@ -185,7 +185,10 @@ function review(quote){
}
const form=node('form',undefined,'rform');
const edits=quote.draft.items.map((item,index)=>{const fields={};body.append(quoteItem(item,fields,null,index,count));
return ()=>({...item,metres:fields.metres.value,grade:Number(fields.grade.value)});});
// The times the customer accepted a warning are stamped by the server
// (app/api/quotes.py) and not part of an item sent back (DTF-WEB-8).
const {residue_accepted_at,stroke_choice_at,...sent}=item;
return ()=>({...sent,metres:fields.metres.value,grade:Number(fields.grade.value)});});
const check=node('input');check.required=true;
const submit=node('button','Aprovar cotação','btn pri lg');
foot.append(checkbox('Arquivos, metragem e nota conferidos',check),discardButton(quote),submit);
@@ -258,7 +261,7 @@ function quoteItem(item,fields,priced,index=0,count=1){
info.append(notes);
if(fields){
const grid=node('div',undefined,'inputs');
fields.metres=node('input');Object.assign(fields.metres,{type:'number',min:'0.001',max:'12000',step:'any',value:item.metres,required:true});
fields.metres=node('input');Object.assign(fields.metres,{type:'number',min:'0.001',max:'12000',step:'any',value:String(Number(Number(item.metres).toFixed(3))),required:true});
fields.grade=node('input');Object.assign(fields.grade,{type:'number',min:'0',max:'100',step:'1',value:item.grade,required:true});
const m=field('Metros conferidos',fields.metres,'O cliente pediu '+metres(item.metres));
const low=Number(item.grade)<60;