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