Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[13.0] [MIG] barcodes_generator_abstract: Migration to v13 #317

Merged
merged 14 commits into from
Feb 7, 2021

Conversation

CarlosRoca13
Copy link
Contributor

cc @Tecnativa TT26761

please @victoralmau @ernestotejeda review this

legalsylvain and others added 6 commits February 2, 2021 12:02
* Rename manifest
* Change openerp references to odoo
* Bump version
* Alphabetize imports
* pyBarcode is no longer maintained, switch to viivakoodi fork (https://bitbucket.org/whitie/python-barcode/issues/16/pypi-08-release-request#comment-33978213)
)

Add an option to allow for automatic generation of barcode when a record of mixin model is created
* [FIX] barcodes_generator_abstract: Caching issue
* Make cache method return ids & move the recordset method out of cache to fix OCA#93
Copy link
Contributor

@legalsylvain legalsylvain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff review (750ac09?file-filters%5B%5D=.py)

LGTM. (Code review / no test)
thanks for porting this module.

:target: https://runbot.odoo-community.org/runbot/150/13.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module expends Odoo functionality, allowing user to generate barcode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This module expends Odoo functionality, allowing user to generate barcode
This module extends Odoo functionality, allowing user to generate barcode

@@ -99,54 +117,57 @@ class barcode_rule(models.Model):

Finally, you should inherit your model view adding buttons and fields.

Note
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Known issues / Roadmap no longer exist?

@@ -94,13 +91,11 @@ def create(self, vals):
self._clear_cache(vals)
return super(BarcodeRule, self).create(vals)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return super(BarcodeRule, self).create(vals)
return super().create(vals)

@@ -94,13 +91,11 @@ def create(self, vals):
self._clear_cache(vals)
return super(BarcodeRule, self).create(vals)

@api.multi
def write(self, vals):
self._clear_cache(vals)
return super(BarcodeRule, self).write(vals)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return super(BarcodeRule, self).write(vals)
return super().write(vals)

Comment on lines 15 to 19
try:
import barcode
except ImportError:
_logger.debug("Cannot import 'python-barcode' python library.")
barcode = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
try:
import barcode
except ImportError:
_logger.debug("Cannot import 'python-barcode' python library.")
barcode = None
import barcode

Probably ImportError it's impossible because if defined in manifest file.

Comment on lines 46 to 43
record = super(BarcodeGenerateMixin, self).create(vals)
if barcode_rule:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
record = super(BarcodeGenerateMixin, self).create(vals)
if barcode_rule:
record = super().create(vals)
if record.barcode_rule_id:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable barcode_rule is defined on same method, I think what you suggest is not correct. https://github.com/OCA/stock-logistics-barcode/pull/317/files#diff-f50419781cc0e7e9172d09cf83bef00972791e23a60c5d8579585367c4453301R43

I applied just the change on super()

@api.model
def create(self, vals):
self._clear_cache(vals)
return super(BarcodeRule, self).create(vals)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return super(BarcodeRule, self).create(vals)
return super().create(vals)


def write(self, vals):
self._clear_cache(vals)
return super(BarcodeRule, self).write(vals)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return super(BarcodeRule, self).write(vals)
return super().write(vals)

@rousseldenis
Copy link
Sponsor Contributor

rousseldenis commented Feb 2, 2021

@CarlosRoca13 @legalsylvain Isn't it time to add tests ?

@CarlosRoca13 CarlosRoca13 force-pushed the 13.0-MIG-barcodes_generator_abstract branch from 750ac09 to da73444 Compare February 3, 2021 07:18
@CarlosRoca13
Copy link
Contributor Author

@rousseldenis Ok, I will add them as soon as I can

@CarlosRoca13
Copy link
Contributor Author

Thinking it better, This module needs that other depends on itself to work, so the test as in other versions should be in the dependent module. What do you think about that @rousseldenis ?

@CarlosRoca13
Copy link
Contributor Author

@ernestotejeda @victoralmau changes done

@rousseldenis
Copy link
Sponsor Contributor

Thinking it better, This module needs that other depends on itself to work, so the test as in other versions should be in the dependent module. What do you think about that @rousseldenis ?

For testing abstract things, you can use for sure odoo-test-helper.

@CarlosRoca13 CarlosRoca13 force-pushed the 13.0-MIG-barcodes_generator_abstract branch from da73444 to 3e9e251 Compare February 4, 2021 11:18
@CarlosRoca13
Copy link
Contributor Author

@rousseldenis this is my first time using the odoo-test-helper I add one test

@CarlosRoca13
Copy link
Contributor Author

@victoralmau Can you review it again?

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 13.0-ocabot-merge-pr-317-by-pedrobaeza-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Feb 5, 2021
Signed-off-by pedrobaeza
@OCA-git-bot
Copy link
Contributor

@pedrobaeza The merge process could not be finalized, because command oca-gen-addon-readme --org-name OCA --repo-name stock-logistics-barcode --branch 13.0 --addons-dir /tmp/tmpc24xev_t --commit failed with output:

/tmp/tmpc24xev_t/barcodes_generator_abstract/README.rst:146: (SEVERE/4) Title level inconsistent:

Authors
~~~~~~~
Traceback (most recent call last):
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 349, in check_subsection
    level = title_styles.index(style) + 1
ValueError: '~' is not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/oca-gen-addon-readme", line 11, in <module>
    load_entry_point('oca-maintainers-tools', 'console_scripts', 'oca-gen-addon-readme')()
  File "/ocamt/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/ocamt/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/ocamt/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/ocamt/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/ocamt/src/oca-maintainers-tools/tools/gen_addon_readme.py", line 312, in gen_addon_readme
    check_rst(readme_filename)
  File "/ocamt/src/oca-maintainers-tools/tools/gen_addon_readme.py", line 243, in check_rst
    settings_overrides=RST2HTML_SETTINGS,
  File "/ocamt/lib/python3.6/site-packages/docutils/core.py", line 380, in publish_file
    enable_exit_status=enable_exit_status)
  File "/ocamt/lib/python3.6/site-packages/docutils/core.py", line 664, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "/ocamt/lib/python3.6/site-packages/docutils/core.py", line 217, in publish
    self.settings)
  File "/ocamt/lib/python3.6/site-packages/docutils/readers/__init__.py", line 71, in read
    self.parse()
  File "/ocamt/lib/python3.6/site-packages/docutils/readers/__init__.py", line 77, in parse
    self.parser.parse(self.input, document)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/__init__.py", line 191, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 171, in run
    input_source=document['source'])
  File "/ocamt/lib/python3.6/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/ocamt/lib/python3.6/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 3007, in text
    self.section(title.lstrip(), source, style, lineno + 1, messages)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 395, in new_subsection
    node=section_node, match_titles=True)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 282, in nested_parse
    node=node, match_titles=match_titles)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/ocamt/lib/python3.6/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/ocamt/lib/python3.6/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 2771, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 395, in new_subsection
    node=section_node, match_titles=True)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 282, in nested_parse
    node=node, match_titles=match_titles)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/ocamt/lib/python3.6/site-packages/docutils/statemachine.py", line 239, in run
    context, state, transitions)
  File "/ocamt/lib/python3.6/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 2771, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 326, in section
    if self.check_subsection(source, style, lineno):
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 355, in check_subsection
    self.parent += self.title_inconsistent(source, lineno)
  File "/ocamt/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 373, in title_inconsistent
    line=lineno)
  File "/ocamt/lib/python3.6/site-packages/docutils/utils/__init__.py", line 237, in severe
    return self.system_message(self.SEVERE_LEVEL, *args, **kwargs)
  File "/ocamt/lib/python3.6/site-packages/docutils/utils/__init__.py", line 195, in system_message
    raise SystemMessage(msg, level)
docutils.utils.SystemMessage: /tmp/tmpc24xev_t/barcodes_generator_abstract/README.rst:146: (SEVERE/4) Title level inconsistent:

Authors
~~~~~~~

AndreVolksdorf and others added 5 commits February 7, 2021 15:18
Currently translated at 29.6% (8 of 27 strings)

Translation: stock-logistics-barcode-12.0/stock-logistics-barcode-12.0-barcodes_generator_abstract
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-barcode-12-0/stock-logistics-barcode-12-0-barcodes_generator_abstract/de/
Currently translated at 14.8% (4 of 27 strings)

Translation: stock-logistics-barcode-12.0/stock-logistics-barcode-12.0-barcodes_generator_abstract
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-barcode-12-0/stock-logistics-barcode-12-0-barcodes_generator_abstract/sl/
Currently translated at 46.4% (13 of 28 strings)

Translation: stock-logistics-barcode-12.0/stock-logistics-barcode-12.0-barcodes_generator_abstract
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-barcode-12-0/stock-logistics-barcode-12-0-barcodes_generator_abstract/it/
@pedrobaeza pedrobaeza force-pushed the 13.0-MIG-barcodes_generator_abstract branch from 3e9e251 to bc6273e Compare February 7, 2021 14:20
@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 13.0-ocabot-merge-pr-317-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 492c20f into OCA:13.0 Feb 7, 2021
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at a1d20d3. Thanks a lot for contributing to OCA. ❤️

@pedrobaeza pedrobaeza mentioned this pull request Apr 29, 2021
9 tasks
@pedrobaeza pedrobaeza deleted the 13.0-MIG-barcodes_generator_abstract branch October 7, 2021 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.