mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[14.0][FIX] Travis.
This commit is contained in:
committed by
Sébastien Alix
parent
c987e9fc36
commit
2ff788b796
@@ -2,24 +2,24 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Warranty Date on Lot/Serial Numbers',
|
||||
'summary': 'Add warranty date to stock production lot',
|
||||
'version': '12.0.1.0.0',
|
||||
'license': 'AGPL-3',
|
||||
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
|
||||
'category': 'Stock',
|
||||
'website': 'https://github.com/OCA/rma',
|
||||
'depends': [
|
||||
'product_warranty',
|
||||
'stock',
|
||||
"name": "Warranty Date on Lot/Serial Numbers",
|
||||
"summary": "Add warranty date to stock production lot",
|
||||
"version": "14.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
||||
"category": "Stock",
|
||||
"website": "https://github.com/OCA/rma",
|
||||
"depends": [
|
||||
"product_warranty",
|
||||
"stock",
|
||||
],
|
||||
'data': [
|
||||
'views/stock_production_lot.xml',
|
||||
"data": [
|
||||
"views/stock_production_lot.xml",
|
||||
],
|
||||
"installable": True,
|
||||
"development_status": "Beta",
|
||||
"maintainers": [
|
||||
"osi-scampbell",
|
||||
"max3903",
|
||||
],
|
||||
'installable': True,
|
||||
'development_status': 'Beta',
|
||||
'maintainers': [
|
||||
'osi-scampbell',
|
||||
'max3903',
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import (
|
||||
stock_production_lot
|
||||
)
|
||||
from . import stock_production_lot
|
||||
|
||||
@@ -2,41 +2,45 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||
|
||||
|
||||
class StockProductionLot(models.Model):
|
||||
_inherit = 'stock.production.lot'
|
||||
_inherit = "stock.production.lot"
|
||||
|
||||
warranty_exp_date = fields.Date(string='Warranty Expiration Date')
|
||||
warranty_exp_date = fields.Date(string="Warranty Expiration Date")
|
||||
|
||||
@api.onchange('product_id')
|
||||
@api.onchange("product_id")
|
||||
def _onchange_product_id(self):
|
||||
self.warranty_exp_date = False
|
||||
if self.product_id and \
|
||||
self.product_id.product_tmpl_id.warranty_type and \
|
||||
self.product_id.product_tmpl_id.warranty:
|
||||
if (
|
||||
self.product_id
|
||||
and self.product_id.product_tmpl_id.warranty_type
|
||||
and self.product_id.product_tmpl_id.warranty
|
||||
):
|
||||
warranty_type = self.product_id.product_tmpl_id.warranty_type
|
||||
if warranty_type == 'day':
|
||||
time = (datetime.now() +
|
||||
timedelta(days=self.product_id.
|
||||
product_tmpl_id.warranty)).strftime(
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
elif warranty_type == 'week':
|
||||
time = (datetime.now() +
|
||||
timedelta(weeks=self.product_id.
|
||||
product_tmpl_id.warranty)).strftime(
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
elif warranty_type == 'month':
|
||||
time = (datetime.now() +
|
||||
relativedelta(months=+self.product_id.
|
||||
product_tmpl_id.warranty)).strftime(
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
elif warranty_type == 'year':
|
||||
time = (datetime.now() +
|
||||
relativedelta(years=+self.product_id.
|
||||
product_tmpl_id.warranty)).strftime(
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
if warranty_type == "day":
|
||||
time = (
|
||||
datetime.now()
|
||||
+ timedelta(days=self.product_id.product_tmpl_id.warranty)
|
||||
).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
elif warranty_type == "week":
|
||||
time = (
|
||||
datetime.now()
|
||||
+ timedelta(weeks=self.product_id.product_tmpl_id.warranty)
|
||||
).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
elif warranty_type == "month":
|
||||
time = (
|
||||
datetime.now()
|
||||
+ relativedelta(months=+self.product_id.product_tmpl_id.warranty)
|
||||
).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
elif warranty_type == "year":
|
||||
time = (
|
||||
datetime.now()
|
||||
+ relativedelta(years=+self.product_id.product_tmpl_id.warranty)
|
||||
).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
self.warranty_exp_date = time
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="stock_production_lot_extend_warranty" model="ir.ui.view">
|
||||
<field name="model">stock.production.lot</field>
|
||||
<field name="inherit_id" ref="stock.view_production_lot_form"/>
|
||||
<field name="inherit_id" ref="stock.view_production_lot_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group[@name='main_group']/group[1]"
|
||||
position="after">
|
||||
<xpath expr="//group[@name='main_group']/group[1]" position="after">
|
||||
<group>
|
||||
<field name="warranty_exp_date"/>
|
||||
<field name="warranty_exp_date" />
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user