Skip to content

Commit

Permalink
[MERGE] forward port branch saas-15 up to 3c78026
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Nov 15, 2018
2 parents 9148d86 + 3c78026 commit 468dab6
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 33 deletions.
21 changes: 12 additions & 9 deletions addons/account/report/account_aged_partner_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l
res = []
total = []
cr = self.env.cr
company_ids = self.env.context.get('company_ids', (self.env.user.company_id.id,))
user_company = self.env.user.company_id
user_currency = user_company.currency_id
ResCurrency = self.env['res.currency'].with_context(date=date_from)
company_ids = self._context.get('company_ids') or [user_company.id]
move_state = ['draft', 'posted']
if target_move == 'posted':
move_state = ['posted']
Expand Down Expand Up @@ -99,15 +102,15 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l
partner_id = line.partner_id.id or False
if partner_id not in undue_amounts:
undue_amounts[partner_id] = 0.0
line_amount = line.balance
if line.balance == 0:
line_amount = ResCurrency._compute(line.company_id.currency_id, user_currency, line.balance)
if user_currency.is_zero(line_amount):
continue
for partial_line in line.matched_debit_ids:
if partial_line.max_date <= date_from:
line_amount += partial_line.amount
line_amount += ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
for partial_line in line.matched_credit_ids:
if partial_line.max_date <= date_from:
line_amount -= partial_line.amount
line_amount -= ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
if not self.env.user.company_id.currency_id.is_zero(line_amount):
undue_amounts[partner_id] += line_amount
lines[partner_id].append({
Expand Down Expand Up @@ -151,15 +154,15 @@ def _get_partner_move_lines(self, account_type, date_from, target_move, period_l
partner_id = line.partner_id.id or False
if partner_id not in partners_amount:
partners_amount[partner_id] = 0.0
line_amount = line.balance
if line.balance == 0:
line_amount = ResCurrency._compute(line.company_id.currency_id, user_currency, line.balance)
if user_currency.is_zero(line_amount):
continue
for partial_line in line.matched_debit_ids:
if partial_line.max_date <= date_from:
line_amount += partial_line.amount
line_amount += ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
for partial_line in line.matched_credit_ids:
if partial_line.max_date <= date_from:
line_amount -= partial_line.amount
line_amount -= ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)

if not self.env.user.company_id.currency_id.is_zero(line_amount):
partners_amount[partner_id] += line_amount
Expand Down
2 changes: 0 additions & 2 deletions addons/account/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ access_account_journal_invoice,account.journal invoice,model_account_journal,acc
access_account_invoice_group_invoice,account.invoice group invoice,model_account_invoice,account.group_account_invoice,1,1,1,1
access_res_currency_account_manager,res.currency account manager,base.model_res_currency,group_account_manager,1,1,1,1
access_res_currency_rate_account_manager,res.currency.rate account manager,base.model_res_currency_rate,group_account_manager,1,1,1,1
access_account_invoice_user,account.invoice user,model_account_invoice,base.group_user,1,0,0,0
access_account_invoice_user,account.invoice.line user,model_account_invoice_line,base.group_user,1,0,0,0
access_account_invoice_portal,account.invoice.portal,account.model_account_invoice,base.group_portal,1,0,0,0
access_account_invoice_line_portal,account.invoice.line.portal,account.model_account_invoice_line,base.group_portal,1,0,0,0
access_account_payment_term_partner_manager,account.payment.term partner manager,model_account_payment_term,base.group_user,1,0,0,0
Expand Down
8 changes: 4 additions & 4 deletions addons/account_asset/views/account_asset_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@
<label for="account_asset_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_asset_id" string="Deferred Revenue Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}"/>
<field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}" domain="[('company_id', '=', company_id)]"/>
<div>
<label for="account_depreciation_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_id" string="Recognition Income Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_depreciation_id" nolabel="1"/>
<field name="account_depreciation_id" nolabel="1" domain="[('company_id', '=', company_id)]"/>
<div>
<label for="account_depreciation_expense_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_expense_id" string="Recognition Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
<field name="account_depreciation_expense_id" nolabel="1"/>
<field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
<field name="account_depreciation_expense_id" nolabel="1" domain="[('company_id', '=', company_id)]"/>
<field name="account_analytic_id" domain="[('company_id', '=', company_id)]" groups="analytic.group_analytic_accounting"/>
</group>
<group string="Periodicity">
<field name="method_time" string="Time Method Based On" widget="radio" attrs="{'invisible': [('type','!=','purchase')]}"/>
Expand Down
8 changes: 4 additions & 4 deletions addons/auth_signup/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ def _get_signup_url_for_action(self, action=None, view_type=None, menu_id=None,
for partner in self:
# when required, make sure the partner has a valid signup token
if self.env.context.get('signup_valid') and not partner.user_ids:
partner.signup_prepare()
partner.sudo().signup_prepare()

route = 'login'
# the parameters to encode for the query
query = dict(db=self.env.cr.dbname)
signup_type = self.env.context.get('signup_force_type_in_url', partner.signup_type or '')
signup_type = self.env.context.get('signup_force_type_in_url', partner.sudo().signup_type or '')
if signup_type:
route = 'reset_password' if signup_type == 'reset' else signup_type

if partner.signup_token and signup_type:
query['token'] = partner.signup_token
if partner.sudo().signup_token and signup_type:
query['token'] = partner.sudo().signup_token
elif partner.user_ids:
query['login'] = partner.user_ids[0].login
else:
Expand Down
2 changes: 1 addition & 1 deletion addons/mrp/report/mrp_bom_cost_report_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<span t-field="bom_line['product_id'].default_code"/>
</td>
<td colspan="3">
<span t-att-res-id="bom_line['product_id'].id" res-model="product.product" view-type="form" t-esc="bom_line['product_id'].name"/>
<span t-att-res-id="bom_line['product_id'].id" res-model="product.product" view-type="form" t-esc="bom_line['product_id'].display_name"/>
</td>
<td class="text-right">
<span t-esc="bom_line['product_uom_qty']" t-esc-options='{"widget": "float", "decimal_precision": "Product Unit of Measure"}'/> <span t-esc="bom_line['product_uom'].name" groups="product.group_uom"/>
Expand Down
2 changes: 2 additions & 0 deletions addons/point_of_sale/static/src/css/pos.css
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ td {
display: flex;
-webkit-flex: 1;
flex: 1;
max-width: -moz-available;
max-width: -webkit-fill-available;
}
.pos .orders {
display: -webkit-flex;
Expand Down
6 changes: 4 additions & 2 deletions addons/pos_restaurant/static/src/js/multiprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ models.Orderline = models.Orderline.extend({
}
},
set_dirty: function(dirty) {
this.mp_dirty = dirty;
this.trigger('change',this);
if (this.mp_dirty !== dirty) {
this.mp_dirty = dirty;
this.trigger('change', this);
}
},
get_line_diff_hash: function(){
if (this.get_note()) {
Expand Down
2 changes: 1 addition & 1 deletion addons/product/report/product_pricelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def get_report_values(self, docids, data=None):
quantities = self._get_quantity(data)
return {
'doc_ids': data.get('ids', data.get('active_ids')),
'doc_model': 'hr.contribution.register',
'doc_model': 'product.pricelist',
'docs': products,
'data': dict(
data,
Expand Down
3 changes: 2 additions & 1 deletion addons/sale/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,11 @@ def action_invoice_create(self, grouped=False, final=False):
raise UserError(_('There is no invoiceable line.'))

for invoice in invoices.values():
invoice.compute_taxes()
if not invoice.invoice_line_ids:
raise UserError(_('There is no invoiceable line.'))
# If invoice is negative, do a refund invoice instead
if invoice.amount_untaxed < 0:
if invoice.amount_total < 0:
invoice.type = 'out_refund'
for line in invoice.invoice_line_ids:
line.quantity = -line.quantity
Expand Down
4 changes: 0 additions & 4 deletions addons/sale_margin/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ def _product_margin(self):
for line in self:
currency = line.order_id.pricelist_id.currency_id
price = line.purchase_price
if not price:
from_cur = line.env.user.company_id.currency_id.with_context(date=line.order_id.date_order)
price = from_cur.compute(line.product_id.standard_price, currency, round=False)

line.margin = currency.round(line.price_subtotal - (price * line.product_uom_qty))


Expand Down
10 changes: 5 additions & 5 deletions addons/website_event/views/event_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@
</li>
</ul>
</div>
<div class="row">
<div class="col-sm-6 col-xs-offset-3">
<t t-call="website.pager"/>
</div>
</div>
<div class="col-md-3 oe_structure" id="right_column">
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-offset-3">
<t t-call="website.pager"/>
</div>
</div>
</div>
<div class="oe_structure"/>
</div>
Expand Down
15 changes: 15 additions & 0 deletions doc/cla/corporate/okia.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Belgium, 2018-11-05

Okia SPRL agrees to the terms of the Odoo Corporate Contributor License
Agreement v1.0.

I declare that I am authorized and able to make this agreement and sign this
declaration.

Signed,

Sylvain Van Hoof sylvain@okia.be https://github.com/sylvainvh

List of contributors:

Sylvain Van Hoof sylvain@okia.be https://github.com/sylvainvh
11 changes: 11 additions & 0 deletions doc/cla/individual/ugaitzolaizola.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Spain, 2018-10-17

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,

Ugaitz Olaizola Arbelaitz uolaizola@binovo.es

0 comments on commit 468dab6

Please sign in to comment.