Do you mean that you want to dynamically compute serial numbers and quantity in qweb?
You could try something like this for serial number:
<t t-foreach="o.lines" t-as="p">
  <span t-esc="p_index">
</t> 
The "_index" is automatically understood by qweb to generate the index number
If you want to create your own, you could try something like:
<t t-set="i" t-value="1" /> 
<t t-foreach="o.lines" t-as="p">
  <span t-esc="i"> 
  <t t-set="i" t-value="i+1"/> 
</t>
EDIT:
For adding quantity dynamically, I assume your code to display quantity looks something like this:
<t t-foreach="o.lines" t-as="p">
  <span t-esc="p.quantity">  
You need to initialize a variable before the loop, and simply add the quantity to it for each iteration:
<t t-set="i" t-value="0" /> 
<t t-foreach="o.lines" t-as="p">
  <span t-esc="i"> 
  <t t-set="i" t-value="i+p.quantity"/> 
</t> 
<t t-esc="i" />
This way you should get the quantity
Let me know if this doesn't work
            
I've updated my post. Hope this helps.
thank a lot @Shawn Varghese