Giter Club home page Giter Club logo

anthem's People

Contributors

ajaniszewska-dev avatar cyrilmanuel avatar damdam-s avatar dependabot-preview[bot] avatar florentx avatar grindtildeath avatar guewen avatar gurneyalex avatar i-vyshnevska avatar jcoux avatar leemannd avatar lepistone avatar max3903 avatar mmequignon avatar sebalix avatar simahawk avatar tdu avatar vrenaville avatar yvaucher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anthem's Issues

add_xmlid should check that xmlid does not exist on another model

The add_xmlid method currently skips the creation of the xmlid if it already exists on a different record. It should fail instead.

def add_xmlid(ctx, record, xmlid, noupdate=False):
""" Add a XMLID on an existing record """
try:
ref_id, __, __ = ctx.env['ir.model.data'].xmlid_lookup(xmlid)
except ValueError:
pass # does not exist, we'll create a new one
else:
return ctx.env['ir.model.data'].browse(ref_id)
if '.' in xmlid:
module, name = xmlid.split('.')
else:
module = ''
name = xmlid
return ctx.env['ir.model.data'].create({
'name': name,
'module': module,
'model': record._name,
'res_id': record.id,
'noupdate': noupdate,
})

Uninstall method can not be called several times

The uninstall method doesn't work well if you call it several times in the same operation (seems only the first call work)

eg:

@anthem.log
def uninstall_agreement_sale_and_base_contract(ctx):
    """ Uninstall agreement_sale and dependency modules """
    uninstall(ctx, ['base_contract', 'agreement_sale'])


@anthem.log
def uninstall_account_followup_partner_level(ctx):
    uninstall(ctx, ['account_followup_partner_level'])


@anthem.log
def uninstall_account_invoice_supplier_ref_reuse(ctx):
    uninstall(ctx, ['account_invoice_supplier_ref_reuse'])


@anthem.log
def pre(ctx):
    """Applying 13.0.1.1.0 PRE operations"""
    uninstall_addons(ctx)


@anthem.log
def post(ctx):
    """ POST: uninstall """
    uninstall_agreement_sale_and_base_contract(ctx)
    uninstall_account_followup_partner_level(ctx)
    uninstall_account_invoice_supplier_ref_reuse(ctx)

in this case only base_contract and agreement_sale were finally uninstalled

[Question] How to upgrade modules with anthem without restarting the server?

I have this method that is supposed to upgrade a list of modules:

@anthem.log
def upgrade_list(ctx):
    """ upgrade module """
    module_list = ['hr', 'purchase']
    mods = ctx.env['ir.module.module'].search([('name', 'in', module_list), ('state', '=', 'installed')])
    if mods:
        mods.button_immediate_upgrade()

Odoo version 12

The upgrade doesn't take effect until the server is restarted!
I tried to change the name of an ir.ui.menu and it changed in the database but didn't change in the browser!

How can I upgrade modules without restarting the server?

lyrics.loader.load_csv - tracking disable & noupdate

load_csv being mostly used to load tons of data, wouldn't it make sens to change the default values?

Usage has shown that we almost use tracking disabled every time.
Plus, data created from CSV is mostly not config and shouldn't be modified update, thus it should also
set the xml ids as noupdate.

We can change the current function default behavior or have an alias that does this small change.

For me there is 2 use case:

  • Most common: create new record data csv, data as the user create them, we don't want any module changing them (fake module name does the trick but it's hacky)
  • Less common: Modify existing data, can be used for data that already exists in database, you don't care about noupdate because it is already in that state.

Occasional tests failures

The installation of Odoo 10.0 used to run the tests sometimes fails. Tests in themselves are green, but the setup sometimes fails. I could not find the reason yet.

lyrics.modules.update_translations broken on new versions

header_exclude bug

Hello, songs have been exported for the mtsmte project.
I'm facing a lot of import errors because anthem is trying to exclude header that is not present. https://github.com/camptocamp/anthem/blob/master/anthem/lyrics/loaders.py#L93
Import res.partner from csv: error main: error Traceback (most recent call last): File "/usr/local/bin/anthem", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/anthem/cli.py", line 59, in main run(odoo_args, args.target, options) File "/usr/local/lib/python2.7/dist-packages/anthem/cli.py", line 88, in run func(ctx) File "/usr/local/lib/python2.7/dist-packages/anthem/output.py", line 72, in decorated return func(*args, **kwargs) File "/opt/odoo/songs/install/generated/stock.py", line 158, in main load_res_partner(ctx) File "/usr/local/lib/python2.7/dist-packages/anthem/output.py", line 72, in decorated return func(*args, **kwargs) File "/opt/odoo/songs/install/generated/stock.py", line 137, in load_res_partner load_csv(ctx, 'data/install/generated/res.partner.csv', model, header_exclude=header_exclude) # noqa File "/opt/odoo/songs/common.py", line 23, in load_csv header=header, header_exclude=header_exclude) File "/usr/local/lib/python2.7/dist-packages/anthem/lyrics/loaders.py", line 93, in load_csv_stream pop_idxs = [_header.index(x) for x in header_exclude] ValueError: 'self/id' is not in list

We should update this in order not to have an error while trying to remove an unexisting header.

Unistall method failing

uninstall method now raise UserError if addon is not installed, so running the migration step is not idempotent and fails on the second run
suppose we need to filter addons based on their state before execution

[12.0] update_translations with overwrite=True doesn't work

Here

def update_translations(ctx, module_list, overwrite=False):
""" Update translations from module list"""
if not isinstance(module_list, list):
raise AnthemError(u"You have to provide a list of "
"module's name to update the translations")
if overwrite:
ctx.log_line(
u'All previous translations will be dropped for requested addons'
)
ir_module = ctx.env['ir.module.module']
if hasattr(ir_module, 'update_translations'):
# Odoo version <= 10.0
method_name = 'update_translations'
else:
# Odoo version >= 11.0
method_name = '_update_translations'
domain = [('name', 'in', module_list)]
mods = ctx.env['ir.module.module'].search(domain)
ctx.log_line('Reloading translations for %s' % str(module_list))
mods.with_context(overwrite=overwrite)
getattr(mods, method_name)()

we specify overwrite=True, so existing translation should be overwritten.
While debugging here (where it's supposed to be upserted)
https://github.com/odoo/odoo/blob/5d40023eaf9b3c25941429e7fac266722780846d/odoo/addons/base/models/ir_translation.py#L137
always have self._overwrite=False.

Update PyPI package to latest version

PyPi package has been outdated for the past 3 years.

Adding install instructions for anthem would be nice, if the preferred way to install is from the repository instead of using PyPI

"Updating module configuration" README section is out of date

with current anthem version and Odoo v12:
instead of from anthem.lyrics import settings should be from anthem.lyrics.settings import define_settings

it is no more model = ctx.env['sale.config.settings']
but model = ctx.env['res.config.settings']

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.