-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by legalsylvain
- Loading branch information
Showing
7 changed files
with
86 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,37 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * joint_buying_product_food | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2021-08-12 13:30+0000\n" | ||
"PO-Revision-Date: 2021-08-12 13:30+0000\n" | ||
"POT-Creation-Date: 2024-09-18 01:14+0000\n" | ||
"PO-Revision-Date: 2024-09-18 01:14+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: joint_buying_product_food | ||
#: model:ir.model,name:joint_buying_product_food.model_joint_buying_purchase_order_line | ||
msgid "Joint Buying Purchase Order" | ||
msgstr "Commande" | ||
|
||
#. module: joint_buying_product_food | ||
#: model:ir.model,name:joint_buying_product_food.model_joint_buying_tour | ||
msgid "Joint buying tour" | ||
msgstr "Tournée de commandes groupées" | ||
|
||
#. module: joint_buying_product_food | ||
#: model:ir.model,name:joint_buying_product_food.model_product_product | ||
msgid "Product" | ||
msgstr "Article" | ||
|
||
#. module: joint_buying_product_food | ||
#: model:ir.model.fields,field_description:joint_buying_product_food.field_joint_buying_purchase_order_line__residual_use_by_date | ||
msgid "Residual Use By Date" | ||
msgstr "DLC résiduelle" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import product_product | ||
from . import joint_buying_tour | ||
from . import joint_buying_purchase_order_line |
35 changes: 35 additions & 0 deletions
35
joint_buying_product_food/models/joint_buying_purchase_order_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright (C) 2023-Today: GRAP (http://www.grap.coop) | ||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
import math | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class JointBuyingPurchaseOrderLine(models.Model): | ||
_inherit = "joint.buying.purchase.order.line" | ||
|
||
residual_use_by_date = fields.Integer(compute="_compute_residual_use_by_date") | ||
|
||
@api.depends( | ||
"product_id.use_by_date_day", | ||
"order_id.request_arrival_date", | ||
"order_id.deposit_date", | ||
) | ||
def _compute_residual_use_by_date(self): | ||
for line in self.filtered( | ||
lambda x: not x.product_id.use_by_date_day | ||
or not x.order_id.request_arrival_date | ||
): | ||
line.residual_use_by_date = -999 | ||
for line in self.filtered( | ||
lambda x: x.product_id.use_by_date_day and x.order_id.request_arrival_date | ||
): | ||
line.residual_use_by_date = line.product_id.use_by_date_day - math.ceil( | ||
( | ||
line.order_id.request_arrival_date - line.order_id.deposit_date | ||
).total_seconds() | ||
/ 3600 | ||
/ 24 | ||
) |
25 changes: 25 additions & 0 deletions
25
joint_buying_product_food/views/view_joint_buying_purchase_order.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (C) 2021 - Today: GRAP (http://www.grap.coop) | ||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
<odoo> | ||
|
||
<record id="view_joint_buying_purchase_order_form" model="ir.ui.view"> | ||
<field name="model">joint.buying.purchase.order</field> | ||
<field name="inherit_id" ref="joint_buying_product.view_joint_buying_purchase_order_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='line_ids']/tree/field[@name='uom_different_description']" position="after"> | ||
<field name="residual_use_by_date" attrs="{'invisible': [('residual_use_by_date', '=', -999)]}" | ||
options="{'bg_color': ' | ||
white: residual_use_by_date == -999; | ||
red: residual_use_by_date < 1; | ||
orange: residual_use_by_date < 7; | ||
yellow: residual_use_by_date < 14; | ||
'}"/> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |