File tree Expand file tree Collapse file tree 9 files changed +167
-0
lines changed
static/src/components/sign_request Expand file tree Collapse file tree 9 files changed +167
-0
lines changed Original file line number Diff line number Diff line change
1
+ from . import models
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : "Stamp Sign" ,
3
+ "version" : "1.0" ,
4
+ "depends" : ["sign" ],
5
+ "category" : "Sign" ,
6
+ "data" : [
7
+ "views/sign_template_views.xml" ,
8
+ "data/sign_data.xml" ,
9
+ ],
10
+ "assets" : {
11
+ "sign.assets_pdf_iframe" : [
12
+ "stamp_sign/static/src/components/**/*" ,
13
+ ],
14
+ },
15
+ "installable" : True ,
16
+ "sequence" : 1 ,
17
+ "application" : True ,
18
+ "license" : "OEEL-1" ,
19
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <odoo >
3
+ <record model =" sign.item.type" id =" stamp_item_type" >
4
+ <field name =" name" >Stamp</field >
5
+ <field name =" item_type" >stamp</field >
6
+ <field name =" tip" >stamp</field >
7
+ <field name =" placeholder" >Stamp It</field >
8
+ <field name =" default_width" type =" float" >0.200</field >
9
+ <field name =" default_height" type =" float" >0.050</field >
10
+ <field name =" icon" >fa-certificate</field >
11
+ </record >
12
+ </odoo >
Original file line number Diff line number Diff line change
1
+ from . import sign_template
2
+ from . import res_users
Original file line number Diff line number Diff line change
1
+ from odoo import models , api
2
+
3
+
4
+ class ResUsers (models .Model ):
5
+ _inherit = "res.users"
6
+
7
+ @api .model
8
+ def get_current_user_company_details (self ):
9
+ user = self .env .user
10
+ details = {
11
+ "name" : user .name ,
12
+ "company" : user .company_id .name if user .company_id else "" ,
13
+ "address" : user .company_id .street if user .company_id else "" ,
14
+ "city" : user .company_id .city if user .company_id else "" ,
15
+ "country" : user .company_id .country_id .name
16
+ if user .company_id and user .company_id .country_id
17
+ else "" ,
18
+ "vat" : user .company_id .vat if user .company_id else "" ,
19
+ }
20
+ return details
Original file line number Diff line number Diff line change
1
+ from odoo import fields , models
2
+
3
+
4
+ class SignItemType (models .Model ):
5
+ _inherit = "sign.item.type"
6
+
7
+ item_type = fields .Selection (
8
+ selection_add = [
9
+ ("stamp" , "Stamp" ),
10
+ ],
11
+ ondelete = {"stamp" : "set default" },
12
+ )
13
+
14
+
15
+ class SignItem (models .Model ):
16
+ _inherit = "sign.item"
17
+
18
+ stamp_company = fields .Char ("Company" )
19
+ stamp_address = fields .Char ("Address" )
20
+ stamp_city = fields .Char ("City" )
21
+ stamp_country = fields .Char ("Country" )
22
+ stamp_vat = fields .Char ("VAT Number" )
23
+ stamp_logo = fields .Binary ("Stamp Logo" )
24
+
25
+ def _get_stamp_details_for_user (self ):
26
+ self .ensure_one ()
27
+ user = self .env .user
28
+ details = {}
29
+ if user .has_group ("base.group_user" ):
30
+ details = {
31
+ "company" : user .company_id .name ,
32
+ "address" : user .company_id .street ,
33
+ "city" : user .company_id .city ,
34
+ "country" : user .company_id .country_id .name ,
35
+ "vat" : user .company_id .vat ,
36
+ }
37
+ return details
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <templates xml : space =" preserve" >
3
+ <t t-name =" sign.stampItem" t-extend =" sign.signItem" >
4
+ <t t-jquery =" t[t-if='readonly']" t-append =" true" >
5
+ <t t-if =" type == 'stamp'" t-call =" sign.stampSignItem" />
6
+ </t >
7
+
8
+ <t t-jquery =" t[t-if='!readonly']" t-append =" true" >
9
+ <button t-if =" type == 'stamp'" t-att-title =" role" t-attf-class =" {{classes}} o_sign_sign_item text-center" style =" color:#757575;" t-att-style =" style" t-att-data-stamp =" value" >
10
+ <span class =" o_sign_helper" />
11
+ <img t-if =" value" t-att-src =" value" alt =" Stamp" />
12
+ <t t-if =" !value" >
13
+ <span class =" o_placeholder ps-0" >
14
+ <t t-esc =" placeholder" />
15
+ </span >
16
+ </t >
17
+ </button >
18
+ </t >
19
+ </t >
20
+
21
+ <div t-name =" sign.stampSignItem" t-att-title =" role" t-attf-class =" {{classes}} o_sign_sign_item" t-att-data-id =" id" t-att-style =" style" t-att-data-stamp =" value" >
22
+ <div class =" sign_item_body" >
23
+ <span t-if =" value" class =" o_sign_helper" />
24
+ <img t-if =" value" t-att-src =" value" alt =" Stamp" />
25
+ <t t-if =" !value" >
26
+ <span class =" o_placeholder ps-0" >
27
+ <t t-esc =" placeholder" />
28
+ </span >
29
+ </t >
30
+ <t t-if =" editMode" t-call =" sign.signItemConfiguration" />
31
+ </div >
32
+ </div >
33
+ </templates >
Original file line number Diff line number Diff line change
1
+ /** @odoo -module **/
2
+
3
+ import { patch } from "@web/core/utils/patch" ;
4
+ import { SignablePDFIframe } from "@sign/components/sign_request/signable_PDF_iframe" ;
5
+
6
+ patch ( SignablePDFIframe . prototype , {
7
+
8
+ enableCustom ( signItem ) {
9
+ super . enableCustom ( signItem ) ;
10
+
11
+ const signItemElement = signItem . el ;
12
+ const signItemData = signItem . data ;
13
+ const signItemType = this . signItemTypesById [ signItemData . type_id ] ;
14
+ const { item_type : type } = signItemType ;
15
+
16
+ if ( type === "stamp" ) {
17
+ signItemElement . addEventListener ( "click" , ( e ) => {
18
+ this . handleSignatureDialogClick ( e . currentTarget , signItemType ) ;
19
+ } ) ;
20
+ }
21
+ } ,
22
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <odoo >
3
+ <record id =" sign_item_form_view_inherit_stamp" model =" ir.ui.view" >
4
+ <field name =" name" >sign.item.form.inherit.stamp</field >
5
+ <field name =" model" >sign.item</field >
6
+ <field name =" inherit_id" ref =" sign.sign_item_view_form" />
7
+ <field name =" arch" type =" xml" >
8
+ <xpath expr =" //form//field[@name='responsible_id']" position =" after" >
9
+ <group >
10
+ <field name =" stamp_logo" widget =" image" class =" oe_avatar"
11
+ invisible =" type_id.item_type != 'stamp'" />
12
+ <field name =" stamp_company" invisible =" type_id.item_type != 'stamp'" />
13
+ <field name =" stamp_address" invisible =" type_id.item_type != 'stamp'" />
14
+ <field name =" stamp_city" invisible =" type_id.item_type != 'stamp'" />
15
+ <field name =" stamp_country" invisible =" type_id.item_type != 'stamp'" />
16
+ <field name =" stamp_vat" invisible =" type_id.item_type != 'stamp'" />
17
+ </group >
18
+ </xpath >
19
+ </field >
20
+ </record >
21
+ </odoo >
You can’t perform that action at this time.
0 commit comments