Conversation
|
Please squash some commits according https://github.com/OCA/maintainer-tools/wiki/Merge-commits-in-pull-requests |
351885c to
8bfb488
Compare
|
Runbot is red but in runbot log I had a no error. Someone know why runbot is red ? `
|
| Tests summary: |
|---|
| test_server.py �[1;32mSuccess�[0;m |
| +======================================= |
| ` |
|
Runbot had some problems recently, I just rebuilt it, let's see. |
|
I rebuild runbot and had this error: |
|
It seems to be a problem with runbot. I have notified already @gurneyalex about it. |
|
Now runbot is build correctly but is still red, someone know why ? ping @gurneyalex @legalsylvain |
|
See logs. You will find this warning: |
|
I have proposed small fixes here: https://github.com/Eficent/server-tools/tree/11.0-mig-base_exception But cannot make a PR, the PR does not allow me to select the Akretion repo. |
2ca58e9 to
f9ad522
Compare
|
Thanks @jbeficent. I integrated your commit. |
|
@mourad-ehm I still added another commit ForgeFlow@b66bddf in https://github.com/Eficent/server-tools/tree/11.0-mig-base_exception. |
deb3cdd to
2cbe214
Compare
|
Here codecov is 55% but other tests coverage in purchase_exception will cover other parts of the code of this module. Then I think it's mergeable as it. Thanks @mourad-ehm for this work |
hparfr
left a comment
There was a problem hiding this comment.
Some remarks and questions
| active = fields.Boolean('Active') | ||
| next_state = fields.Char( | ||
| 'Next state', | ||
| help="If we detect exception we set de state of object (ex purchase) " |
| code = fields.Text( | ||
| 'Python Code', | ||
| help="Python code executed to check if the exception apply or " | ||
| "not. The code must apply block = True to apply the " |
There was a problem hiding this comment.
block = True or failed = True (code.default)
| rule.model].fields_get()[ | ||
| 'state']['selection'] | ||
| if rule.next_state\ | ||
| not in [s[0] for s in select_vals]: |
There was a problem hiding this comment.
put comprehension list out of if clause to add readability
| @api.multi | ||
| def _popup_exceptions(self): | ||
| action = self._get_popup_action() | ||
| action = action.read()[0] |
There was a problem hiding this comment.
merge in one line or use different variable names
| 'self': self.pool.get(rec._name), | ||
| 'object': rec, | ||
| 'obj': rec, | ||
| 'pool': self.pool, |
There was a problem hiding this comment.
No, this is not old API but variables which can use in Python code with safe_eval
There was a problem hiding this comment.
@mourad-ehm self.pool is not meant to be used.
I see it was migrated in v10 like that but it's incorrect. Use self.env[rec._name] and 'env': self.env instead of pool.
But I think changing function to @api.multi and returning {'self': self} should be sufficent. So, you can change the function signature removing obj_name and rec parameters!
| if rule.next_state: | ||
| if not next_state_rule: | ||
| next_state_rule = rule | ||
| elif next_state_rule and\ |
There was a problem hiding this comment.
useless next_state_rule condition (because of else)
There was a problem hiding this comment.
if not next_state_rule or rule.sequence < next_state_rule.sequence
next_state_rule = rule| current_model = self._context.get('active_model') | ||
| model_except_obj = self.env[current_model] | ||
| active_ids = self._context.get('active_ids') | ||
| assert len(active_ids) == 1, "Only 1 ID accepted, got %r" % active_ids |
2cbe214 to
b0f591f
Compare
| 'self': self.pool.get(rec._name), | ||
| 'object': rec, | ||
| 'obj': rec, | ||
| 'pool': self.pool, |
There was a problem hiding this comment.
@mourad-ehm self.pool is not meant to be used.
I see it was migrated in v10 like that but it's incorrect. Use self.env[rec._name] and 'env': self.env instead of pool.
But I think changing function to @api.multi and returning {'self': self} should be sufficent. So, you can change the function signature removing obj_name and rec parameters!
|
|
||
| @api.model | ||
| def _exception_rule_eval_context(self, obj_name, rec): | ||
| user = self.env['res.users'].browse(self._uid) |
| 'obj': rec, | ||
| 'pool': self.pool, | ||
| 'cr': self._cr, | ||
| 'uid': self._uid, |
There was a problem hiding this comment.
I thought self._cr, self._uid were shortcuts for self.env.cr, etc.
Are they now deprecated ?
Thanks for your review
There was a problem hiding this comment.
@bealdav See https://github.com/odoo/odoo/blob/ecbf7aa4714479229658d14cce28fa00376ed390/odoo/models.py#L4254
They are kept for backward compatibility but their future is not sure.
| 'object': rec, | ||
| 'obj': rec, | ||
| 'pool': self.pool, | ||
| 'cr': self._cr, |
b0f591f to
736b73e
Compare
cb443e9 to
785be4d
Compare
|
Thanks @jbeficent, I integrated your commits. |
rousseldenis
left a comment
There was a problem hiding this comment.
Code review.
Should add more tests on roadmap to improve coverage.
|
OK, thanks @rousseldenis |
|
@mourad-ehm remember to squash ;) |
|
Ok, thanks @simahawk. I done it. |
785be4d to
f886227
Compare
|
Hi @pedrobaeza, could you merge this PR ? |
|
Can you please squash commits by author/logic set before merging? |
* Fix menu in base_exception * Fix base_exception/views/base_exception_view.xml
…lled by constraint methods 'detect_exception' can be called on an empty recordset.
f886227 to
4342d25
Compare
|
Squash done. |
|
@pedrobaeza thanks for the merge. No project in v11 at akretion for now. It's just to help the community. Thanks |
|
Thank you! Much appreciated. Merging. |
[t133303] Update project branch with last fixes
MIG module base_exception and add test.