Community: Framework mailing list archives

expert-framework@mail.odoo.com

Re: How to add computation field in Sales Quotation?

by
Franz Bautista
- 01/28/2015 06:22:22
It snot actually a rebate but I need to add a certain percent to the total amount and then get the tax from that then get the Grand Total.

To Summarize I should be able to show in the Billing the following:

Subtotal      - total bill
ASF           - total bill * x%
VAT           - Total bill * 12%(government figure)
                ---------------
Grand Total Total of above

The VAT is already built in but the ASF or another number not sure how to apply.





Regards,

Franz Bautista, CEH
NABI Computer Systems
Tel     : 632-985-6755
Fax    : 632-854-2643
skype/ym id: nabicom


On Wed, Jan 28, 2015 at 7:07 PM, Adlibitom <ad.libitom@laposte.net> wrote:

I understand that you need to give a 10% rebate on quotations
Why don't you use the standard pricelist function?

Le 28/01/2015 07:37, Franz Bautista a écrit :
<blockquote cite="mid:CAP9ZQ4eqqZ+gQNJgMUYU7=MtQskBnxNX-7iEGvjXj=u4Mg7C2Q@mail.gmail.com" type="cite">

I created a custom computation field called "x_asf" (under the amount_untaxed field in quotation). The formula of the ASF field is amount_untaxed * 0.10

 

I added the code below but it's not working. anyone can help?

 

def _amount_all_wrapper(self, cr, uid, ids, field_name, arg, context=None):
        """ Wrapper because of direct method passing as parameter for function fields """
        return self._amount_all(cr, uid, ids, field_name, arg, context=context)

    def _amount_all(self, cr, uid, ids, field_name, arg, context=None):
        cur_obj = self.pool.get('res.currency')
        res = {}
        for order in self.browse(cr, uid, ids, context=context):
            res[order.id] = {
                'amount_untaxed': 0.0,
                'x_asf': 0.0,
                'amount_tax': 0.0,
                'amount_total': 0.0,
            }
            val = val1 = 0.0
            cur = order.pricelist_id.currency_id
            for line in order.order_line:
                val1 += line.price_subtotal
                val += self._amount_line_tax(cr, uid, line, context=context)
            res[order.id]['amount_tax'] = cur_obj.round(cr, uid, cur, val)
            res[order.id]['x_asf'] = res[order.id]['amount_untaxed'] * 0.10
            res[order.id]['amount_untaxed'] = cur_obj.round(cr, uid, cur, val1)
            res[order.id]['amount_total'] = res[order.id]['amount_untaxed'] + res[order.id]['amount_tax']
        return res

Regards,

Franz Bautista, CEH
NABI Computer Systems
Tel     : 632-985-6755
Fax    : 632-854-2643
skype/ym id: nabicom

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-framework-62
Post to: mailto:expert-framework@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe