diff --git a/hotel/__manifest__.py b/hotel/__manifest__.py
index 7f03c5386..0fd576c28 100644
--- a/hotel/__manifest__.py
+++ b/hotel/__manifest__.py
@@ -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
}
diff --git a/hotel/report/hotel_folio.xml b/hotel/report/hotel_folio.xml
new file mode 100644
index 000000000..d433f20a0
--- /dev/null
+++ b/hotel/report/hotel_folio.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/hotel/report/hotel_folio_templates.xml b/hotel/report/hotel_folio_templates.xml
new file mode 100644
index 000000000..0ed203b08
--- /dev/null
+++ b/hotel/report/hotel_folio_templates.xml
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+
+
+ Order #
+ Quotation #
+
+
+
+
+
+
+
+
+
+
+
+ | Description |
+ Quantity |
+ Unit Price |
+ Disc.(%) |
+ Taxes |
+ Amount |
+ Total Price |
+
+
+
+
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ | Subtotal |
+
+
+ |
+
+
+
+ | Total |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hotel/wizard/folio_make_invoice_advance.py b/hotel/wizard/folio_make_invoice_advance.py
index 7a030835d..132150c36 100644
--- a/hotel/wizard/folio_make_invoice_advance.py
+++ b/hotel/wizard/folio_make_invoice_advance.py
@@ -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
diff --git a/hotel_l10n_es/models/inherit_res_partner.py b/hotel_l10n_es/models/inherit_res_partner.py
index 7d2eed286..0d5c8e566 100755
--- a/hotel_l10n_es/models/inherit_res_partner.py
+++ b/hotel_l10n_es/models/inherit_res_partner.py
@@ -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: