migrate v6.0

This commit is contained in:
wilson gomez 2021-08-07 11:32:16 -05:00
parent 6a62ba1971
commit db3034f122
11 changed files with 41 additions and 54 deletions

View File

@ -2,14 +2,14 @@
# this repository contains the full copyright notices and license terms.
from trytond.pool import Pool
import service
import booking
import configuration
import product
import sale
import invoice
import stock
import equipment
from . import service
from . import booking
from . import configuration
from . import product
from . import sale
from . import invoice
from . import stock
from . import equipment
def register():

View File

@ -9,8 +9,6 @@ from trytond.pyson import Eval, If, In, Get
from trytond.transaction import Transaction
from trytond.pool import Pool
__all__ = ['Booking']
STATES = {
'readonly': (Eval('state') != 'draft')
}
@ -274,7 +272,6 @@ class Booking(Workflow, ModelSQL, ModelView):
'id_number': self.doc_number,
'addresses': [('create', [{
'street': self.address,
'zip': self.post_code,
}])],
'contact_mechanisms': [
('create', [
@ -339,7 +336,6 @@ class Booking(Workflow, ModelSQL, ModelView):
Fill the number field with the service sequence
'''
pool = Pool()
Sequence = pool.get('ir.sequence')
Config = pool.get('rental.configuration')
config = Config(1)
@ -348,5 +344,5 @@ class Booking(Workflow, ModelSQL, ModelView):
continue
if not config.rental_booking_sequence:
continue
number = Sequence.get_id(config.rental_booking_sequence.id)
number = config.rental_booking_sequence.get()
cls.write([record], {'number': number})

View File

@ -1,9 +1,7 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.model import ModelView, ModelSQL, ModelSingleton, fields
from trytond.pyson import Eval
__all__ = ['Configuration', 'RentalConfigCheckList']
from trytond.pyson import Eval, Id
class Configuration(ModelSingleton, ModelSQL, ModelView):
@ -17,12 +15,14 @@ class Configuration(ModelSingleton, ModelSQL, ModelView):
rental_service_sequence = fields.Many2One('ir.sequence',
'Rental Service Sequence', domain=[
('company', 'in', [Eval('context', {}).get('company', 0), None]),
('code', '=', 'rental.service'),
('sequence_type', '=',
Id('rental', 'sequence_type_rental_service')),
], required=True)
rental_booking_sequence = fields.Many2One('ir.sequence',
'Rental Booking Sequence', domain=[
('company', 'in', [Eval('context', {}).get('company', 0), None]),
('code', '=', 'rental.service'),
('sequence_type', '=',
Id('rental', 'sequence_type_rental_service')),
], required=True)
value_early_return = fields.Numeric('Value to Early Return', digits=(16, 2),
required=True)

View File

@ -3,8 +3,6 @@
from trytond.model import fields, Unique
from trytond.pool import Pool, PoolMeta
__all__ = ['RentalEquipment']
class RentalEquipment(metaclass=PoolMeta):
__name__ = 'maintenance.equipment'

19
message.xml Normal file
View 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>

View File

@ -3,9 +3,6 @@
from trytond.model import ModelView, ModelSQL, fields
from trytond.pool import PoolMeta
__all__ = ['ProductCheckList', 'CheckListItem', 'ProductCategory',
'ProductTemplate']
class ProductCategory(metaclass=PoolMeta):
__name__ = 'product.category'

View File

@ -4,8 +4,6 @@ from trytond.model import fields
from trytond.pool import PoolMeta
from trytond.report import Report
__all__ = ['SaleLine', 'RentalSaleRelationReport']
class SaleLine(metaclass=PoolMeta):
__name__ = 'sale.line'

View File

@ -8,12 +8,9 @@ from trytond.pyson import Eval, If, In, Get, Bool
from trytond.transaction import Transaction
from trytond.pool import Pool
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 = {
'readonly': Eval('state') != 'draft',
@ -206,12 +203,6 @@ class Service(Workflow, ModelSQL, ModelView):
'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):
return self.party.rec_name
@ -434,7 +425,7 @@ class Service(Workflow, ModelSQL, ModelView):
continue
if not config.rental_service_sequence:
continue
number = Sequence.get_id(config.rental_service_sequence.id)
number = config.rental_service_sequence.get()
cls.write([rec], {'number': number})
@fields.depends('unit_price', 'service_product', 'hiring_time')
@ -537,8 +528,8 @@ class RentalServiceReport(Report):
__name__ = 'rental.service.report'
@classmethod
def get_context(cls, records, data):
report_context = super(RentalServiceReport, cls).get_context(records, data)
def get_context(cls, records, header, data):
report_context = super().get_context(records, header, data)
user = Pool().get('res.user')(Transaction().user)
report_context['company'] = user.company
report_context['user'] = user
@ -551,8 +542,8 @@ class RentalEquipmentReturnReport(Report):
__name__ = 'rental.equipment_return.report'
@classmethod
def get_context(cls, records, data):
report_context = super(RentalEquipmentReturnReport, cls).get_context(records, data)
def get_context(cls, records, header, data):
report_context = super().get_context(records, header, data)
user = Pool().get('res.user')(Transaction().user)
report_context['company'] = user.company
report_context['user'] = user

View File

@ -68,7 +68,6 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.sequence.type" id="sequence_type_rental_service">
<field name="name">Rental Service</field>
<field name="code">rental.service</field>
</record>
<!-- <record model="ir.action.act_window.domain"

View File

@ -8,12 +8,6 @@ from trytond.transaction import Transaction
from trytond.pyson import Eval
from sql import Table
__all__ = [
'CreateSalesFromMovesStart', 'CreateSalesFromMoves', 'ShipmentOutReturn',
'ShipmentOut', 'Move', 'ShipmentAdditional', 'ShipmentOutReturnForceDraft',
'ShipmentOutForceDraft'
]
class ShipmentAdditional(ModelSQL, ModelView):
"Shipment Additional"
@ -123,9 +117,6 @@ class ShipmentOutReturn(metaclass=PoolMeta):
@classmethod
def __setup__(cls):
super(ShipmentOutReturn, cls).__setup__()
cls._error_messages.update({
'product_not_stock': ('Product "%s" without stock.'),
})
@fields.depends('customer', 'location_customer')
def on_change_with_customer_location(self, name=None):

View File

@ -1,12 +1,10 @@
[tryton]
version=5.0.5
version=6.0.0
depends:
party
company
account
sale
email
sms
account_voucher
maintenance
xml: