Skip to content

Commit

Permalink
fixup! [MIG] sale_recovery_moment: Migration to 16.0 (from 12.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Jan 31, 2025
1 parent 2d52881 commit 50a091d
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 63 deletions.
1 change: 0 additions & 1 deletion sale_recovery_moment/ROADMAP.rst

This file was deleted.

2 changes: 2 additions & 0 deletions sale_recovery_moment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"website": "https://github.com/grap/grap-odoo-business",
"license": "AGPL-3",
"depends": [
# Odoo
"sale_stock",
# OCA
"stock_picking_report_summary",
],
"data": [
Expand Down
64 changes: 16 additions & 48 deletions sale_recovery_moment/models/sale_recovery_moment.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,9 @@ class SaleRecoveryMoment(models.Model):
]

# Columns Section
code = fields.Char(
string="Code",
readonly=True,
required=True,
default="/",
)
code = fields.Char(readonly=True, required=True, default="/")

name = fields.Char(string="Name", compute="_compute_name", store=True)
name = fields.Char(compute="_compute_name", store=True)

place_id = fields.Many2one(
comodel_name="sale.recovery.place", string="Place", required=True
Expand Down Expand Up @@ -59,15 +54,11 @@ class SaleRecoveryMoment(models.Model):
)

min_sale_date = fields.Datetime(
string="Minimum date for the Sale",
compute="_compute_sale_date",
store=True,
string="Minimum date for the Sale", compute="_compute_sale_date", store=True
)

max_sale_date = fields.Datetime(
string="Maximum date for the Sale",
compute="_compute_sale_date",
store=True,
string="Maximum date for the Sale", compute="_compute_sale_date", store=True
)

min_recovery_date = fields.Datetime(
Expand All @@ -78,77 +69,54 @@ class SaleRecoveryMoment(models.Model):
string="Maximum date for the Recovery", required=True
)

description = fields.Text(string="Description")
description = fields.Text()

max_order_qty = fields.Integer("Max Order Quantity")
max_order_qty = fields.Integer(string="Max Order Quantity")

order_ids = fields.One2many(
string="Sale Orders",
comodel_name="sale.order",
inverse_name="recovery_moment_id",
string="Sale Orders",
readonly=True,
)

order_qty = fields.Integer(
compute="_compute_order_multi",
multi="order",
store=True,
string="Sale Orders Quantity",
string="Sale Orders Quantity", compute="_compute_order_multi", store=True
)

valid_order_qty = fields.Integer(
compute="_compute_order_multi",
multi="order",
store=True,
string="Valid Sale Orders Quantity",
string="Valid Sale Orders Quantity", compute="_compute_order_multi", store=True
)

is_complete = fields.Boolean(
compute="_compute_order_multi",
multi="order",
store=True,
string="Is Complete",
)
is_complete = fields.Boolean(compute="_compute_order_multi", store=True)

quota_description = fields.Char(
compute="_compute_order_multi",
multi="order",
store=True,
string="Quota Description",
)
quota_description = fields.Char(compute="_compute_order_multi", store=True)

picking_ids = fields.One2many(
string="Delivery Orders",
comodel_name="stock.picking",
inverse_name="recovery_moment_id",
string="Delivery Orders",
readonly=True,
)

picking_qty = fields.Integer(
compute="_compute_picking_multi",
multi="picking",
store=True,
string="Delivery Orders Quantity",
string="Delivery Orders Quantity", compute="_compute_picking_multi", store=True
)

valid_picking_qty = fields.Integer(
string="Valid Delivery Orders Quantity",
compute="_compute_picking_multi",
multi="picking",
store=True,
string="Valid Delivery Orders Quantity",
)

state = fields.Selection(
compute="_compute_state",
string="State",
search="_search_state",
selection=_STATE_SELECTION,
compute="_compute_state", search="_search_state", selection=_STATE_SELECTION
)

# Defaults Section
@api.model
def _default_company_id(self):
return self.env.user.company_id
return self.env.company

# Overload Section
@api.model_create_multi
Expand Down
11 changes: 1 addition & 10 deletions sale_recovery_moment/models/sale_recovery_moment_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from odoo.exceptions import Warning as UserError



class SaleRecoveryMomentGroup(models.Model):
_name = "sale.recovery.moment.group"
_description = "Recovery Groups"
Expand Down Expand Up @@ -37,14 +36,12 @@ class SaleRecoveryMomentGroup(models.Model):

min_recovery_date = fields.Datetime(
compute="_compute_recovery_date",
multi="recovery_date",
string="Minimum date for the Recovery",
store=True,
)

max_recovery_date = fields.Datetime(
compute="_compute_recovery_date",
multi="recovery_date",
string="Maximum date for the Recovery",
store=True,
)
Expand All @@ -64,43 +61,37 @@ class SaleRecoveryMomentGroup(models.Model):

order_qty = fields.Integer(
compute="_compute_order_multi",
multi="order",
store=True,
string="Sale Orders Quantity",
)

valid_order_qty = fields.Integer(
compute="_compute_order_multi",
multi="order",
store=True,
string="Valid Sale Orders Quantity",
)

picking_qty = fields.Integer(
compute="_compute_picking_multi",
multi="picking",
store=True,
string="Delivery Orders Quantity",
)

valid_picking_qty = fields.Integer(
compute="_compute_picking_multi",
multi="picking",
store=True,
string="Valid Delivery Orders Quantity",
)

excl_total = fields.Float(
compute="_compute_total_multi",
multi="total",
store=True,
digits="Account",
string="Total (VAT Excluded)",
)

incl_total = fields.Float(
compute="_compute_total_multi",
multi="total",
store=True,
digits="Account",
string="Total (VAT Included)",
Expand All @@ -116,7 +107,7 @@ class SaleRecoveryMomentGroup(models.Model):
# Defaults Section
@api.model
def _default_company_id(self):
return self.env.user.company_id.id
return self.env.company

# Overload Section
@api.model_create_multi
Expand Down
2 changes: 1 addition & 1 deletion sale_recovery_moment/models/sale_recovery_place.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class SaleRecoveryPlace(models.Model):

@api.model
def _default_company_id(self):
return self.env.user.company_id.id
return self.env.company

# Columns Section
name = fields.Char("Name", required=True)
Expand Down
2 changes: 1 addition & 1 deletion sale_recovery_moment/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import _, api, fields, models
from odoo import _, fields, models


class StockPicking(models.Model):
Expand Down
4 changes: 2 additions & 2 deletions sale_recovery_moment/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Could be great to make this module working with the `` delivery_dropoff_site``
``delivery-carrier`` OCA module.
* This module displays some totals of Sale Orders; This amount will be wrong in a multicurrencies context for the instance.
* Could be great to make this module working with the `` delivery_dropoff_site`` / ``delivery-carrier`` OCA module.

0 comments on commit 50a091d

Please sign in to comment.