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] purchase_stock: AVCO computation - support line discount #79

Open
wants to merge 17 commits into
base: 16.0-alc_master
Choose a base branch
from

Conversation

jbaudoux
Copy link

No description provided.

rousseldenis and others added 17 commits May 4, 2023 12:01
…utation

If one change the use_create_lots field on stock.picking.type, we should not trigger
all move lines recomputation of that picking type.
This change allows to take advantage of field descriptors on relational fields to initialize the comodel_name from optional type's arg that can be specified on field declaration. With this change, this kind of syntax becomes valid and will avoid errors in the comodel_name args.

partner = fields.Many2one[Partner]()

This code is not part of the _Relational class constructor since we need to get access to the __orig_class__ attribute which is set on the instance by the Generic metaclass after the call to the _Relational class constructor.
To avoid circular import it's common to reference a type as a string for generics:

```python
from odoo import models, fields

from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from .res_partner import Partner as ResPartner

class Thing(models.Model):

    _name = "thing"
    _description = "Thing"

    partner_id = fields.Many2one["ResPartner"]()

```

In such a case, the type's arg at runtime is not a class but an instance of typing.ForwadRef. In such a case, the comodel_name is computed by converting the classname provided by te ForwardRef from CamelCase to dot.case
the typing_extension is required by the type annotations
Calls a dedicated method to clone an existing field to ensure that the type args is preserved when instantiating the cloned instance
Allow building a wheel or an sdist through the pep517
interface, taking care of the required pre-processing
to copy addons in odoo/addons.

Force the setuptools compat mode for editable installs.
This mode is the simplest, since it just installs a .pth
files which extends PYTHONPATH with the Odoo root directory.
This allows launching Odoo with "python -m odoo".

This manner of launching python applications is now widespread.
In particular it makes it easier to configure an IDE debugger to run with the correct python version.
@sbidoul
Copy link
Member

sbidoul commented Dec 1, 2023

Can this be considered an Odoo bug? @jbaudoux

@jbaudoux
Copy link
Author

jbaudoux commented Dec 1, 2023 via email

@lmignon lmignon force-pushed the 16.0-alc_master branch 2 times, most recently from 14694ea to 982f767 Compare July 16, 2024 14:19
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.

4 participants