Error trying to create an invoice for Odoo 14 using a third-party module

Asked

Viewed 42 times

-1

Hello, I installed a module called "Beauty Spa Management" from cybrosys in my instance of Odoo 14 and when trying to create an invoice for a service the system generates error (it uses the Odoo’s own Voice module),

Follow the error message:

Erro:
Odoo Server Error

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 682, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 358, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 346, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 911, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 530, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1359, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1351, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 396, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 383, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/mnt/extra-addons/salon_management/models/salon_management.py", line 252, in write
    self.salon_invoice_create()
  File "/mnt/extra-addons/salon_management/models/salon_management.py", line 335, in salon_invoice_create
    inv = self.env['account.move'].create(invoice_line)
  File "<decorator-gen-160>", line 2, in create
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 344, in _model_create_multi
    return create(self, [arg])
  File "/usr/lib/python3/dist-packages/odoo/addons/account/models/account_move.py", line 1789, in create
    vals_list = self._move_autocomplete_invoice_lines_create(vals_list)
  File "/usr/lib/python3/dist-packages/odoo/addons/account/models/account_move.py", line 1748, in _move_autocomplete_invoice_lines_create
    move = self_ctx.new(new_vals)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 5480, in new
    record._update_cache(values, validate=False)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 5122, in _update_cache
    raise ValueError("Invalid field %r on model %r" % (e.args[0], self._name))
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 638, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 314, in _handle_exception
    raise exception.with_traceback(None) from new_cause
ValueError: Invalid field 'l10n_in_gst_treatment' on model 'account.move'

Does anyone have any idea what it might be? I tried to study the source code of the module but did not succeed in finding the error, it follows the function that creates the receipt in the source code of the above mentioned module:

    def salon_invoice_create(self):
        if self.partner_id:
            supplier = self.partner_id
        else:
            supplier = self.partner_id.search([("name", "=", "Salon Default Customer")])
        lines = []
        product_id = self.env['product.product'].search([("name", "=", "Salon Service")])
        for records in self.order_line:
            if product_id.property_account_income_id.id:
                income_account = product_id.property_account_income_id.id
            elif product_id.categ_id.property_account_income_categ_id.id:
                income_account = product_id.categ_id.property_account_income_categ_id.id
            else:
                raise UserError(_('Please define income account for this product: "%s" (id:%d).') % (product_id.name,
                                                                                                     product_id.id))

            value = (0, 0, {
                        'name': records.service_id.name,
                        'account_id': income_account,
                        'price_unit': records.price,
                        'quantity': 1,
                        'product_id': product_id.id,
                    })
            lines.append(value)

        invoice_line = {
            'move_type': 'out_invoice',
            'partner_id': supplier.id,
            'l10n_in_gst_treatment': 'consumer',
            'invoice_user_id': self.env.user.id,
            'invoice_origin': self.name,
            'invoice_line_ids': lines,
        }
        inv = self.env['account.move'].create(invoice_line)


        imd = self.env['ir.model.data']

        action = imd.xmlid_to_object('account.action_move_out_invoice_type')
        result = {
            'name': action.name,
            'type': 'ir.actions.act_window',
            'views': [[False, 'form']],
            'target': 'current',
            'res_id':inv.id,
            'res_model': 'account.move',
        }

        self.inv_stage_identifier = True
        self.stage_id = 3
        invoiced_records = self.env['salon.order'].search([('stage_id', 'in', [3, 4]),
                                                           ('chair_id', '=', self.chair_id.id)])
        total = 0
        for rows in invoiced_records:
            invoiced_date = str(rows.date)
            invoiced_date = invoiced_date[0:10]
            if invoiced_date == str(date.today()):
                total = total + rows.price_subtotal
        self.chair_id.collection_today = total
        self.chair_id.number_of_orders = len(self.env['salon.order'].search([("chair_id", "=", self.chair_id.id),
                                                                             ("stage_id", "in", [2, 3])]))

        return result

1 answer

-1


Valueerror: Invalid field 'l10n_in_gst_treatment' on model 'Account.move'

On the last line is this error, odoo found an invalid field in the Account.movemodel. have to check that your odoo does not recognize the l10n_in_gst_treatment field. Maybe some module is missing, by name it is something of the Indian location. l10n_in represents the Indian location. From what I researched GST is an Idian tax, certainly its odoo does not have it implemented. Researching a little more, I saw that the company that created the module "Beauty Spa Management" is Indian, everything indicates that the module was not tested outside the Indian location, so the error.

Try removing references to the 'l10n_in_gst_treatment' field in the source code of the mentioned module. Or install the Indian location, but I don’t think it should be of your interest.

  • 1

    I already found the groove for the case, in fact just remove the references from the field 'l10n_in_gst_treatment' solved the error without causing any fault in the program flow, thanks for the support!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.