mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP] Discount, Massive Changes Prices
This commit is contained in:
@@ -195,10 +195,6 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
inv_obj = self.env['account.invoice']
|
||||
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
|
||||
folios = self.folio_ids
|
||||
|
||||
for folio in folios:
|
||||
if folio.partner_invoice_id != self.partner_invoice_id:
|
||||
raise UserError(_('The billing directions must match'))
|
||||
|
||||
if self.advance_payment_method == 'all':
|
||||
inv_data = self._prepare_invoice()
|
||||
|
||||
@@ -7,6 +7,9 @@ class MassivePriceChangeWizard(models.TransientModel):
|
||||
_name = 'hotel.wizard.massive.price.reservation.days'
|
||||
|
||||
new_price = fields.Float('New Price', default=1, min=1)
|
||||
change_price = fields.Boolean('Change Prices', default=False)
|
||||
new_discount = fields.Float('New Discount', default=0, min=1)
|
||||
change_discount = fields.Boolean('Change Discounts', default=False)
|
||||
|
||||
@api.multi
|
||||
def massive_price_change_days(self):
|
||||
@@ -18,29 +21,16 @@ class MassivePriceChangeWizard(models.TransientModel):
|
||||
return False
|
||||
|
||||
cmds = []
|
||||
for rline in reservation_id.reservation_lines:
|
||||
for rline in reservation_id.reservation_line_ids:
|
||||
cmds.append((
|
||||
1,
|
||||
rline.id,
|
||||
{
|
||||
'price': self.new_price
|
||||
'price': self.new_price if self.change_price == True else rline.price,
|
||||
'discount': self.new_discount if self.change_discount == True else rline.discount
|
||||
}
|
||||
))
|
||||
reservation_id.write({
|
||||
'reservation_lines': cmds
|
||||
'reservation_line_ids': cmds
|
||||
})
|
||||
# FIXME: For some reason need force reservation price calcs
|
||||
reservation_id._computed_amount_reservation()
|
||||
# FIXME: Workaround for dispatch updated price
|
||||
reservation_id.folio_id.write({
|
||||
'room_lines': [
|
||||
(
|
||||
1,
|
||||
reservation_id.id, {
|
||||
'reservation_lines': cmds
|
||||
}
|
||||
)
|
||||
]
|
||||
})
|
||||
|
||||
return True
|
||||
|
||||
@@ -7,7 +7,14 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Massive Price Change" >
|
||||
<group>
|
||||
<field name="new_price" required="1" />
|
||||
<field name="change_price"/>
|
||||
<field name="new_price" required="1"
|
||||
attrs="{'readonly':[('change_price','=', False)]}" />
|
||||
</group>
|
||||
<group>
|
||||
<field name="change_discount"/>
|
||||
<field name="new_discount" required="1"
|
||||
attrs="{'readonly':[('change_discount','=', False)]}" />
|
||||
</group>
|
||||
<footer>
|
||||
<button name="massive_price_change_days" string="Massive Change" type="object"
|
||||
|
||||
Reference in New Issue
Block a user