Odoo Help

0

0
1 Answer
0
Jose Enriquez
4/4/19, 6:54 PM

I found by my self the way to change the fiscal_position_id selection changing a payment_method selection on an in_invoice:


 @api.onchange('payment_method')

    def change_fiscal_position(self):

        self.ensure_one()

        FISCAL = self.env['account.fiscal.position']

        fiscal_position = {}

        if self.payment_method == "10" or self.payment_method == "19":      # 10 o 19 Tarjeta de Crédito 

            fiscal_position = FISCAL.browse([11])                           # 11 Compras Pago Tarjeta Crédito

        elif self.payment_method == "16":                                   # 16 Tarjeta de Débito 

            fiscal_position = FISCAL.browse([11])                           # 11 Compras Pago Tarjeta Crédito

        elif self.payment_method == "06":                                   # 06 Débito de Cuenta

            fiscal_position = FISCAL.browse([10])                           # 10 Compras Pago Convenio Débito           

        else:                                                                                       # Others

            fiscal_position = self.partner_id.property_account_position_id          # Keeps Partner Fiscal Position 

        if fiscal_position:

            self.fiscal_position_id = fiscal_position

        return {}

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register