Minor fixes
This commit is contained in:
parent
21181c53e3
commit
e162372ce4
3
asset.py
3
asset.py
|
@ -1,5 +1,4 @@
|
|||
from trytond.pool import Pool
|
||||
from trytond.pool import PoolMeta
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
|
||||
|
||||
class Asset(metaclass=PoolMeta):
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# 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 dateutil import tz
|
||||
from trytond.model import fields, ModelSQL, ModelView
|
||||
from trytond.model import fields
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class Company(ModelSQL, ModelView):
|
||||
class Company(metaclass=PoolMeta):
|
||||
__name__ = 'company.company'
|
||||
manager = fields.Many2One('party.party', 'Manager')
|
||||
accountant = fields.Many2One('party.party', 'Accountant')
|
||||
|
@ -17,7 +18,6 @@ class Company(ModelSQL, ModelView):
|
|||
company_id = Transaction().context.get('company')
|
||||
|
||||
company = cls(company_id)
|
||||
|
||||
if company.timezone:
|
||||
if to_utc:
|
||||
from_zone = tz.gettz(company.timezone)
|
||||
|
|
19
invoice.py
19
invoice.py
|
@ -40,7 +40,7 @@ TYPE_INVOICE = [
|
|||
]
|
||||
|
||||
|
||||
class Invoice(ModelSQL, ModelView):
|
||||
class Invoice(metaclass=PoolMeta):
|
||||
__name__ = 'account.invoice'
|
||||
estimate_pay_date = fields.Function(fields.Date('Estimate Pay Date'),
|
||||
'get_estimate_pay_date'
|
||||
|
@ -244,16 +244,15 @@ class Invoice(ModelSQL, ModelView):
|
|||
elif (int(self.authorization.to_auth) - int(next_number)) <= 10:
|
||||
msg_warn = 'Los rangos de numeración de la autorización estan proximos a vencer'
|
||||
|
||||
warning_key = 'notification_auth_%d' % auth.id
|
||||
if msg_error:
|
||||
raise NotificationAuthError(gettext(
|
||||
'account_col.msg_notification_auth', msg=msg_error)
|
||||
)
|
||||
elif msg_warn:
|
||||
warning_key = 'notification_auth_%d' % auth.id
|
||||
if Warning.check(warning_key):
|
||||
raise NotificationAuthWarning(warning_key,
|
||||
gettext('account_col.msg_notification_auth', msg=msg_warn)
|
||||
)
|
||||
elif msg_warn and Warning.check(warning_key):
|
||||
raise NotificationAuthWarning(warning_key,
|
||||
gettext('account_col.msg_notification_auth', msg=msg_warn)
|
||||
)
|
||||
|
||||
def get_move(self):
|
||||
move = super(Invoice, self).get_move()
|
||||
|
@ -266,8 +265,10 @@ class Invoice(ModelSQL, ModelView):
|
|||
move.description = self.description
|
||||
for line in move.lines:
|
||||
code = line.account.code
|
||||
if code.startswith('5') or code.startswith('6') or code.startswith('7'):
|
||||
line.description = self.description
|
||||
|
||||
if code and code[0] in ('5', '6', '7'):
|
||||
description = self.description
|
||||
line.description = description.replace('\n', ' ')
|
||||
return move
|
||||
|
||||
@dualmethod
|
||||
|
|
|
@ -80,6 +80,6 @@ class InvoiceAuthorization(ModelSQL, ModelView):
|
|||
else:
|
||||
bool_op = 'OR'
|
||||
return [bool_op,
|
||||
('number',) + tuple(clause[1:]),
|
||||
('kind_string',) + tuple(clause[1:]),
|
||||
]
|
||||
('number',) + tuple(clause[1:]),
|
||||
('kind_string',) + tuple(clause[1:]),
|
||||
]
|
||||
|
|
3
move.py
3
move.py
|
@ -35,9 +35,6 @@ class Move(ModelSQL, ModelView):
|
|||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Move, cls).__setup__()
|
||||
# cls._error_messages.update({
|
||||
# 'message_error': 'Error: %s',
|
||||
# })
|
||||
|
||||
@fields.depends('lines')
|
||||
def on_change_with_balance(self, name=None):
|
||||
|
|
19
purchase.py
19
purchase.py
|
@ -39,7 +39,6 @@ class Purchase(metaclass=PoolMeta):
|
|||
def generate_shipment(cls, purchases):
|
||||
_purchases = cls.process_purchases(purchases)
|
||||
cls.do_shipment(_purchases)
|
||||
#cls.update_state(_purchases) ???
|
||||
|
||||
@classmethod
|
||||
def process_purchases(cls, purchases):
|
||||
|
@ -201,10 +200,6 @@ class PurchaseForceDraft(Wizard):
|
|||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(PurchaseForceDraft, cls).__setup__()
|
||||
# cls._error_messages.update({
|
||||
# 'draft_purchase_invoice': ('You can not send to draft the purchase because I have already generated the invoice number "%s".'),
|
||||
# 'draft_purchase_shipment': ('You can not send to draft the purchase "%s" because I have already generated the shipping number "%s".'),
|
||||
# })
|
||||
|
||||
def transition_force_draft(self):
|
||||
Purchase = Pool().get('purchase.purchase')
|
||||
|
@ -234,15 +229,6 @@ class PurchaseGenerateInvoice(Wizard):
|
|||
start_state = 'generate_invoice'
|
||||
generate_invoice = StateTransition()
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(PurchaseGenerateInvoice, cls).__setup__()
|
||||
# cls._error_messages.update({
|
||||
# 'dont_generate_invoice': (
|
||||
# 'You can not generate invoice, because It has already been generated'
|
||||
# ),
|
||||
# })
|
||||
|
||||
def transition_generate_invoice(self):
|
||||
Purchase = Pool().get('purchase.purchase')
|
||||
ids = Transaction().context['active_ids']
|
||||
|
@ -265,11 +251,6 @@ class PurchaseGenerateShipment(Wizard):
|
|||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(PurchaseGenerateShipment, cls).__setup__()
|
||||
# cls._error_messages.update({
|
||||
# 'dont_shipment_generated': (
|
||||
# 'You can not to generate shipment!'
|
||||
# ),
|
||||
# })
|
||||
|
||||
def transition_generate_shipment(self):
|
||||
Purchase = Pool().get('purchase.purchase')
|
||||
|
|
8
sale.py
8
sale.py
|
@ -24,7 +24,9 @@ class Sale(metaclass=PoolMeta):
|
|||
__name__ = 'sale.sale'
|
||||
invoice_type = fields.Selection(TYPE_INVOICE, 'Type Invoice',
|
||||
states={
|
||||
'readonly': Eval('state').in_(['confirmed', 'processing', 'done', 'cancel'])
|
||||
'readonly': Eval('state').in_(
|
||||
['confirmed', 'processing', 'done', 'cancel']
|
||||
)
|
||||
})
|
||||
vouchers = fields.Many2Many('sale.sale-account.voucher', 'sale',
|
||||
'voucher', 'Vouchers', domain=[], states={
|
||||
|
@ -164,8 +166,8 @@ class SaleVoucher(ModelSQL):
|
|||
sale = fields.Many2One('sale.sale', 'Sale', ondelete='CASCADE',
|
||||
select=True, required=True)
|
||||
voucher = fields.Many2One('account.voucher', 'Voucher', select=True,
|
||||
domain=[('voucher_type', '=', 'receipt')], ondelete='RESTRICT',
|
||||
required=True)
|
||||
domain=[('voucher_type', '=', 'receipt')], ondelete='RESTRICT',
|
||||
required=True)
|
||||
|
||||
@classmethod
|
||||
def set_voucher_origin(cls, voucher_id, target_id):
|
||||
|
|
2
tax.py
2
tax.py
|
@ -2,13 +2,13 @@
|
|||
# this repository contains the full copyright notices and license terms.
|
||||
from decimal import Decimal
|
||||
from collections import OrderedDict
|
||||
|
||||
from trytond.model import fields, ModelView
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.pyson import Eval
|
||||
from trytond.wizard import Wizard, StateView, Button, StateReport
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.report import Report
|
||||
import copy
|
||||
|
||||
|
||||
_ZERO = Decimal('0.0')
|
||||
|
|
|
@ -27,3 +27,4 @@ xml:
|
|||
invoice_authorization.xml
|
||||
sale.xml
|
||||
payment_term.xml
|
||||
message.xml
|
||||
|
|
Loading…
Reference in New Issue