[MERGE] Forward-port 9.0 up to 2c4512c263
This commit is contained in:
@@ -79,8 +79,7 @@ Best Regards,''')
|
||||
account.write({'code': account.code.rstrip('0').ljust(digits, '0')})
|
||||
|
||||
@api.multi
|
||||
def write(self, values):
|
||||
#restrict the closing of FY if there are still unposted entries
|
||||
def _validate_fiscalyear_lock(self, values):
|
||||
if values.get('fiscalyear_lock_date'):
|
||||
nb_draft_entries = self.env['account.move'].search([
|
||||
('company_id', 'in', [c.id for c in self]),
|
||||
@@ -88,6 +87,12 @@ Best Regards,''')
|
||||
('date', '<=', values['fiscalyear_lock_date'])])
|
||||
if nb_draft_entries:
|
||||
raise ValidationError(_('There are still unposted entries in the period you want to lock. You should either post or delete them.'))
|
||||
|
||||
@api.multi
|
||||
def write(self, values):
|
||||
#restrict the closing of FY if there are still unposted entries
|
||||
self._validate_fiscalyear_lock(values)
|
||||
|
||||
# Reflect the change on accounts
|
||||
for company in self:
|
||||
digits = values.get('accounts_code_digits') or company.accounts_code_digits
|
||||
|
||||
@@ -665,7 +665,8 @@ class MassMailing(osv.Model):
|
||||
email_fname = 'email_from'
|
||||
if 'email' in model._fields:
|
||||
email_fname = 'email'
|
||||
record_ids = model.search(cr, uid, [('id', 'in', res_ids), (email_fname, 'ilike', email)], context=context)
|
||||
ctx = dict(context or {}, active_test=False)
|
||||
record_ids = model.search(cr, uid, [('id', 'in', res_ids), (email_fname, 'ilike', email)], context=ctx)
|
||||
model.write(cr, uid, record_ids, {'opt_out': value}, context=context)
|
||||
|
||||
#------------------------------------------------------
|
||||
|
||||
@@ -731,7 +731,7 @@
|
||||
<t t-if='simple'>
|
||||
<line>
|
||||
<left><t t-esc='line.product_name_wrapped[0]' /></left>
|
||||
<right><value><t t-esc='line.price_display' /></value></right>
|
||||
<right><value t-att-value-decimals='pos.currency.decimals'>><t t-esc='line.price_display' /></value></right>
|
||||
</line>
|
||||
<t t-call="XmlReceiptWrappedProductNameLines"/>
|
||||
</t>
|
||||
@@ -743,19 +743,19 @@
|
||||
</t>
|
||||
<line indent='1'>
|
||||
<left>
|
||||
<value value-decimals='3' value-autoint='on'>
|
||||
<value t-att-value-decimals='pos.dp["Product Unit of Measure"]' value-autoint='on'>
|
||||
<t t-esc='line.quantity' />
|
||||
</value>
|
||||
<t t-if='line.unit_name !== "Unit(s)"'>
|
||||
<t t-esc='line.unit_name' />
|
||||
</t>
|
||||
x
|
||||
<value value-decimals='2'>
|
||||
<value t-att-value-decimals='pos.dp["Product Price"]'>
|
||||
<t t-esc='line.price' />
|
||||
</value>
|
||||
</left>
|
||||
<right>
|
||||
<value><t t-esc='line.price_display' /></value>
|
||||
<value t-att-value-decimals='pos.currency.decimals'><t t-esc='line.price_display' /></value>
|
||||
</right>
|
||||
</line>
|
||||
</t>
|
||||
@@ -767,11 +767,11 @@
|
||||
<t t-set='taxincluded' t-value='Math.abs(receipt.subtotal - receipt.total_with_tax) <= 0.000001' />
|
||||
<t t-if='!taxincluded'>
|
||||
<line><right>--------</right></line>
|
||||
<line><left>Subtotal</left><right> <value><t t-esc="receipt.subtotal" /></value></right></line>
|
||||
<line><left>Subtotal</left><right><value t-att-value-decimals='pos.currency.decimals'><t t-esc="receipt.subtotal" /></value></right></line>
|
||||
<t t-foreach='receipt.tax_details' t-as='tax'>
|
||||
<line>
|
||||
<left><t t-esc='tax.name' /></left>
|
||||
<right><value><t t-esc='tax.amount' /></value></right>
|
||||
<right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='tax.amount' /></value></right>
|
||||
</line>
|
||||
</t>
|
||||
</t>
|
||||
@@ -781,7 +781,7 @@
|
||||
<line><right>--------</right></line>
|
||||
<line class='total' size='double-height'>
|
||||
<left><pre> TOTAL</pre></left>
|
||||
<right><value><t t-esc='receipt.total_with_tax' /></value></right>
|
||||
<right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='receipt.total_with_tax' /></value></right>
|
||||
</line>
|
||||
<br/><br/>
|
||||
|
||||
@@ -790,14 +790,14 @@
|
||||
<t t-foreach='paymentlines' t-as='line'>
|
||||
<line>
|
||||
<left><t t-esc='line.name' /></left>
|
||||
<right><value><t t-esc='line.get_amount()'/></value></right>
|
||||
<right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='line.get_amount()'/></value></right>
|
||||
</line>
|
||||
</t>
|
||||
<br/>
|
||||
|
||||
<line size='double-height'>
|
||||
<left><pre> CHANGE</pre></left>
|
||||
<right><value><t t-esc='receipt.change' /></value></right>
|
||||
<right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='receipt.change' /></value></right>
|
||||
</line>
|
||||
<br/>
|
||||
|
||||
@@ -806,19 +806,19 @@
|
||||
<t t-if='receipt.total_discount'>
|
||||
<line>
|
||||
<left>Discounts</left>
|
||||
<right><value><t t-esc='receipt.total_discount'/></value></right>
|
||||
<right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='receipt.total_discount'/></value></right>
|
||||
</line>
|
||||
</t>
|
||||
<t t-if='taxincluded'>
|
||||
<t t-foreach='receipt.tax_details' t-as='tax'>
|
||||
<line>
|
||||
<left><t t-esc='tax.name' /></left>
|
||||
<right><value><t t-esc='tax.amount' /></value></right>
|
||||
<right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='tax.amount' /></value></right>
|
||||
</line>
|
||||
</t>
|
||||
<line>
|
||||
<left>Total Taxes</left>
|
||||
<right><value><t t-esc='receipt.total_tax'/></value></right>
|
||||
<right><value t-att-value-decimals='pos.currency.decimals'><t t-esc='receipt.total_tax'/></value></right>
|
||||
</line>
|
||||
</t>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class MercuryTransaction(models.Model):
|
||||
_name = 'pos_mercury.mercury_transaction'
|
||||
|
||||
def _get_pos_session(self):
|
||||
pos_session = self.env['pos.session'].search([('state', '=', 'opened'), ('user_id', '=', self.env.uid)])
|
||||
pos_session = self.env['pos.session'].search([('state', '=', 'opened'), ('user_id', '=', self.env.uid)], limit=1)
|
||||
if not pos_session:
|
||||
raise UserError("No POS session")
|
||||
|
||||
@@ -32,6 +32,7 @@ class MercuryTransaction(models.Model):
|
||||
raise UserError("No Mercury configuration associated with the journal.")
|
||||
|
||||
def _setup_request(self, data):
|
||||
# todo: in master make the client include the pos.session id and use that
|
||||
pos_session = self._get_pos_session()
|
||||
|
||||
config = pos_session.config_id
|
||||
|
||||
@@ -960,4 +960,11 @@ screens.define_action_button({
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
TableGuestsButton: TableGuestsButton,
|
||||
TransferOrderButton:TransferOrderButton,
|
||||
TableWidget: TableWidget,
|
||||
FloorScreenWidget: FloorScreenWidget,
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -576,19 +576,23 @@ class Report(osv.Model):
|
||||
"""
|
||||
writer = PdfFileWriter()
|
||||
streams = [] # We have to close the streams *after* PdfFilWriter's call to write()
|
||||
for document in documents:
|
||||
pdfreport = file(document, 'rb')
|
||||
streams.append(pdfreport)
|
||||
reader = PdfFileReader(pdfreport)
|
||||
for page in range(0, reader.getNumPages()):
|
||||
writer.addPage(reader.getPage(page))
|
||||
try:
|
||||
for document in documents:
|
||||
pdfreport = file(document, 'rb')
|
||||
streams.append(pdfreport)
|
||||
reader = PdfFileReader(pdfreport)
|
||||
for page in range(0, reader.getNumPages()):
|
||||
writer.addPage(reader.getPage(page))
|
||||
|
||||
merged_file_fd, merged_file_path = tempfile.mkstemp(suffix='.html', prefix='report.merged.tmp.')
|
||||
with closing(os.fdopen(merged_file_fd, 'w')) as merged_file:
|
||||
writer.write(merged_file)
|
||||
|
||||
for stream in streams:
|
||||
stream.close()
|
||||
merged_file_fd, merged_file_path = tempfile.mkstemp(suffix='.pdf', prefix='report.merged.tmp.')
|
||||
with closing(os.fdopen(merged_file_fd, 'w')) as merged_file:
|
||||
writer.write(merged_file)
|
||||
finally:
|
||||
for stream in streams:
|
||||
try:
|
||||
stream.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return merged_file_path
|
||||
|
||||
|
||||
@@ -80,10 +80,11 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
else:
|
||||
amount = self.amount
|
||||
name = _('Down Payment')
|
||||
if order.fiscal_position_id and self.product_id.taxes_id:
|
||||
tax_ids = order.fiscal_position_id.map_tax(self.product_id.taxes_id).ids
|
||||
taxes = self.product_id.taxes_id.filtered(lambda r: not order.company_id or r.company_id == order.company_id)
|
||||
if order.fiscal_position_id and taxes:
|
||||
tax_ids = order.fiscal_position_id.map_tax(taxes).ids
|
||||
else:
|
||||
tax_ids = self.product_id.taxes_id.ids
|
||||
tax_ids = taxes.ids
|
||||
|
||||
invoice = inv_obj.create({
|
||||
'name': order.client_order_ref or order.name,
|
||||
@@ -138,10 +139,11 @@ class SaleAdvancePaymentInv(models.TransientModel):
|
||||
raise UserError(_('The product used to invoice a down payment should have an invoice policy set to "Ordered quantities". Please update your deposit product to be able to create a deposit invoice.'))
|
||||
if self.product_id.type != 'service':
|
||||
raise UserError(_("The product used to invoice a down payment should be of type 'Service'. Please use another product or update this product."))
|
||||
if order.fiscal_position_id and self.product_id.taxes_id:
|
||||
tax_ids = order.fiscal_position_id.map_tax(self.product_id.taxes_id).ids
|
||||
taxes = self.product_id.taxes_id.filtered(lambda r: not order.company_id or r.company_id == order.company_id)
|
||||
if order.fiscal_position_id and taxes:
|
||||
tax_ids = order.fiscal_position_id.map_tax(taxes).ids
|
||||
else:
|
||||
tax_ids = self.product_id.taxes_id.ids
|
||||
tax_ids = taxes.ids
|
||||
so_line = sale_line_obj.create({
|
||||
'name': _('Advance: %s') % (time.strftime('%m %Y'),),
|
||||
'price_unit': amount,
|
||||
|
||||
@@ -81,7 +81,7 @@ class procurement_order(osv.osv):
|
||||
'partner_id': procurement.sale_line_id and procurement.sale_line_id.order_id.partner_id.id or procurement.partner_dest_id.id,
|
||||
'user_id': procurement.product_id.product_manager.id,
|
||||
'procurement_id': procurement.id,
|
||||
'description': procurement.name + '\n',
|
||||
'description': procurement.name + '<br/>',
|
||||
'project_id': project and project.id or False,
|
||||
'company_id': procurement.company_id.id,
|
||||
},context=context)
|
||||
|
||||
@@ -138,7 +138,7 @@ var FieldTextHtmlSimple = widget.extend({
|
||||
}
|
||||
},
|
||||
resize: function() {
|
||||
this.$('iframe').css('height', '0px').css('height', Math.max(30, Math.min(this.$content[0] ? this.$content[0].scrollHeight : 0, 500)) + 'px');
|
||||
this.$('> iframe.o_readonly').css('height', '0px').css('height', Math.max(30, Math.min(this.$content[0] ? this.$content[0].scrollHeight : 0, 500)) + 'px');
|
||||
},
|
||||
render_value: function () {
|
||||
var value = this.get('value');
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Morocco, 2016-06-26
|
||||
|
||||
I hereby agree to the terms of the Odoo Individual Contributor License
|
||||
Agreement v1.0.
|
||||
|
||||
I declare that I am authorized and able to make this agreement and sign this
|
||||
declaration.
|
||||
|
||||
Signed,
|
||||
|
||||
Ayoub Zahid azahid@agilorg.com https://github.com/AyoubZahid
|
||||
@@ -72,6 +72,8 @@
|
||||
<field name="user_id"/>
|
||||
<field name="nextcall"/>
|
||||
<field name="active"/>
|
||||
<separator/>
|
||||
<filter string="All" name="all" domain="['|', ('active', '=', False), ('active', '=', True)]" />
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="User" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Execution" domain="[]" context="{'group_by':'nextcall'}" />
|
||||
@@ -84,7 +86,7 @@
|
||||
<field name="res_model">ir.cron</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,calendar</field>
|
||||
<field name="context">{'active_test': False}</field>
|
||||
<field name="context">{'search_default_all': 1}</field>
|
||||
<field name="view_id" ref="ir_cron_view_tree"/>
|
||||
</record>
|
||||
<menuitem id="menu_ir_cron_act" action="ir_cron_act" parent="base.menu_automation"/>
|
||||
|
||||
Reference in New Issue
Block a user