mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
Merge branch '11.0' of https://github.com/hootel/hootel into 11.0
This commit is contained in:
@@ -61,6 +61,8 @@
|
||||
'data/email_template_reserv.xml',
|
||||
'data/email_template_exit.xml',
|
||||
'wizard/wizard_reservation.xml',
|
||||
'report/hotel_folio_templates.xml',
|
||||
'report/hotel_folio.xml'
|
||||
],
|
||||
'installable': True
|
||||
}
|
||||
|
||||
14
hotel/report/hotel_folio.xml
Normal file
14
hotel/report/hotel_folio.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<report
|
||||
id="action_report_folio"
|
||||
string="Folio"
|
||||
model="hotel.folio"
|
||||
report_type="qweb-pdf"
|
||||
file="hotel.report_folio"
|
||||
name="hotel.report_folio"
|
||||
print_report_name="(object.state in ('draft', 'sent') and 'Quotation - %s' % (object.name)) or 'Order - %s' % (object.name)"
|
||||
/>
|
||||
</data>
|
||||
</odoo>
|
||||
160
hotel/report/hotel_folio_templates.xml
Normal file
160
hotel/report/hotel_folio_templates.xml
Normal file
@@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<template id="report_folio_document">
|
||||
<t t-call="web.external_layout">
|
||||
<t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})" />
|
||||
<div class="page">
|
||||
<div class="oe_structure"/>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<t t-if="doc.partner_invoice_id != doc.partner_id">
|
||||
<div t-field="doc.partner_invoice_id"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
|
||||
</t>
|
||||
</div>
|
||||
<div class="col-xs-5 col-xs-offset-1">
|
||||
<div t-field="doc.partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
|
||||
<p t-if="doc.partner_id.vat"><t t-esc="doc.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="doc.partner_id.vat"/></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>
|
||||
<span t-if="doc.state not in ['draft','sent']">Order # </span>
|
||||
<span t-if="doc.state in ['draft','sent']">Quotation # </span>
|
||||
<span t-field="doc.name"/>
|
||||
</h2>
|
||||
|
||||
<div class="row mt32 mb32" id="informations">
|
||||
<div t-if="doc.client_order_ref" class="col-xs-3">
|
||||
<strong>Your Reference:</strong>
|
||||
<p t-field="doc.client_order_ref"/>
|
||||
</div>
|
||||
<div t-if="doc.confirmation_date and doc.state not in ['draft','sent']" class="col-xs-3">
|
||||
<strong>Date Ordered:</strong>
|
||||
<p t-field="doc.confirmation_date"/>
|
||||
</div>
|
||||
<div t-if="doc.date_order and doc.state in ['draft','sent']" class="col-xs-3">
|
||||
<strong>Quotation Date:</strong>
|
||||
<p t-field="doc.date_order"/>
|
||||
</div>
|
||||
<div t-if="doc.user_id.name" class="col-xs-3">
|
||||
<strong>Salesperson:</strong>
|
||||
<p t-field="doc.user_id"/>
|
||||
</div>
|
||||
<div name="payment_term" t-if="doc.payment_term_id" class="col-xs-3">
|
||||
<strong>Payment Terms:</strong>
|
||||
<p t-field="doc.payment_term_id"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Is there a discount on at least one line? -->
|
||||
<t t-set="display_discount" t-value="any([l.discount for l in doc.room_lines])"/>
|
||||
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<th class="text-right">Quantity</th>
|
||||
<th class="text-right">Unit Price</th>
|
||||
<th t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">Disc.(%)</th>
|
||||
<th class="text-right">Taxes</th>
|
||||
<th class="text-right" groups="sale.group_show_price_subtotal">Amount</th>
|
||||
<th class="text-right price_tax_included" groups="sale.group_show_price_total">Total Price</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sale_tbody">
|
||||
<!-- Lines associated -->
|
||||
<t t-foreach="doc.room_lines" t-as="l">
|
||||
<tr>
|
||||
<td><span t-field="l.name"/></td>
|
||||
<td class="text-right">
|
||||
<span t-field="l.nights"/>
|
||||
</td>
|
||||
<!--<td class="text-right">
|
||||
<span t-field="l.price_unit"/>
|
||||
</td>-->
|
||||
<td t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">
|
||||
<span t-field="l.discount"/>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-esc="', '.join(map(lambda x: (x.description or x.name), l.tax_ids))"/>
|
||||
</td>
|
||||
<td class="text-right" groups="sale.group_show_price_subtotal">
|
||||
<span t-field="l.price_subtotal"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
<td class="text-right" groups="sale.group_show_price_total">
|
||||
<span t-field="l.price_total"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="clearfix">
|
||||
<div class="row" name="total">
|
||||
<div class="col-xs-4 pull-right">
|
||||
<table class="table table-condensed" style="min-width: 200px;max-width: 350px;">
|
||||
<tr class="border-black" style="border-bottom:1px solid #dddddd;">
|
||||
<td><strong>Subtotal</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="doc.amount_untaxed"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
<!--<t t-foreach="doc._get_tax_amount_by_group()" t-as="amount_by_group">
|
||||
<tr style="border-bottom:1px solid #dddddd;">
|
||||
<t t-if="amount_by_group[3] == 1 and doc.amount_untaxed == amount_by_group[2]">
|
||||
<td>
|
||||
<span t-esc="amount_by_group[0]"/>
|
||||
<span>&nbsp;<span>on</span>&nbsp;<t t-esc="amount_by_group[2]" t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/></span>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-esc="amount_by_group[1]"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-else ="">
|
||||
<td>
|
||||
<span t-esc="amount_by_group[0]"/>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<span t-esc="amount_by_group[1]"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</t>
|
||||
</tr>
|
||||
</t>-->
|
||||
<tr class="border-black">
|
||||
<td><strong>Total</strong></td>
|
||||
<td class="text-right">
|
||||
<span t-field="doc.amount_total"
|
||||
t-options='{"widget": "monetary", "display_currency": doc.pricelist_id.currency_id}'/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p t-field="doc.note" />
|
||||
<p t-if="doc.payment_term_id.note">
|
||||
<span t-field="doc.payment_term_id.note"/>
|
||||
</p>
|
||||
<div class="oe_structure"/>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
|
||||
<template id="report_folio">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="doc">
|
||||
<t t-call="hotel.report_folio_document" t-lang="doc.partner_id.lang"/>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
@@ -391,7 +391,8 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
'fiscal_position_id': fiscal_position.id or self.partner_invoice_id.property_account_position_id.id,
|
||||
'company_id': company.id,
|
||||
'user_id': user and user.id,
|
||||
'team_id': team.id
|
||||
'team_id': team.id,
|
||||
'comment': self.folio_ids[0].note
|
||||
}
|
||||
return invoice_vals
|
||||
|
||||
|
||||
@@ -92,6 +92,54 @@ class ResPartner(models.Model):
|
||||
duplicated_fields = ['vat', 'document_number']
|
||||
return duplicated_fields
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
if vals.get('vat') and not self._context.get(
|
||||
"ignore_vat_update", False):
|
||||
for record in self:
|
||||
vat = vals.get('vat')
|
||||
if self.env.context.get('company_id'):
|
||||
company = self.env['res.company'].browse(self.env.context['company_id'])
|
||||
else:
|
||||
company = self.env.user.company_id
|
||||
if company.vat_check_vies:
|
||||
# force full VIES online check
|
||||
check_func = self.vies_vat_check
|
||||
else:
|
||||
# quick and partial off-line checksum validation
|
||||
check_func = self.simple_vat_check
|
||||
vat_country, vat_number = self._split_vat(vat)
|
||||
#check with country code as prefix of the TIN
|
||||
if not check_func(vat_country, vat_number):
|
||||
country_id = vals.get('country_id') or record.country_id.id
|
||||
vals['vat'] = record.fix_eu_vat_number(country_id, vat)
|
||||
return super(ResPartner, self).write(vals)
|
||||
|
||||
@api.constrains('country_id')
|
||||
def update_vat_code_country(self):
|
||||
for record in self:
|
||||
country_id = record.country_id.id
|
||||
vat = record.vat
|
||||
#check with country code as prefix of the TIN
|
||||
if vat:
|
||||
if self.env.context.get('company_id'):
|
||||
company = self.env['res.company'].browse(self.env.context['company_id'])
|
||||
else:
|
||||
company = self.env.user.company_id
|
||||
if company.vat_check_vies:
|
||||
# force full VIES online check
|
||||
check_func = self.vies_vat_check
|
||||
else:
|
||||
# quick and partial off-line checksum validation
|
||||
check_func = self.simple_vat_check
|
||||
vat_country, vat_number = self._split_vat(vat)
|
||||
if not check_func(vat_country, vat_number):
|
||||
vat_with_code = record.fix_eu_vat_number(country_id, vat)
|
||||
if country_id and vat != vat_with_code:
|
||||
record.with_context({'ignore_vat_update': True}).write({
|
||||
'vat': vat_with_code
|
||||
})
|
||||
|
||||
@api.constrains('vat')
|
||||
def _check_vat_unique(self):
|
||||
for record in self:
|
||||
|
||||
Reference in New Issue
Block a user