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][IMP] logistics_planning_*: adds hook and unhook logistics with account move line #156

Open
wants to merge 3 commits into
base: 13.0
Choose a base branch
from

Conversation

ChristianSantamaria
Copy link
Contributor

Adds hook and unhook logistics with account move line

@ChristianSantamaria ChristianSantamaria force-pushed the 13.0-imp-logistics_planning-account_move_line branch from 0cd25e7 to c274a48 Compare December 9, 2024 10:49
@ChristianSantamaria ChristianSantamaria force-pushed the 13.0-imp-logistics_planning-account_move_line branch from c274a48 to 7e4d271 Compare December 9, 2024 10:57
@ChristianSantamaria
Copy link
Contributor Author

@dalonsod can u review this?

@dalonsod
Copy link
Contributor

dalonsod commented Dec 9, 2024

Not sure if current implementation for sales and purchase addons will work when analytic account is not filled in origin (an unexpected error could be raised, looking for id value). And remember, for such case (logistics planning has no analytic account linked) we need to find those invoice lines that have no analytic account filled as well.

product_id = fields.Many2one('product.product', related='logistics_schedule_id.product_id')
carrier_id = fields.Many2one('res.partner', related='logistics_schedule_id.carrier_id')
invoice_line_id = fields.Many2one('account.move.line', string="Invoice Line")
domain_invoice_line_id = fields.Many2many('account.move.line', compute='_compute_domain_invoice_line_id')
Copy link
Contributor

Choose a reason for hiding this comment

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

Better naming:

Suggested change
domain_invoice_line_id = fields.Many2many('account.move.line', compute='_compute_domain_invoice_line_id')
domain_invoice_line_ids = fields.Many2many('account.move.line', compute='_compute_domain_invoice_line_ids')

product_id = self.logistics_schedule_id._get_invoice_product()
if not product_id:
raise ValidationError(_("It is necessary to configure the default products of the logistics planning"))
return [('move_id.partner_id', '=', self.carrier_id.id), ('product_id', '=', product_id.id)]
Copy link
Contributor

Choose a reason for hiding this comment

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

I miss a default condition: only select those move lines that actually are invoice lines (see https://github.com/odoo/odoo/blob/4cc086d330b73514fbc64a7fcf22d8a7a9f1b691/addons/account/models/account_move.py#L216)

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.

2 participants