-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
============================== | ||
Timesheet Activities Pricelist | ||
============================== | ||
|
||
|
||
Installation | ||
============ | ||
|
||
To install this module, you need to: | ||
|
||
1. Clone the branch 8.0 of the repository https://github.com/open-synergy/opnsynid-hr | ||
2. Add the path to this repository in your configuration (addons-path) | ||
3. Update the module list | ||
4. Go to menu *Setting -> Modules -> Local Modules* | ||
5. Search For *Timesheet Activities Pricelist* | ||
6. Install the module | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Michael Viriyananda <viriyananda.michael@gmail.com> | ||
* Andhitia Rama <andhitia.r@gmail.com> | ||
* Nurazmi <azmimr67@gmail.com> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://simetri-sinergi.id/logo.png | ||
:alt: PT. Simetri Sinergi Indonesia | ||
:target: https://simetri-sinergi.id.com | ||
|
||
This module is maintained by the PT. Simetri Sinergi Indonesia. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 OpenSynergy Indonesia | ||
# Copyright 2020 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import ( | ||
models, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 OpenSynergy Indonesia | ||
# Copyright 2020 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Timesheet Activities Pricelist", | ||
"version": "8.0.1.0.0", | ||
"website": "https://simetri-sinergi.id", | ||
"author": "PT. Simetri Sinergi Indonesia, OpenSynergy Indonesia", | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"auto_install": True, | ||
"depends": [ | ||
"hr_timesheet", | ||
"account_analytic_line_pricelist", | ||
"hr_timesheet_product_policy", | ||
], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"data/product_pricelist_type_data.xml", | ||
"views/hr_analytic_timesheet_views.xml", | ||
"views/account_analytic_account_views.xml", | ||
], | ||
} |
16 changes: 16 additions & 0 deletions
16
hr_timesheet_pricelist/data/product_pricelist_type_data.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2020 OpenSynergy Indonesia | ||
Copyright 2020 PT. Simetri Sinergi Indonesia | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
|
||
<openerp> | ||
<data> | ||
|
||
<record id="pricelist_type_timesheet" model="product.pricelist.type"> | ||
<field name="name">Timesheet</field> | ||
<field name="key">timesheet</field> | ||
</record> | ||
|
||
|
||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 OpenSynergy Indonesia | ||
# Copyright 2020 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import ( | ||
hr_analytic_timesheet, | ||
account_analytic_account, | ||
hr_analytic_account_timesheet_pricelist, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 OpenSynergy Indonesia | ||
# Copyright 2020 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp import models, fields | ||
|
||
|
||
class AccountAnalyticAccount(models.Model): | ||
_name = "account.analytic.account" | ||
_inherit = "account.analytic.account" | ||
|
||
timesheet_pricelist_ids = fields.One2many( | ||
string="Timesheet Pricelist", | ||
comodel_name="hr.analytic_account_timesheet_pricelist", | ||
inverse_name="analytic_account_id", | ||
) |
31 changes: 31 additions & 0 deletions
31
hr_timesheet_pricelist/models/hr_analytic_account_timesheet_pricelist.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 OpenSynergy Indonesia | ||
# Copyright 2020 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp import models, fields | ||
|
||
|
||
class HrAnalyticAccountTimesheetPricelist(models.Model): | ||
_name = "hr.analytic_account_timesheet_pricelist" | ||
_description = "Analytic Account's Timesheet Pricelist" | ||
|
||
analytic_account_id = fields.Many2one( | ||
string="Analytic Account", | ||
comodel_name="account.analytic.account", | ||
) | ||
user_id = fields.Many2one( | ||
string="User", | ||
comodel_name="res.users", | ||
required=True, | ||
) | ||
product_id = fields.Many2one( | ||
string="Product", | ||
comodel_name="product.product", | ||
required=True, | ||
) | ||
pricelist_id = fields.Many2one( | ||
string="Timesheet Pricelist", | ||
comodel_name="product.pricelist", | ||
required=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 OpenSynergy Indonesia | ||
# Copyright 2020 PT. Simetri Sinergi Indonesia | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from openerp import models, api | ||
|
||
|
||
class HrAnalyticTimesheet(models.Model): | ||
_name = "hr.analytic.timesheet" | ||
_inherit = "hr.analytic.timesheet" | ||
|
||
@api.onchange( | ||
"account_id", | ||
"user_id", | ||
"product_id", | ||
) | ||
def onchange_pricelist_id(self): | ||
self.pricelist_id = False | ||
obj_ts_pricelist = self.env["hr.analytic_account_timesheet_pricelist"] | ||
if self.account_id and self.user_id and self.product_id: | ||
criteria = [ | ||
("analytic_account_id", "=", self.account_id.id), | ||
("user_id", "=", self.user_id.id), | ||
("product_id", "=", self.product_id.id) | ||
] | ||
ts_pricelists = obj_ts_pricelist.search(criteria) | ||
if len(ts_pricelists) > 0: | ||
self.pricelist_id = ts_pricelists[0].pricelist_id.id | ||
|
||
@api.onchange( | ||
"product_id", | ||
"unit_amount", | ||
"journal_id", | ||
"product_uom_id", | ||
"pricelist_id", | ||
"date", | ||
) | ||
def onchange_amount(self): | ||
_super = super(HrAnalyticTimesheet, self) | ||
_super.onchange_amount() | ||
|
||
is_sale_line = False | ||
obj_uom = self.env["product.uom"] | ||
obj_precision = self.env["decimal.precision"] | ||
|
||
if self.journal_id: | ||
if self.journal_id.type == "sale": | ||
is_sale_line = True | ||
|
||
if self.pricelist_id: | ||
pricelist = self.pricelist_id | ||
ctx1 = {} | ||
if self.date: | ||
ctx1.update({"date": self.date}) | ||
amount_unit = pricelist.with_context(ctx1).price_get( | ||
prod_id=self.product_id.id, | ||
qty=self.unit_amount)[pricelist.id] | ||
amount = obj_uom._compute_price( | ||
self.product_id.uom_id.id, | ||
amount_unit, | ||
self.product_uom_id.id) * self.unit_amount | ||
|
||
prec = obj_precision.precision_get("Account") | ||
result = round(amount, prec) | ||
if not is_sale_line: | ||
result *= -1.0 | ||
|
||
self.amount = result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
hr_analytic_account_timesheet_pricelist_employee,hr.analytic_account_timesheet_pricelist - Employee,hr_timesheet_pricelist.model_hr_analytic_account_timesheet_pricelist,base.group_user,1,1,1,1 | ||
hr_analytic_account_timesheet_pricelist_all,hr.analytic_account_timesheet_pricelist - All,hr_timesheet_pricelist.model_hr_analytic_account_timesheet_pricelist,,1,0,0,0 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions
34
hr_timesheet_pricelist/views/account_analytic_account_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2020 OpenSynergy Indonesia | ||
Copyright 2020 PT. Simetri Sinergi Indonesia | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
|
||
<openerp> | ||
<data> | ||
|
||
<record id="account_analytic_account_view_tree" model="ir.ui.view"> | ||
<field name="name">account.analytic.account form</field> | ||
<field name="model">account.analytic.account</field> | ||
<field name="inherit_id" ref="hr_timesheet.account_analytic_account_timesheet_form"/> | ||
<field name="arch" type="xml"> | ||
<data> | ||
<xpath expr="//notebook" position="inside"> | ||
<page name="timesheet_pricelist" string="Timesheet Pricelist" attrs="{'invisible':[('use_timesheets','=',False)]}"> | ||
<group name="timesheet_pricelist_1" colspan="4" col="2"> | ||
<field name="timesheet_pricelist_ids" nolabel="1" colspan="2"> | ||
<tree editable="top"> | ||
<field name="user_id"/> | ||
<field name="product_id" domain="['|',('id','in',parent.timesheet_account_allowed_product_ids[0][2]),('categ_id','in',parent.timesheet_account_allowed_product_categ_ids[0][2])]"/> | ||
<field name="pricelist_id" domain="[('type','=','timesheet')]"/> | ||
</tree> | ||
</field> | ||
</group> | ||
</page> | ||
</xpath> | ||
</data> | ||
</field> | ||
</record> | ||
|
||
|
||
</data> | ||
</openerp> |
24 changes: 24 additions & 0 deletions
24
hr_timesheet_pricelist/views/hr_analytic_timesheet_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2020 OpenSynergy Indonesia | ||
Copyright 2020 PT. Simetri Sinergi Indonesia | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
|
||
<openerp> | ||
<data> | ||
|
||
<record id="hr_analytic_timesheet_view_tree" model="ir.ui.view"> | ||
<field name="name">hr.analytic.timesheet form</field> | ||
<field name="model">hr.analytic.timesheet</field> | ||
<field name="inherit_id" ref="hr_timesheet.hr_timesheet_line_tree"/> | ||
<field name="arch" type="xml"> | ||
<data> | ||
<xpath expr="//field[@name='product_id']" position="before"> | ||
<field name="pricelist_id" domain="[('type','=','timesheet')]" invisible="1"/> | ||
</xpath> | ||
</data> | ||
</field> | ||
</record> | ||
|
||
|
||
</data> | ||
</openerp> |