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

[FIX] product_variants_no_automatic_creation: Bug Product attribute e… #1252

Merged
merged 2 commits into from Nov 28, 2016
Merged

[FIX] product_variants_no_automatic_creation: Bug Product attribute e… #1252

merged 2 commits into from Nov 28, 2016

Conversation

Daniel-CA
Copy link
Member

Bug Product attribute extra prices are not automatically added.

@@ -31,8 +31,10 @@ class ProductConfigurator(models.AbstractModel):
@api.depends('product_attribute_ids', 'product_attribute_ids.value_id')
def _compute_price_extra(self):
for record in self:
record.price_extra = sum(
record.mapped('product_attribute_ids.price_extra'))
for variant_id in record.attribute_value_ids:
Copy link
Member

Choose a reason for hiding this comment

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

Esto debe hacerse sólo cuando product_id no está establecido. Además, utiliza mapped y filtered en una sola línea que queda mucho más elegante y legible, en lugar de tanto for.

@pedrobaeza
Copy link
Member

Sigue sin estar contemplado el caso en el que haya product_id establecido. Recuerda que el product_tmpl_id es algo que añadimos nosotros y, por tanto, no en todas las BDs tiene por qué estar relleno.

@Daniel-CA
Copy link
Member Author

@pedrobaeza como ves los últimos cambios?

def _compute_price_extra(self):
for record in self:
record.price_extra = sum(
record.mapped('product_attribute_ids.price_extra'))
if record.product_id:
Copy link
Member

Choose a reason for hiding this comment

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

Esto sería al revés, ¿no?

Copy link
Member Author

@Daniel-CA Daniel-CA Jun 29, 2016

Choose a reason for hiding this comment

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

Pero si no tengo product_id no puedo hacer referencia al campo attribute_value_ids, ya que ese campo no se encuentra en la clase abstracta.

Copy link
Member

Choose a reason for hiding this comment

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

Sí, perdona, lo he dicho mal.

@pedrobaeza
Copy link
Member

¿Esto sigue ocurriendo?

@agaldona
Copy link
Collaborator

agaldona commented Oct 6, 2016

@pedrobaeza Si, sigue ocurriendo, de hecho nos lo acaban de reportar de nuevo.

agaldona
agaldona previously approved these changes Oct 18, 2016
Copy link
Collaborator

@agaldona agaldona left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@agaldona agaldona dismissed their stale review October 18, 2016 13:50

Not Correct

@codecov-io
Copy link

codecov-io commented Nov 22, 2016

Current coverage is 57.56% (diff: 100%)

Merging #1252 into 8.0 will decrease coverage by <.01%

@@                8.0      #1252   diff @@
==========================================
  Files           268        268          
  Lines          8027       8031     +4   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           4621       4623     +2   
- Misses         3406       3408     +2   
  Partials          0          0          

Powered by Codecov. Last update d44339d...f15a1de

Copy link
Collaborator

@agaldona agaldona left a comment

Choose a reason for hiding this comment

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

It works.

@oihane oihane merged commit 46ac7a4 into odoomrp:8.0 Nov 28, 2016
diggy128 pushed a commit to diggy128/odoomrp-wip that referenced this pull request Jun 16, 2017
odoomrp#1252)

* [FIX] product_variants_no_automatic_creation: Bug Product attribute extra prices are not automatically added

* [FIX] product_variants_no_automatic_creation: fix flake-8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants