Coder Social home page Coder Social logo

Comments (28)

woodbrettm avatar woodbrettm commented on July 16, 2024

@m3dbedb similar issue here as well. @lasley

  • Install Contract
  • Go to Invoicing, Contracts, Contract Templates.
  • Add an invoice line
  • Select [CARD] Graphics Card
  • Following Error appears:
Traceback (most recent call last):
  File "/opt/odoo/odoo/http.py", line 638, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo/http.py", line 675, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo/http.py", line 331, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo/service/model.py", line 119, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo/http.py", line 324, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/odoo/http.py", line 933, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo/http.py", line 504, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo/addons/web/controllers/main.py", line 862, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo/addons/web/controllers/main.py", line 854, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 681, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/opt/odoo/odoo/api.py", line 672, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/opt/odoo/odoo/models.py", line 5460, in onchange
    record._onchange_eval(name, field_onchange[name], result)
  File "/opt/odoo/odoo/models.py", line 5358, in _onchange_eval
    method_res = method(self)
  File "/media/sf_odoo10dev/contract/contract/models/account_analytic_invoice_line.py", line 85, in _onchange_product_id
    vals['price_unit'] = product.price
  File "/opt/odoo/odoo/fields.py", line 868, in __get__
    self.determine_value(record)
  File "/opt/odoo/odoo/fields.py", line 979, in determine_value
    self.compute_value(recs)
  File "/opt/odoo/odoo/fields.py", line 934, in compute_value
    self._compute_value(records)
  File "/opt/odoo/odoo/fields.py", line 926, in _compute_value
    getattr(records, self.compute)()
  File "/opt/odoo/addons/product/models/product.py", line 187, in _compute_product_price
    prices = pricelist.get_products_price(self, quantities, partners)
  File "/opt/odoo/addons/product/models/product_pricelist.py", line 254, in get_products_price
    return dict((product_id, res_tuple[0]) for product_id, res_tuple in self._compute_price_rule(zip(products, quantities, partners), date=date, uom_id=uom_id).iteritems())
  File "/opt/odoo/addons/product/models/product_pricelist.py", line 154, in _compute_price_rule
    (prod_tmpl_ids, prod_ids, categ_ids, self.id, date, date))
  File "/opt/odoo/odoo/sql_db.py", line 141, in wrapper
    return f(self, *args, **kwargs)
  File "/opt/odoo/odoo/sql_db.py", line 218, in execute
    res = self._obj.execute(query, params)
ProgrammingError: operator does not exist: date <= boolean
LINE 1: ...1) AND (item.date_start IS NULL OR item.date_start<=false) A...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

from contract.

pedrobaeza avatar pedrobaeza commented on July 16, 2024

Is this fixed?

from contract.

woodbrettm avatar woodbrettm commented on July 16, 2024

I'd imagine so. Mine ended up being unrelated and I've added invoice lines since then and it seems fine.

from contract.

lasley avatar lasley commented on July 16, 2024

#92 should do the trick. Amended the commit to include this ticket

from contract.

primes2h avatar primes2h commented on July 16, 2024

I've just tried a locally patched version with all those 5 commit (#92) Unfortunately it doesn't fix the issue.

Just to add more info, this is the error log from runbot:

  File "/.repo_requirements/odoo/odoo/http.py", line 640, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/.repo_requirements/odoo/odoo/http.py", line 677, in dispatch
    result = self._call_function(**self.params)
  File "/.repo_requirements/odoo/odoo/http.py", line 333, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/.repo_requirements/odoo/odoo/service/model.py", line 101, in wrapper
    return f(dbname, *args, **kwargs)
  File "/.repo_requirements/odoo/odoo/http.py", line 326, in checked_call
    result = self.endpoint(*a, **kw)
  File "/.repo_requirements/odoo/odoo/http.py", line 935, in __call__
    return self.method(*args, **kw)
  File "/.repo_requirements/odoo/odoo/http.py", line 506, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/odoo-10.0/addons/web/controllers/main.py", line 885, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/home/odoo/odoo-10.0/addons/web/controllers/main.py", line 877, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/.repo_requirements/odoo/odoo/api.py", line 687, in call_kw
    return call_kw_model(method, model, args, kwargs)
  File "/.repo_requirements/odoo/odoo/api.py", line 672, in call_kw_model
    result = method(recs, *args, **kwargs)
  File "/home/odoo/dependencies/bank-payment/account_payment_partner/models/account_invoice.py", line 62, in create
    return super(AccountInvoice, self).create(vals)
  File "/home/odoo/odoo-10.0/addons/account/models/account_invoice.py", line 345, in create
    invoice = super(AccountInvoice, self.with_context(mail_create_nolog=True)).create(vals)
  File "/home/odoo/odoo-10.0/addons/mail/models/mail_thread.py", line 228, in create
    thread = super(MailThread, self).create(values)
  File "/.repo_requirements/odoo/odoo/models.py", line 3806, in create
    vals = self._add_missing_default_values(vals)
  File "/.repo_requirements/odoo/odoo/models.py", line 1639, in _add_missing_default_values
    defaults = self.default_get(list(missing_defaults))
  File "/.repo_requirements/odoo/odoo/models.py", line 1131, in default_get
    defaults = self._convert_to_write(defaults)
  File "/.repo_requirements/odoo/odoo/models.py", line 4931, in _convert_to_write
    value = field.convert_to_cache(value, self, validate=False)
  File "/.repo_requirements/odoo/odoo/fields.py", line 2013, in convert_to_cache
    raise ValueError("Wrong value for %s: %s" % (self, value))
ValueError: Wrong value for account.invoice.analytic_account_ids: 12```

from contract.

primes2h avatar primes2h commented on July 16, 2024

And this is from a locally patched module:

  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 640, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 677, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 333, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 101, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 326, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 935, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 506, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 885, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 877, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 687, in call_kw
    return call_kw_model(method, model, args, kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 672, in call_kw_model
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/account/models/account_invoice.py", line 345, in create
    invoice = super(AccountInvoice, self.with_context(mail_create_nolog=True)).create(vals)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/mail/models/mail_thread.py", line 228, in create
    thread = super(MailThread, self).create(values)
  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 3806, in create
    vals = self._add_missing_default_values(vals)
  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 1639, in _add_missing_default_values
    defaults = self.default_get(list(missing_defaults))
  File "/usr/lib/python2.7/dist-packages/odoo/addons/utm/models/utm.py", line 61, in default_get
    values = super(UtmMixin, self).default_get(fields)
  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 1131, in default_get
    defaults = self._convert_to_write(defaults)
  File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 4931, in _convert_to_write
    value = field.convert_to_cache(value, self, validate=False)
  File "/usr/lib/python2.7/dist-packages/odoo/fields.py", line 2013, in convert_to_cache
    raise ValueError("Wrong value for %s: %s" % (self, value))
ValueError: Wrong value for account.invoice.analytic_account_ids: 9

from contract.

lasley avatar lasley commented on July 16, 2024

@primes2h - You tested the Runbot that was built on #92? It was expired long ago and didn't have logs available, so I think you were not on it.

I rebuilt and retested - invoices are generating fine. Can you please test using the Runbot that is currently available in the #92 PR and let me know replication steps if it does not work?

from contract.

primes2h avatar primes2h commented on July 16, 2024

@lasley The previous log from runbot was just to add some info about the bug itself.
Only the second log reported was from a patched module.

Anyway I've just tested the new runbot based on #92 PR and the bug is still there.
Steps to reproduce:

  1. Click on Invoicing, Sales→Contracts
  2. Open the existing Contract
  3. Click on "Invoices" button in the upper-right side
    immagine
  4. Create a new invoice
  5. Fill in data in the the new invoice
  6. Save

from contract.

lasley avatar lasley commented on July 16, 2024

@primes2h - I don't think that is a supported method of creating the invoices, because they won't contain the proper contract information. Keep in mind that this module is for automatic invoice creation, not manual.

We do have a way to create the invoices for testing though (or one-off invoice creations), which will use the same processes that the cron does. You'll need to enable developer mode, then a Create Invoices link appears:

image

from contract.

primes2h avatar primes2h commented on July 16, 2024

You are talking about recurring invoice, and I know that works in that way "if" you select "Generate recurring invoices automatically".

But it's a choice, you could need some contracts with recurring invoices (using the checkbox) and some without (leaving it blank), and add some contract invoice manually.

If you try to add another contract (with no recurring invoice) the error come up as well.

So it's definitely a bug.

If the module is intended to be for automatic invoice creation, you should remove "Generate recurring invoice" checkbox in my opinion.

from contract.

lasley avatar lasley commented on July 16, 2024

@primes2h - The "Invoices" button is provided by the contract_show_invoice module, but creation is not within the scope in that ReadMe. Contracts are typically naive of the invoices that they create - the contract_show_invoice is honestly just kind of a hack to get you to see the invoices (it's just a search on the pre-existing invoice view filtered for the proper analytic account ID).

It sounds like you're going a bit outside of the admittedly tiny box that these modules cover. Would you mind elaborating a bit more on your use case? It sounds like you may be interested in the work being done to expand the scope of this repo

from contract.

primes2h avatar primes2h commented on July 16, 2024

If the module is intended to be for automatic recurring invoice creation (and not manual), you should remove "Generate recurring invoice" checkbox in my opinion.

from contract.

lasley avatar lasley commented on July 16, 2024

@primes2h - The issue is that contracts are analytic accounts. You are looking at an analytic account view when you're looking at the contracts, so the checkbox is required to add the automation logic to those analytic accounts. This is what the mailing list thread I referenced is about - the current design is not really that good, but it's what we have right now.

We could maybe default the checkbox to True when in the contracts view though. Do you think that would help? Or maybe something else?

from contract.

lasley avatar lasley commented on July 16, 2024

It's also worth noting that invoices can be created and assigned to contracts, because they are analytic accounts.

You'll need to enable analytic accounting though I think, because it would be on the line items of the invoices and not the invoices themselves. @pedrobaeza correct me if I'm wrong here

from contract.

primes2h avatar primes2h commented on July 16, 2024

It "worths" in my opinion because invoices could belong to a contract and so be grouped together.
If you need to know what invoices come from that Contract, you can open the contract itself and click on the Invoices button on the upper-right side (in fact this is the purpose of that button, isn't it?)

Going back to this kind of bug, what I would like to explain is that, generally speaking, a module should be self-consistent.
If a traceback come up on the screen just after clicking the save button, I think it's definitely a bug, regardless the way you reach that point.

from contract.

carlosdauden avatar carlosdauden commented on July 16, 2024

This problem is caused by the module contract_show_invoice

[active_id], 'default_analytic_account_ids': active_id}</field>
with missing brackets and attempt assign default value to compute field
analytic_account_ids = fields.Many2many(
comodel_name='account.analytic.account',
compute='_compute_analytic_account_ids',
store=True,
string='Contracts')
@api.multi
@api.depends('invoice_line_ids.account_analytic_id')
def _compute_analytic_account_ids(self):
for invoice in self:
invoice.analytic_account_ids = invoice.mapped(
'invoice_line_ids.account_analytic_id'
)

BTW I think this module should not be in this repository because the module links analytic info, the contract field is

contract_id = fields.Many2one(

from contract.

primes2h avatar primes2h commented on July 16, 2024

You can reproduce the bug without that module (contract_show_invoice) installed.

Anyway I tried to install it but the bug is still there, nothing changed.

Anyway, I'll try to do some debug later, I hope to find something useful to fix this bug.

from contract.

lasley avatar lasley commented on July 16, 2024

@primes2h - The Invoices button is introduced in contract_show_invoice. How are you reproducing the error without the Invoices button?

There is a "Show recurring invoices" link, but I was able to create an invoice using that one just fine & it linked properly.

from contract.

lasley avatar lasley commented on July 16, 2024

Wait why the hell does a module exist to add a button for invoices, when we already have a link for invoices...

from contract.

pedrobaeza avatar pedrobaeza commented on July 16, 2024

For the invoices that have that analytic account, but not coming from recurring invoicing.

from contract.

lasley avatar lasley commented on July 16, 2024

The Show recurring invoices link does that as well. I created an invoice after clicking that link, then went back and it was there (it's the Edward Foster one without a source document)

from contract.

pedrobaeza avatar pedrobaeza commented on July 16, 2024

Don't go through the button, but add an invoice through Accounting and select that analytic account in an invoice line.

from contract.

lasley avatar lasley commented on July 16, 2024

Ohhhhhh interesting - it looks like contract_show_invoices has more bugs then, because it does not show the invoice I created (through Customer Invoices) either.

I did notice something though - if you create an invoice after clicking the link - it's a vendor invoice.

Creating a vendor invoice will show it in the Invoices link, but not the Show recurring invoices link as intended.

from contract.

carlosdauden avatar carlosdauden commented on July 16, 2024

#84

from contract.

carlosdauden avatar carlosdauden commented on July 16, 2024

Sorry, https://github.com/OCA/contract/pull/84/files#diff-508bda2f042a03d3c3f947df8fa38c0c

from contract.

primes2h avatar primes2h commented on July 16, 2024

@carlosdauden you were absolutely right! The problem was the missing brackets. I didn't realize that I was working on another local odoo installation on which the contract_show_invoice was installed

from contract.

primes2h avatar primes2h commented on July 16, 2024

#99 does the trick to fix this bug

from contract.

primes2h avatar primes2h commented on July 16, 2024

@lasley
yes, I confirm those bugs.

About the last one you reported, invoices are not linked with the contract itself (Source Document field is empty).

from contract.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.