mirror of
https://bitbucket.org/presik/trytonpsk-rental.git
synced 2023-12-14 06:53:01 +01:00
migrate v6.0
This commit is contained in:
parent
6a62ba1971
commit
db3034f122
16
__init__.py
16
__init__.py
|
@ -2,14 +2,14 @@
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
|
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
import service
|
from . import service
|
||||||
import booking
|
from . import booking
|
||||||
import configuration
|
from . import configuration
|
||||||
import product
|
from . import product
|
||||||
import sale
|
from . import sale
|
||||||
import invoice
|
from . import invoice
|
||||||
import stock
|
from . import stock
|
||||||
import equipment
|
from . import equipment
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
|
|
|
@ -9,8 +9,6 @@ from trytond.pyson import Eval, If, In, Get
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
|
|
||||||
__all__ = ['Booking']
|
|
||||||
|
|
||||||
STATES = {
|
STATES = {
|
||||||
'readonly': (Eval('state') != 'draft')
|
'readonly': (Eval('state') != 'draft')
|
||||||
}
|
}
|
||||||
|
@ -274,7 +272,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
'id_number': self.doc_number,
|
'id_number': self.doc_number,
|
||||||
'addresses': [('create', [{
|
'addresses': [('create', [{
|
||||||
'street': self.address,
|
'street': self.address,
|
||||||
'zip': self.post_code,
|
|
||||||
}])],
|
}])],
|
||||||
'contact_mechanisms': [
|
'contact_mechanisms': [
|
||||||
('create', [
|
('create', [
|
||||||
|
@ -339,7 +336,6 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
Fill the number field with the service sequence
|
Fill the number field with the service sequence
|
||||||
'''
|
'''
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Sequence = pool.get('ir.sequence')
|
|
||||||
Config = pool.get('rental.configuration')
|
Config = pool.get('rental.configuration')
|
||||||
config = Config(1)
|
config = Config(1)
|
||||||
|
|
||||||
|
@ -348,5 +344,5 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
continue
|
continue
|
||||||
if not config.rental_booking_sequence:
|
if not config.rental_booking_sequence:
|
||||||
continue
|
continue
|
||||||
number = Sequence.get_id(config.rental_booking_sequence.id)
|
number = config.rental_booking_sequence.get()
|
||||||
cls.write([record], {'number': number})
|
cls.write([record], {'number': number})
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
# this repository contains the full copyright notices and license terms.
|
# this repository contains the full copyright notices and license terms.
|
||||||
from trytond.model import ModelView, ModelSQL, ModelSingleton, fields
|
from trytond.model import ModelView, ModelSQL, ModelSingleton, fields
|
||||||
from trytond.pyson import Eval
|
from trytond.pyson import Eval, Id
|
||||||
|
|
||||||
__all__ = ['Configuration', 'RentalConfigCheckList']
|
|
||||||
|
|
||||||
|
|
||||||
class Configuration(ModelSingleton, ModelSQL, ModelView):
|
class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||||
|
@ -17,12 +15,14 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
|
||||||
rental_service_sequence = fields.Many2One('ir.sequence',
|
rental_service_sequence = fields.Many2One('ir.sequence',
|
||||||
'Rental Service Sequence', domain=[
|
'Rental Service Sequence', domain=[
|
||||||
('company', 'in', [Eval('context', {}).get('company', 0), None]),
|
('company', 'in', [Eval('context', {}).get('company', 0), None]),
|
||||||
('code', '=', 'rental.service'),
|
('sequence_type', '=',
|
||||||
|
Id('rental', 'sequence_type_rental_service')),
|
||||||
], required=True)
|
], required=True)
|
||||||
rental_booking_sequence = fields.Many2One('ir.sequence',
|
rental_booking_sequence = fields.Many2One('ir.sequence',
|
||||||
'Rental Booking Sequence', domain=[
|
'Rental Booking Sequence', domain=[
|
||||||
('company', 'in', [Eval('context', {}).get('company', 0), None]),
|
('company', 'in', [Eval('context', {}).get('company', 0), None]),
|
||||||
('code', '=', 'rental.service'),
|
('sequence_type', '=',
|
||||||
|
Id('rental', 'sequence_type_rental_service')),
|
||||||
], required=True)
|
], required=True)
|
||||||
value_early_return = fields.Numeric('Value to Early Return', digits=(16, 2),
|
value_early_return = fields.Numeric('Value to Early Return', digits=(16, 2),
|
||||||
required=True)
|
required=True)
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
from trytond.model import fields, Unique
|
from trytond.model import fields, Unique
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
|
|
||||||
__all__ = ['RentalEquipment']
|
|
||||||
|
|
||||||
|
|
||||||
class RentalEquipment(metaclass=PoolMeta):
|
class RentalEquipment(metaclass=PoolMeta):
|
||||||
__name__ = 'maintenance.equipment'
|
__name__ = 'maintenance.equipment'
|
||||||
|
|
19
message.xml
Normal file
19
message.xml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||||
|
this repository contains the full copyright notices and license terms. -->
|
||||||
|
<tryton>
|
||||||
|
<data grouped="1">
|
||||||
|
<record model="ir.message" id="msg_invalid_dates">
|
||||||
|
<field name="text">Error in Date Start Service!</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.message" id="msg_invalid_state">
|
||||||
|
<field name="text">State of Service invalid, for generate sale this service should be in draft state!</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.message" id="msg_product_not_avalilable">
|
||||||
|
<field name="text">Product not available but another service</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.message" id="msg_product_not_stock">
|
||||||
|
<field name="text">Product "%s" without stock.</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</tryton>
|
|
@ -3,9 +3,6 @@
|
||||||
from trytond.model import ModelView, ModelSQL, fields
|
from trytond.model import ModelView, ModelSQL, fields
|
||||||
from trytond.pool import PoolMeta
|
from trytond.pool import PoolMeta
|
||||||
|
|
||||||
__all__ = ['ProductCheckList', 'CheckListItem', 'ProductCategory',
|
|
||||||
'ProductTemplate']
|
|
||||||
|
|
||||||
|
|
||||||
class ProductCategory(metaclass=PoolMeta):
|
class ProductCategory(metaclass=PoolMeta):
|
||||||
__name__ = 'product.category'
|
__name__ = 'product.category'
|
||||||
|
|
2
sale.py
2
sale.py
|
@ -4,8 +4,6 @@ from trytond.model import fields
|
||||||
from trytond.pool import PoolMeta
|
from trytond.pool import PoolMeta
|
||||||
from trytond.report import Report
|
from trytond.report import Report
|
||||||
|
|
||||||
__all__ = ['SaleLine', 'RentalSaleRelationReport']
|
|
||||||
|
|
||||||
|
|
||||||
class SaleLine(metaclass=PoolMeta):
|
class SaleLine(metaclass=PoolMeta):
|
||||||
__name__ = 'sale.line'
|
__name__ = 'sale.line'
|
||||||
|
|
23
service.py
23
service.py
|
@ -8,12 +8,9 @@ from trytond.pyson import Eval, If, In, Get, Bool
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from trytond.wizard import Wizard, StateTransition
|
from trytond.wizard import Wizard, StateTransition
|
||||||
|
from trytond.i18n import gettext
|
||||||
|
from trytond.exceptions import UserError
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'Service', 'ServiceForceDraft', 'RentalVoucher', 'RentalSale',
|
|
||||||
'CacheExpirationDays', 'DepositLine',
|
|
||||||
'RentalServiceReport', 'RentalEquipmentReturnReport'
|
|
||||||
]
|
|
||||||
|
|
||||||
STATES = {
|
STATES = {
|
||||||
'readonly': Eval('state') != 'draft',
|
'readonly': Eval('state') != 'draft',
|
||||||
|
@ -206,12 +203,6 @@ class Service(Workflow, ModelSQL, ModelView):
|
||||||
'invisible': Bool(Eval('sended_deposit_notificacion')),
|
'invisible': Bool(Eval('sended_deposit_notificacion')),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
cls._error_messages.update({
|
|
||||||
'invalid_dates': ('Error in Date Start Service!'),
|
|
||||||
'invalid_state': ('State of Service invalid, for generate sale \
|
|
||||||
this service should be in draft state!'),
|
|
||||||
'product_not_avalilable': ('Product not available but another service')
|
|
||||||
})
|
|
||||||
|
|
||||||
def get_rec_name(self, name):
|
def get_rec_name(self, name):
|
||||||
return self.party.rec_name
|
return self.party.rec_name
|
||||||
|
@ -434,7 +425,7 @@ class Service(Workflow, ModelSQL, ModelView):
|
||||||
continue
|
continue
|
||||||
if not config.rental_service_sequence:
|
if not config.rental_service_sequence:
|
||||||
continue
|
continue
|
||||||
number = Sequence.get_id(config.rental_service_sequence.id)
|
number = config.rental_service_sequence.get()
|
||||||
cls.write([rec], {'number': number})
|
cls.write([rec], {'number': number})
|
||||||
|
|
||||||
@fields.depends('unit_price', 'service_product', 'hiring_time')
|
@fields.depends('unit_price', 'service_product', 'hiring_time')
|
||||||
|
@ -537,8 +528,8 @@ class RentalServiceReport(Report):
|
||||||
__name__ = 'rental.service.report'
|
__name__ = 'rental.service.report'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_context(cls, records, data):
|
def get_context(cls, records, header, data):
|
||||||
report_context = super(RentalServiceReport, cls).get_context(records, data)
|
report_context = super().get_context(records, header, data)
|
||||||
user = Pool().get('res.user')(Transaction().user)
|
user = Pool().get('res.user')(Transaction().user)
|
||||||
report_context['company'] = user.company
|
report_context['company'] = user.company
|
||||||
report_context['user'] = user
|
report_context['user'] = user
|
||||||
|
@ -551,8 +542,8 @@ class RentalEquipmentReturnReport(Report):
|
||||||
__name__ = 'rental.equipment_return.report'
|
__name__ = 'rental.equipment_return.report'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_context(cls, records, data):
|
def get_context(cls, records, header, data):
|
||||||
report_context = super(RentalEquipmentReturnReport, cls).get_context(records, data)
|
report_context = super().get_context(records, header, data)
|
||||||
user = Pool().get('res.user')(Transaction().user)
|
user = Pool().get('res.user')(Transaction().user)
|
||||||
report_context['company'] = user.company
|
report_context['company'] = user.company
|
||||||
report_context['user'] = user
|
report_context['user'] = user
|
||||||
|
|
|
@ -68,7 +68,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
|
|
||||||
<record model="ir.sequence.type" id="sequence_type_rental_service">
|
<record model="ir.sequence.type" id="sequence_type_rental_service">
|
||||||
<field name="name">Rental Service</field>
|
<field name="name">Rental Service</field>
|
||||||
<field name="code">rental.service</field>
|
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<!-- <record model="ir.action.act_window.domain"
|
<!-- <record model="ir.action.act_window.domain"
|
||||||
|
|
9
stock.py
9
stock.py
|
@ -8,12 +8,6 @@ from trytond.transaction import Transaction
|
||||||
from trytond.pyson import Eval
|
from trytond.pyson import Eval
|
||||||
from sql import Table
|
from sql import Table
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
'CreateSalesFromMovesStart', 'CreateSalesFromMoves', 'ShipmentOutReturn',
|
|
||||||
'ShipmentOut', 'Move', 'ShipmentAdditional', 'ShipmentOutReturnForceDraft',
|
|
||||||
'ShipmentOutForceDraft'
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class ShipmentAdditional(ModelSQL, ModelView):
|
class ShipmentAdditional(ModelSQL, ModelView):
|
||||||
"Shipment Additional"
|
"Shipment Additional"
|
||||||
|
@ -123,9 +117,6 @@ class ShipmentOutReturn(metaclass=PoolMeta):
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(ShipmentOutReturn, cls).__setup__()
|
super(ShipmentOutReturn, cls).__setup__()
|
||||||
cls._error_messages.update({
|
|
||||||
'product_not_stock': ('Product "%s" without stock.'),
|
|
||||||
})
|
|
||||||
|
|
||||||
@fields.depends('customer', 'location_customer')
|
@fields.depends('customer', 'location_customer')
|
||||||
def on_change_with_customer_location(self, name=None):
|
def on_change_with_customer_location(self, name=None):
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
[tryton]
|
[tryton]
|
||||||
version=5.0.5
|
version=6.0.0
|
||||||
depends:
|
depends:
|
||||||
party
|
party
|
||||||
company
|
company
|
||||||
account
|
account
|
||||||
sale
|
sale
|
||||||
email
|
|
||||||
sms
|
|
||||||
account_voucher
|
account_voucher
|
||||||
maintenance
|
maintenance
|
||||||
xml:
|
xml:
|
||||||
|
|
Loading…
Reference in a new issue