-
Notifications
You must be signed in to change notification settings - Fork 41
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
[16.0] [MIG] eater #521
[16.0] [MIG] eater #521
Conversation
@victor-champonnois I think it's fine as you did, let's keep it simple. Can you ping me when it's live in test? |
"Maybe we could make the field invisible for companies ?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some notes
eater/static/font/Roboto-Bold.ttf
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This font (and some other static resources) are deleted in the 13.0 migration commit. Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could have removed it in a separate commit. It's just that it's not used and it makes no sense to keep this file here.
eater/views/partner.xml
Outdated
attrs="{'invisible': ['|', ('customer', '=', False), ('eater', 'not in', ('worker_eater'))]}" | ||
attrs="{'invisible': [('eater', 'not in', ('worker_eater'))]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in the 13.0 migration commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
eater/views/partner.xml
Outdated
<field name="eater" attrs="{'invisible': [('customer', '=', False)]}" /> | ||
<field name="eater" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
eater/models/partner.py
Outdated
and partner.parent_eater_id.id != values.get("parent_eater_id") | ||
and partner.parent_eater_id != values.get("parent_eater_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes no sense to me.
eater/models/partner.py
Outdated
# fixme: shouldn't the check on "values.get("parent_eater_id")" be before | ||
# the for loop to avoid looping through all the contacts at every write? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
eater/models/partner.py
Outdated
# replace many2many command when writing on child_eater_ids to just | ||
# remove the link | ||
# fixme : is this still necessary ? In a many2many widget, removing an item | ||
# is a "3" (unlink) command. In which case would this be a delete command ? | ||
# replace many2many command when writing on child_eater_ids to unlink | ||
# rather than delete | ||
if "child_eater_ids" in values: | ||
for command in values["child_eater_ids"]: | ||
if command[0] == 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it depends on why this exists. The apparent goal to me is 'don't accidentally delete the linked child eaters when severing the link'. But why would the '2' command ever be sent when the '3' command is intended?
For context:
(2, id, _)
removes the link to and deletes the id related record.(3, id, _)
removes the link to, but does not delete, the id related record.
This is usually what you will use to delete related records on many-to-many
fields.
In any case, if we keep this line, a test should be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be in favor of removing it then. I don't see why this would be needed for this specific many2many field. Do you agree ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a Many2many field. Not sure why the comment calls it a 'many2many command'.
I'm happy to drop this code also. Let's just make a note of it somewhere that the functional tester can be aware of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(note in the task)
3ae5b3a
to
fc277e7
Compare
The migration commits should be stashed together. |
isn’t the module name too generic for such a specific module? |
[UPD] Update member_card.pot Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
[UPD] Update eater.pot Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
[UPD] Update eater_member_card.pot Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
[REF] put splitted modules as dependencies [FIX] test-requirements [FIX] remove beesdoo_base demo data in manifest Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
[FIX] contributors [FIX] remove deprecated demo data Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
We do not need to rename view names when moved from one module to the other. Odoo cleans up by himself as long as they are not defined as noupdate. Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
into: - product_main_supplier - sale_suggested_price - sale_adapt_price_wizard [REF] split beesdoo_product -> product_main_supplier [FIX] sale_suggested_price dep on product_main_supplier [ADD] module sale_edit_price_wizard [REF] rename sale_edit_price_wizard -> sale_adapt_price_wizard [REF] move rounding_method to sale_suggested_price [REF] refactor following PR 320 [REF] search product_code -> product_main_seller [FIX] bug adapt_sales_price [IMP] use float_compare to compare prices [REF] move list_price_write_date to sale_adapt_price_wizard [FIX] beesdoo_product: main_seller_id search [FIX] run precommit fix Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
fc277e7
to
5b1dfaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rebased this on top of the latest 12.0 to also include #516. I also applied a fix at the end, but I'm not entirely sure why the code that I fixed exists.
I'd like a confirmation that the tagged code is useful before we merge this.
eater/models/partner.py
Outdated
if values.get("parent_eater_id"): | ||
for partner in self: | ||
if ( | ||
partner.parent_eater_id | ||
and partner.parent_eater_id.id != values.get("parent_eater_id") | ||
): | ||
raise ValidationError( | ||
_( | ||
"You are trying to assign %(eater)s as an eater to" | ||
" a new partner, but this eater is already" | ||
" assigned to %(old_partner)s. Please remove the link" | ||
" before creating a new one." | ||
) | ||
% { | ||
"eater": partner.name, | ||
"old_partner": partner.parent_eater_id.name, | ||
} | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't be the eater of two workers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this would change the parent eater ("worker"), no? So after the operation, you still only have one parent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, that's weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It dates back from 8 years ago. Let's trust ourselves and state that this is useless. 3f4d9f6
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## 16.0 #521 +/- ##
==========================================
+ Coverage 66.26% 67.58% +1.31%
==========================================
Files 45 53 +8
Lines 1592 1672 +80
Branches 217 230 +13
==========================================
+ Hits 1055 1130 +75
- Misses 495 500 +5
Partials 42 42
|
eater/tests/test_eater.py
Outdated
@@ -6,15 +6,15 @@ class TestEater(TransactionCase): | |||
def test_assign_parent_eater(self): | |||
self.assertTrue( | |||
self.env.ref("eater.eater2").write( | |||
{"parent_eater_id": self.env.ref("eater.eater1")} | |||
{"parent_eater_id": self.env.ref("eater.worker1").id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better practice to create records in the tests and leave demo data for demo.
eater/demo/eaters.xml
Outdated
<record id="worker1" model="res.partner"> | ||
<field name="name">Gijs Eaterdam</field> | ||
<field name="firstname">Gijs</field> | ||
<field name="lastname">Eaterdam</field> | ||
<field name="eater">worker_eater</field> | ||
<field name="is_company" eval="False" /> | ||
</record> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to overload existing partners than creating new ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @robinkeunen
This check is not necessary. In a many2many widget, removing an item is a "3" (unlink) command. There doesn't seem to be a case where it would be a "2" command.
The check wasn't quite right (it compared the recordset to an id). The English was also really bad. Patched that up. Signed-off-by: Carmen Bianca BAKKER <carmen@coopiteasy.be>
4d6e3b8
to
d8fc3f3
Compare
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 48ba329. Thanks a lot for contributing to beescoop. ❤️ |
internal task : https://gestion.coopiteasy.be/web#id=10884&action=475&active_id=492&model=project.task&view_type=form&menu_id=
I need technical input on two questions : bca5176 and 9902d88
@polchampion Since the field "customer" has been removed in v13, I removed
This is not ideal, but I don't see a better solution. We could use the customer_rank field, which starts at zero and increases with the contact's orders. But this would mean that new contacts or contact that never shopped could not been added as Eater.
Maybe we could make the field invisible for companies ?