odoo13 TypeError: Cannot create a consistent method resolution(Chatter to an existing model) - typeerror

I got the problem ,can anybody help me? thanks
TypeError: Cannot create a consistent method resolution
class StockQuant(models.Model):
_name = 'stock.quant'
_inherit = ['stock.quant', 'mail.thread']
manifest.py
'category': 'Report',
'version': '0.1',
# any module necessary for this one to work correctly
'depends': ['base', 'sale', 'web','mail','product','stock'],
Error
File "odoo13\source\odoo\modules\registry.py", line 221, in load
model = cls._build_model(self, cr)
File "odoo13\source\odoo\models.py", line 504, in _build_model
ModelClass.__bases__ = tuple(bases)
TypeError: Cannot create a consistent method resolution
order (MRO) for bases Model, mail.thread, stock.quant, base

You have a loop of dependencies here, sale depends on sales_team that already depends on base and mail, stock already depends on product too.
You need to remove base, mail, and product.

Related

not authorized to create a partner while loading demo data

Trying to add some demo data to a module of ours, some records can't be created
The culprit seems to be this piece of code
#api.model
def create(self, vals_list):
if not self.env.user.has_group('some-project.group_super') and not self.env.user.has_group(
'some-project.group_some_role'):
raise ValidationError(
f"Some error message.")
vals_list['serial_number_for_this_entity'] = self.env['ir.sequence'].next_by_code('some_project.res.partner')
return super(ThisEntity, self).create(vals_list)
and the error I'm having is "Some error message"
it seems that because while installing I still can't have the role "group_some_role" I can't add a partner
So I should
create a database without demo data
install my module
putting my user in the "some_role" group
load the demo data manually
I'd like to be able to install my module with its demo data flawlessly
What's the idiomatic solution for this ?

NS3 and WAF compatibility

File "/home/~/ns-allinone-3.33/ns-3.33/.waf3-2.0.21-c6c9a875365426e5928462b9b74d40b5/waflib/TaskGen.py", line 123, in post
v()
File "/home/~/ns-allinone-3.33/ns-3.33/src/wscript", line 724, in apply_ns3moduleheader
for source in sorted(ns3headers.headers):
AttributeError: 'task_gen' object has no attribute 'headers'
Is it something incompatible between ns-3.33 and waf3-2.0.21? Is there a solution to the problem?
ns-3.33 uses Waf version 2.0.21. I'm guessing that the error you are seeing is from adding some code that is not compatible with ns-3.33? Do you get this error from downloading and building a fresh copy of the ns-3.33 release? Note: most questions such as these are handled in the ns-3-users#googlegroups.com forum.

Name error in object detection api in real time code

File "", line 18, in output_dict = run_inference_for_single_image(image_np, detection_graph)
NameError: name 'run_inference_for_single_image' is not defined.
This is the error i am getting by running the code from the below given github site i dont know how to debug that line.
object detection github link
Can someone please help me to resolve this error?

Openerp7 migration to odoo 11

I am trying to migrate a database from Openerp7 to Odoo11.
I have done this before but now this database has custom fields and models which were created through UI not custom modules, and now makes a problem.
cona#cona-cons:~$ tailf /var/tmp/openupgrade/migration.log
result = method(recs, *args, **kwargs)
File "/var/tmp/openupgrade/8.0/server/openerp/models.py", line 3052, in _setup_fields
field.setup(self.env)
File "/var/tmp/openupgrade/8.0/server/openerp/fields.py", line 470, in setup
self._setup_regular(env)
File "/var/tmp/openupgrade/8.0/server/openerp/fields.py", line 1792, in _setup_regular
invf = comodel._fields[self.inverse_name]
KeyError: u'x_payment_line_id'
Is there any way to remove the custom models and fields (as they are not needed and get a clean db for migration?
Thanks

What is self.pool.get() in python and odoo?

I assume it is used to refer fields in other modules in openerp, but I am not sure.
Here they are somehow getting price from one products module to sales module.
price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], product, qty or 1.0, partner_id, ctx)[pricelist]
if price is False:
warn_msg = _("Cannot find a pricelist line matching this product and quantity.\n"
"You have to change either the product, the quantity or the pricelist.")
warning_msgs += _("No valid pricelist line found ! :") + warn_msg +"\n\n"
else:
result.update({'price_unit': price})
if context.get('uom_qty_change', False):
return {'value': {'price_unit': price}, 'domain': {}, 'warning': False}
self.pool.get()
The pool is here just a dictionary-like object that is used to store instances of the OpenERP models, like res.users or ir.model.data.
Multi-database nature of OpenERP / Odoo: a single OpenERP server process can manage multiple databases, and for each database, the set of installed modules, and thus the set of models, can vary.
So, we have different pools, one per database, and the normal way to reference the model instance we are already in, self
Thanks to The Hypered Blog for the great explanation on the self.pool.get().
For more info check that link.
Pool
pool is a registry (dictionary object {}).
The registry is essentially a mapping between model names and model
instances. There is one registry instance per database.
server/openerp/osv/orm.py
class BaseModel(object):
def __init__(self, pool, cr):
""" Initialize a model and make it part of the given registry.
- copy the stored fields' functions in the osv_pool,
- update the _columns with the fields found in ir_model_fields,
- ensure there is a many2one for each _inherits'd parent,
- update the children's _columns,
- give a chance to each field to initialize itself.
"""
pool.add(self._name, self)
self.pool = pool
Refer /openerp/sql_db.py to see how Odoo-Postgresql connection
pool establish.
_Pool = None
def db_connect(to, allow_uri=False):
global _Pool
if _Pool is None:
_Pool = ConnectionPool(int(tools.config['db_maxconn']))
db, uri = dsn(to)
if not allow_uri and db != to:
raise ValueError('URI connections not allowed')
return Connection(_Pool, db, uri)
def close_db(db_name):
""" You might want to call openerp.modules.registry.RegistryManager.delete(db_name) along this function."""
global _Pool
if _Pool:
_Pool.close_all(dsn(db_name)[1])
def close_all():
global _Pool
if _Pool:
_Pool.close_all()
Connection class
class Connection(object):
""" A lightweight instance of a connection to postgres
"""
def __init__(self, pool, dbname, dsn):
self.dbname = dbname
self.dsn = dsn
self.__pool = pool
if you look at the /server/openerp/pooler.py file there you can find the method get_db_and_pool which is used to Create and return a database connection and a newly initialized registry, there are many other methods related to pool look at these.
def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False):
"""Create and return a database connection and a newly initialized registry."""
registry = RegistryManager.get(db_name, force_demo, status, update_module)
return registry.db, registry
def restart_pool(db_name, force_demo=False, status=None, update_module=False):
"""Delete an existing registry and return a database connection and a newly initialized registry."""
registry = RegistryManager.new(db_name, force_demo, status, update_module)
return registry.db, registry
def get_db(db_name):
"""Return a database connection. The corresponding registry is initialized."""
return get_db_and_pool(db_name)[0]
def get_pool(db_name, force_demo=False, status=None, update_module=False):
"""Return a model registry."""
return get_db_and_pool(db_name, force_demo, status, update_module)[1]
And finally you call get method of dictionary to get the value of the specified key, even you can use can use self.pool['model_name'], any method of dictionary can be used with pool.
self.pool.get() is used to get the Singleton instance of the orm model from the registry pool.
If you want to call orm methods for any other model you can use self.pool.get('model').orm_method
And in new API, if you want to call ORM method directly from an object you can use self.env['obj'].method instead of self.method
Hope this helps.