Fix
This commit is contained in:
parent
e877de1d75
commit
cca15eedc8
46
booking.py
46
booking.py
|
@ -2273,13 +2273,15 @@ class StatementPaymentForm(ModelView):
|
||||||
'Statement Payment Form'
|
'Statement Payment Form'
|
||||||
__name__ = 'hotel.payment_form.start'
|
__name__ = 'hotel.payment_form.start'
|
||||||
statement = fields.Many2One('account.statement', 'Statement',
|
statement = fields.Many2One('account.statement', 'Statement',
|
||||||
required=True, domain=['OR', [
|
required=True, domain=[
|
||||||
('create_uid.login', '=', Eval('user')),
|
('id', 'in', Eval('statements')),
|
||||||
('state', '=', 'draft')
|
])
|
||||||
], [
|
# required=True, domain=['OR', [
|
||||||
Eval('user') == 'admin',
|
# ('state', '=', 'draft')
|
||||||
('state', '=', 'draft'),
|
# ], [
|
||||||
]])
|
# Eval('user') == 'admin',
|
||||||
|
# ('state', '=', 'draft'),
|
||||||
|
# ]])
|
||||||
amount_to_pay = fields.Numeric('Amount to Pay', required=True,
|
amount_to_pay = fields.Numeric('Amount to Pay', required=True,
|
||||||
digits=(16, Eval('currency_digits', 2)),
|
digits=(16, Eval('currency_digits', 2)),
|
||||||
depends=['currency_digits'])
|
depends=['currency_digits'])
|
||||||
|
@ -2301,22 +2303,17 @@ class StatementPaymentForm(ModelView):
|
||||||
party = fields.Many2One('party.party', 'Party', domain=[
|
party = fields.Many2One('party.party', 'Party', domain=[
|
||||||
('id', 'in', Eval('parties'))
|
('id', 'in', Eval('parties'))
|
||||||
], required=True)
|
], required=True)
|
||||||
user = fields.Many2One('res.user', 'User', states={'readonly': True})
|
|
||||||
require_voucher = fields.Boolean('Require Voucher', depends=['statement'])
|
require_voucher = fields.Boolean('Require Voucher', depends=['statement'])
|
||||||
parties = fields.Many2Many('party.party', None, None, 'Parties')
|
parties = fields.Many2Many('party.party', None, None, 'Parties')
|
||||||
folios = fields.Many2Many('hotel.folio', None, None, 'Folios')
|
folios = fields.Many2Many('hotel.folio', None, None, 'Folios')
|
||||||
|
statements = fields.Many2Many('account.statement', None, None, 'Statements')
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def default_require_voucher(cls):
|
def default_require_voucher():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def default_user(cls):
|
def default_kind():
|
||||||
user = Pool().get('res.user')(Transaction().user)
|
|
||||||
return user.id
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def default_kind(cls):
|
|
||||||
model = Transaction().context['active_model']
|
model = Transaction().context['active_model']
|
||||||
if model == "hotel.folio":
|
if model == "hotel.folio":
|
||||||
return "folio"
|
return "folio"
|
||||||
|
@ -2345,8 +2342,11 @@ class WizardStatementPayment(Wizard):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Booking = pool.get('hotel.booking')
|
Booking = pool.get('hotel.booking')
|
||||||
Folio = pool.get('hotel.folio')
|
Folio = pool.get('hotel.folio')
|
||||||
|
user = pool.get('res.user')(Transaction().user)
|
||||||
|
Statement = pool.get('account.statement')
|
||||||
model = Transaction().context['active_model']
|
model = Transaction().context['active_model']
|
||||||
active_id = Transaction().context['active_id']
|
active_id = Transaction().context['active_id']
|
||||||
|
user = pool.get('res.user')(Transaction().user)
|
||||||
parties_ids = []
|
parties_ids = []
|
||||||
folios_ids = []
|
folios_ids = []
|
||||||
folio_id = None
|
folio_id = None
|
||||||
|
@ -2381,6 +2381,17 @@ class WizardStatementPayment(Wizard):
|
||||||
folio.booking.responsible_payment == 'holder':
|
folio.booking.responsible_payment == 'holder':
|
||||||
pending_to_pay = folio.booking.pending_to_pay
|
pending_to_pay = folio.booking.pending_to_pay
|
||||||
|
|
||||||
|
if user.login == 'admin':
|
||||||
|
dom = [
|
||||||
|
('state', '=', 'draft'),
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
dom = [
|
||||||
|
('create_uid', '=', user.id),
|
||||||
|
('state', '=', 'draft'),
|
||||||
|
]
|
||||||
|
statements = Statement.search_read(dom, fields_names=['id'])
|
||||||
|
statement_ids = [st['id'] for st in statements]
|
||||||
return {
|
return {
|
||||||
'currency_digits': 2,
|
'currency_digits': 2,
|
||||||
'party': party_id,
|
'party': party_id,
|
||||||
|
@ -2388,6 +2399,7 @@ class WizardStatementPayment(Wizard):
|
||||||
'parties': parties_ids,
|
'parties': parties_ids,
|
||||||
'folios': folios_ids,
|
'folios': folios_ids,
|
||||||
'amount_to_pay': pending_to_pay,
|
'amount_to_pay': pending_to_pay,
|
||||||
|
'statements': statement_ids,
|
||||||
'kind': kind,
|
'kind': kind,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ copyright notices and license terms. -->
|
||||||
<field name="folio" widget="selection"/>
|
<field name="folio" widget="selection"/>
|
||||||
<label name="voucher"/>
|
<label name="voucher"/>
|
||||||
<field name="voucher"/>
|
<field name="voucher"/>
|
||||||
<field name="user" invisible="1"/>
|
<field name="statements" invisible="1"/>
|
||||||
<field name="require_voucher" invisible="1"/>
|
<field name="require_voucher" invisible="1"/>
|
||||||
<field name="parties" invisible="1"/>
|
<field name="parties" invisible="1"/>
|
||||||
<field name="folios" invisible="1"/>
|
<field name="folios" invisible="1"/>
|
||||||
|
|
Loading…
Reference in New Issue