Odoo Help

0

0
1 Answer
0
Jose Enriquez
04/04/19 18:54

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
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now