Skip to content

Commit

Permalink
Merge 904e1ea into 0d8a61b
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Nov 23, 2014
2 parents 0d8a61b + 904e1ea commit 5ba16db
Show file tree
Hide file tree
Showing 20 changed files with 278 additions and 263 deletions.
18 changes: 0 additions & 18 deletions .coveragerc

This file was deleted.

3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -12,11 +12,12 @@ virtualenv:

install:
- git clone https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- git clone https://github.com/OCA/account-financial-tools ${HOME}/account-financial-tools -b ${VERSION}
- git clone https://github.com/OCA/webkit-tools ${HOME}/webkit-tools -b ${VERSION}
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly

script:
- travis_run_flake8
- travis_run_tests

after_success:
Expand Down
15 changes: 11 additions & 4 deletions __unported__/account_cutoff_accrual_base/__openerp__.py
Expand Up @@ -27,11 +27,18 @@
'category': 'Accounting & Finance',
'license': 'AGPL-3',
'summary': 'Base module for accrued expenses and revenues',
'description': """This module contains objets, fields and menu entries that are used by other accrual modules. So you need to install other accrual modules to get the additionnal functionalities :
- the module 'account_cutoff_accrual_picking' will manage accrued expenses and revenues based on pickings.
- a not-developped-yet module will manage accrued expenses and revenues based on timesheets.
'description': """
This module contains objets, fields and menu entries that are used by other
accrual modules. So you need to install other accrual modules to get the
additionnal functionalities:
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
* the module 'account_cutoff_accrual_picking' will manage accrued expenses and
revenues based on pickings.
* a not-developped-yet module will manage accrued expenses and revenues based
on timesheets.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
for any help or question about this module.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
Expand Down
2 changes: 1 addition & 1 deletion __unported__/account_cutoff_accrual_base/account.py
Expand Up @@ -33,4 +33,4 @@ class account_tax(orm.Model):
'account_accrued_expense_id': fields.many2one(
'account.account', 'Accrued Expense Tax Account',
domain=[('type', '<>', 'view'), ('type', '<>', 'closed')]),
}
}
2 changes: 1 addition & 1 deletion __unported__/account_cutoff_accrual_base/account_cutoff.py
Expand Up @@ -54,4 +54,4 @@ class account_cutoff_line(orm.Model):
'price_unit': fields.float(
'Unit Price', digits_compute=dp.get_precision('Product Price'),
readonly=True, help="Price per unit (discount included)"),
}
}
17 changes: 12 additions & 5 deletions __unported__/account_cutoff_accrual_picking/__openerp__.py
Expand Up @@ -31,18 +31,25 @@
Manage expense and revenue accruals from pickings
=================================================
This module generates expense and revenue accruals based on the status of pickings.
This module generates expense and revenue accruals based on the status of
pickings.
For revenue accruals, OpenERP will take into account all the delivery orders in *Delivered* state that have been shipped before the cut-off date and that have *Invoice Control* = *To Be Invoiced*.
For revenue accruals, OpenERP will take into account all the delivery orders
in *Delivered* state that have been shipped before the cut-off date and that
have *Invoice Control* = *To Be Invoiced*.
For expense accruals, OpenERP will take into account all the incoming shipments in *Received* state that have been received before the cut-off date and that have *Invoice Control* = *To Be Invoiced*.
For expense accruals, OpenERP will take into account all the incoming
shipments in *Received* state that have been received before the cut-off date
and that have *Invoice Control* = *To Be Invoiced*.
The current code of the module only works when :
* on sale orders, the *Create Invoice* field is set to *On Delivery Order* ;
* for purchase orders, the *Invoicing Control* field is set to *Based on incoming shipments*.
* for purchase orders, the *Invoicing Control* field is set to *Based on
incoming shipments*.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
for any help or question about this module.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
Expand Down
16 changes: 8 additions & 8 deletions __unported__/account_cutoff_accrual_picking/account_cutoff.py
Expand Up @@ -72,7 +72,7 @@ def _prepare_lines_from_picking(
project_id.id or False
discount = move_line.sale_line_id.discount
price_unit = move_line.sale_line_id.price_unit *\
(1-(discount or 0.0)/100.0)
(1 - (discount or 0.0) / 100.0)
taxes = move_line.sale_line_id.tax_id
partner_id = move_line.sale_line_id.order_id.partner_id.id
tax_account_field_name = 'account_accrued_revenue_id'
Expand Down Expand Up @@ -123,7 +123,7 @@ def _prepare_lines_from_picking(
tax_line['account_analytic_collected_id'],
# account_analytic_collected_id is for
# invoices IN and OUT
}))
}))
if company_currency_id != currency_id:
amount_company_currency = curr_obj.compute(
cr, uid, currency_id, company_currency_id, amount,
Expand Down Expand Up @@ -151,7 +151,7 @@ def _prepare_lines_from_picking(
'amount': amount,
'cutoff_amount': amount_company_currency,
'tax_line_ids': tax_line_ids,
}
}
return res

def get_lines_from_picking(self, cr, uid, ids, context=None):
Expand All @@ -164,14 +164,14 @@ def get_lines_from_picking(self, cr, uid, ids, context=None):
cur_cutoff = self.read(cr, uid, ids[0], [
'line_ids', 'type', 'cutoff_date', 'company_id',
'company_currency_id',
],
],
context=context)
# delete existing lines based on pickings
to_delete_line_ids = line_obj.search(
cr, uid, [
('parent_id', '=', cur_cutoff['id']),
('stock_move_id', '!=', False)
],
],
context=context)
if to_delete_line_ids:
line_obj.unlink(cr, uid, to_delete_line_ids, context=context)
Expand All @@ -186,8 +186,8 @@ def get_lines_from_picking(self, cr, uid, ids, context=None):
('state', '=', 'done'),
('invoice_state', '=', '2binvoiced'),
('date_done', '<=', cur_cutoff['cutoff_date'])
], context=context)
#print "pick_ids=", pick_ids
], context=context)
# print "pick_ids=", pick_ids
# Create account mapping dict
account_mapping = mapping_obj._get_mapping_dict(
cr, uid, cur_cutoff['company_id'][0], cur_cutoff['type'],
Expand Down Expand Up @@ -217,4 +217,4 @@ class account_cutoff_line(orm.Model):
'picking_date_done': fields.related(
'picking_id', 'date_done', type='date',
string='Date Done of the Picking', readonly=True),
}
}
14 changes: 10 additions & 4 deletions __unported__/account_cutoff_base/__openerp__.py
Expand Up @@ -27,12 +27,18 @@
'category': 'Accounting & Finance',
'license': 'AGPL-3',
'summary': 'Base module for Account Cut-offs',
'description': """This module contains objets, fields and menu entries that are used by other cut-off modules. So you need to install other cut-off modules to get the additionnal functionalities :
'description': """
This module contains objets, fields and menu entries that are used by other
cut-off modules. So you need to install other cut-off modules to get the
additionnal functionalities :
* the module *account_cutoff_prepaid* will manage prepaid cut-offs based on start date and end date,
* the module *account_cutoff_accrual_picking* will manage the accruals based on the status of the pickings.
* the module *account_cutoff_prepaid* will manage prepaid cut-offs based on
start date and end date,
* the module *account_cutoff_accrual_picking* will manage the accruals based
on the status of the pickings.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
for any help or question about this module.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
Expand Down
40 changes: 20 additions & 20 deletions __unported__/account_cutoff_base/account_cutoff.py
Expand Up @@ -36,8 +36,8 @@ class account_cutoff(orm.Model):
'state': {
'account_cutoff_base.cutoff_done':
lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done',
}
}
}

def copy(self, cr, uid, id, default=None, context=None):
if default is None:
Expand All @@ -47,7 +47,7 @@ def copy(self, cr, uid, id, default=None, context=None):
'move_id': False,
'state': 'draft',
'line_ids': False,
})
})
return super(account_cutoff, self).copy(
cr, uid, id, default=default, context=context)

Expand All @@ -69,7 +69,7 @@ def _compute_total_cutoff(self, cr, uid, ids, name, arg, context=None):
('accrued_expense', 'Accrued Expense'),
('prepaid_revenue', 'Prepaid Revenue'),
('prepaid_expense', 'Prepaid Expense'),
], 'Type', required=True, readonly=True,
], 'Type', required=True, readonly=True,
states={'draft': [('readonly', False)]}),
'move_id': fields.many2one(
'account.move', 'Cut-off Journal Entry', readonly=True),
Expand Down Expand Up @@ -103,7 +103,7 @@ def _compute_total_cutoff(self, cr, uid, ids, name, arg, context=None):
'state': fields.selection([
('draft', 'Draft'),
('done', 'Done'),
],
],
'State', select=True, readonly=True, track_visibility='onchange',
help="State of the cutoff. When the Journal Entry is created, "
"the state is set to 'Done' and the fields become read-only."),
Expand Down Expand Up @@ -156,13 +156,13 @@ def _default_cutoff_account_id(self, cr, uid, context=None):
'move_label': _default_move_label,
'type': _default_type,
'cutoff_account_id': _default_cutoff_account_id,
}
}

_sql_constraints = [(
'date_type_company_uniq',
'unique(cutoff_date, company_id, type)',
'A cutoff of the same type already exists with this cut-off date !'
)]
)]

def cutoff_date_onchange(
self, cr, uid, ids, type, cutoff_date, move_label):
Expand Down Expand Up @@ -227,7 +227,7 @@ def _prepare_move(self, cr, uid, cur_cutoff, to_provision, context=None):
'period_id': period_id,
'ref': move_label,
'line_id': movelines_to_create,
}
}
return res

def create_move(self, cr, uid, ids, context=None):
Expand All @@ -253,32 +253,32 @@ def create_move(self, cr, uid, ids, context=None):
if (
line.cutoff_account_id.id,
line.analytic_account_id.id or False
) in to_provision:
) in to_provision:
to_provision[(
line.cutoff_account_id.id,
line.analytic_account_id.id or False
)] += line.cutoff_amount
)] += line.cutoff_amount
else:
# if not already present
# if not already present
to_provision[(
line.cutoff_account_id.id,
line.analytic_account_id.id or False
)] = line.cutoff_amount
)] = line.cutoff_amount
# Same for tax lines
for tax_line in line.tax_line_ids:
if (
tax_line.cutoff_account_id.id,
tax_line.analytic_account_id.id or False
) in to_provision:
) in to_provision:
to_provision[(
tax_line.cutoff_account_id.id,
tax_line.analytic_account_id.id or False
)] += tax_line.cutoff_amount
)] += tax_line.cutoff_amount
else:
to_provision[(
tax_line.cutoff_account_id.id,
tax_line.analytic_account_id.id or False
)] = tax_line.cutoff_amount
)] = tax_line.cutoff_amount

vals = self._prepare_move(
cr, uid, cur_cutoff, to_provision, context=context)
Expand All @@ -287,7 +287,7 @@ def create_move(self, cr, uid, ids, context=None):
self.write(cr, uid, ids[0], {
'move_id': move_id,
'state': 'done',
}, context=context)
}, context=context)

action = {
'name': 'Cut-off Account Move',
Expand All @@ -299,7 +299,7 @@ def create_move(self, cr, uid, ids, context=None):
'type': 'ir.actions.act_window',
'nodestroy': False,
'target': 'current',
}
}
return action


Expand Down Expand Up @@ -390,7 +390,7 @@ class account_cutoff_tax_line(orm.Model):
'parent_id', 'company_currency_id',
type='many2one', relation='res.currency',
string="Company Currency", readonly=True),
}
}


class account_cutoff_mapping(orm.Model):
Expand All @@ -414,14 +414,14 @@ class account_cutoff_mapping(orm.Model):
('accrued_expense', 'Accrued Expense'),
('prepaid_revenue', 'Prepaid Revenue'),
('prepaid_expense', 'Prepaid Expense'),
], 'Cut-off Type', required=True),
], 'Cut-off Type', required=True),
}

_defaults = {
'company_id': lambda self, cr, uid, context:
self.pool['res.users'].browse(
cr, uid, uid, context=context).company_id.id,
}
}

def _get_mapping_dict(
self, cr, uid, company_id, cutoff_type='all', context=None):
Expand All @@ -436,7 +436,7 @@ def _get_mapping_dict(
cr, uid, [
('company_id', '=', company_id),
('cutoff_type', 'in', cutoff_type_filter),
],
],
context=context)
mapping_read = self.read(cr, uid, mapping_ids, context=context)
mapping = {}
Expand Down
15 changes: 12 additions & 3 deletions __unported__/account_cutoff_prepaid/__openerp__.py
Expand Up @@ -31,9 +31,18 @@
Manage prepaid expense and revenue based on start and end dates
===============================================================
This module adds a **Start Date** and **End Date** field on invoice lines. For example, if you have an insurance contrat for your company that run from April 1st 2013 to March 31st 2014, you will enter these dates as start and end dates on the supplier invoice line. If your fiscal year ends on December 31st 2013, 3 months of expenses are part of the 2014 fiscal year and should not be part of the 2013 fiscal year. So, thanks to this module, you will create a *Prepaid Expense* on December 31st 2013 and OpenERP will identify this expense with the 3 months that are after the cut-off date and propose to generate the appropriate cut-off journal entry.
This module adds a **Start Date** and **End Date** field on invoice lines. For
example, if you have an insurance contrat for your company that run from April
1st 2013 to March 31st 2014, you will enter these dates as start and end dates
on the supplier invoice line. If your fiscal year ends on December 31st 2013,
3 months of expenses are part of the 2014 fiscal year and should not be part of
the 2013 fiscal year. So, thanks to this module, you will create a *Prepaid
Expense* on December 31st 2013 and OpenERP will identify this expense with the
3 months that are after the cut-off date and propose to generate the
appropriate cut-off journal entry.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for any help or question about this module.
Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com>
for any help or question about this module.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
Expand All @@ -50,7 +59,7 @@
'images/prepaid_revenue_draft.jpg',
'images/prepaid_revenue_journal_entry.jpg',
'images/prepaid_revenue_done.jpg',
],
],
'installable': False,
'active': False,
'application': True,
Expand Down
4 changes: 2 additions & 2 deletions __unported__/account_cutoff_prepaid/account.py
Expand Up @@ -109,7 +109,7 @@ def _check_start_end_dates(self, cr, uid, ids):
_check_start_end_dates,
"Error msg in raise",
['start_date', 'end_date']
)]
)]


class account_invoice(orm.Model):
Expand All @@ -123,7 +123,7 @@ def inv_line_characteristic_hashcode(self, invoice, invoice_line):
hashcode = '%s-%s-%s' % (
code, invoice_line.get('start_date', 'False'),
invoice_line.get('end_date', 'False'),
)
)
return hashcode

def line_get_convert(self, cr, uid, x, part, date, context=None):
Expand Down

0 comments on commit 5ba16db

Please sign in to comment.