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).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Warranty Date on Lot/Serial Numbers',
|
"name": "Warranty Date on Lot/Serial Numbers",
|
||||||
'summary': 'Add warranty date to stock production lot',
|
"summary": "Add warranty date to stock production lot",
|
||||||
'version': '12.0.1.0.0',
|
"version": "14.0.1.0.0",
|
||||||
'license': 'AGPL-3',
|
"license": "AGPL-3",
|
||||||
'author': 'Open Source Integrators, Odoo Community Association (OCA)',
|
"author": "Open Source Integrators, Odoo Community Association (OCA)",
|
||||||
'category': 'Stock',
|
"category": "Stock",
|
||||||
'website': 'https://github.com/OCA/rma',
|
"website": "https://github.com/OCA/rma",
|
||||||
'depends': [
|
"depends": [
|
||||||
'product_warranty',
|
"product_warranty",
|
||||||
'stock',
|
"stock",
|
||||||
],
|
],
|
||||||
'data': [
|
"data": [
|
||||||
'views/stock_production_lot.xml',
|
"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).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from . import (
|
from . import stock_production_lot
|
||||||
stock_production_lot
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -2,41 +2,45 @@
|
|||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
|
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||||
|
|
||||||
|
|
||||||
class StockProductionLot(models.Model):
|
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):
|
def _onchange_product_id(self):
|
||||||
self.warranty_exp_date = False
|
self.warranty_exp_date = False
|
||||||
if self.product_id and \
|
if (
|
||||||
self.product_id.product_tmpl_id.warranty_type and \
|
self.product_id
|
||||||
self.product_id.product_tmpl_id.warranty:
|
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
|
warranty_type = self.product_id.product_tmpl_id.warranty_type
|
||||||
if warranty_type == 'day':
|
if warranty_type == "day":
|
||||||
time = (datetime.now() +
|
time = (
|
||||||
timedelta(days=self.product_id.
|
datetime.now()
|
||||||
product_tmpl_id.warranty)).strftime(
|
+ timedelta(days=self.product_id.product_tmpl_id.warranty)
|
||||||
DEFAULT_SERVER_DATE_FORMAT)
|
).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||||
elif warranty_type == 'week':
|
elif warranty_type == "week":
|
||||||
time = (datetime.now() +
|
time = (
|
||||||
timedelta(weeks=self.product_id.
|
datetime.now()
|
||||||
product_tmpl_id.warranty)).strftime(
|
+ timedelta(weeks=self.product_id.product_tmpl_id.warranty)
|
||||||
DEFAULT_SERVER_DATE_FORMAT)
|
).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||||
elif warranty_type == 'month':
|
elif warranty_type == "month":
|
||||||
time = (datetime.now() +
|
time = (
|
||||||
relativedelta(months=+self.product_id.
|
datetime.now()
|
||||||
product_tmpl_id.warranty)).strftime(
|
+ relativedelta(months=+self.product_id.product_tmpl_id.warranty)
|
||||||
DEFAULT_SERVER_DATE_FORMAT)
|
).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||||
elif warranty_type == 'year':
|
elif warranty_type == "year":
|
||||||
time = (datetime.now() +
|
time = (
|
||||||
relativedelta(years=+self.product_id.
|
datetime.now()
|
||||||
product_tmpl_id.warranty)).strftime(
|
+ relativedelta(years=+self.product_id.product_tmpl_id.warranty)
|
||||||
DEFAULT_SERVER_DATE_FORMAT)
|
).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||||
self.warranty_exp_date = time
|
self.warranty_exp_date = time
|
||||||
|
|||||||
@@ -5,8 +5,7 @@
|
|||||||
<field name="model">stock.production.lot</field>
|
<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">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//group[@name='main_group']/group[1]"
|
<xpath expr="//group[@name='main_group']/group[1]" position="after">
|
||||||
position="after">
|
|
||||||
<group>
|
<group>
|
||||||
<field name="warranty_exp_date" />
|
<field name="warranty_exp_date" />
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
Reference in New Issue
Block a user